summaryrefslogtreecommitdiffstats
path: root/tests/unit/screen_ui_test.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* recovery: Add ability to interrupt UIJerry Zhang2018-07-301-1/+38
| | | | | | | | | | | | | | Normally calling a UI method will block indefinitely until the UI is actually used. This creates a method to interrupt the UI, causing waitKey to return -2. This in turn, will cause ShowMenu to return -2. This allows switching between recovery and fastbootd via usb commands. Test: adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test Bug: 78793464 Change-Id: I4c6c9aa18d79070877841a5c9818acf723fa6096
* tests: Clean up the temporary dirs post-run.Tao Bao2018-07-121-2/+3
| | | | | | | | | | TemporaryDir only deletes empty dirs (not done by its dtor because it tries to keep the temporary files available on error exit). Also change FreeCacheTest::MockFreeSpaceChecker to be static. Test: Run recovery_unit_test on marlin. Check /data/local/tmp post-run. Change-Id: I1bd54eb840e3094b4f22ee84c059eec2998773bf
* tests: Skip ScreenRecoveryUITest on gr_init failure.Tao Bao2018-06-141-1/+38
| | | | | | | | | | | | | | | | | It addresses the ScreenRecoveryUITest failures on gce targets which don't have any graphics backend. Probing for all backend devices in tests could work, but would duplicate codes. This CL relies on the result of gr_init(). As a side effect, it may give false negatives if gr_init() is supposed to work but silently broken. But such issues are beyond ScreenRecoveryUITest's concern, which should be captured by the tests for minui or graphics backends instead. Fixes: 79616356 Test: Run recovery_unit_test on marlin. Test: Run recovery_unit_test on gce. Change-Id: I121aacc61c8a614447509506057ecfd8d86163e4
* ui: join only if joinable.Tao Bao2018-06-061-0/+5
| | | | | | | | The threads in RecoveryUI only get initialized if their Init()s finish successfully. Test: recovery_unit_test on marlin. Change-Id: Ic4b62300a3cbd47887d9f4a90dc26f8a7deab616
* tests: Specify the death test style to avoid flakiness.Tao Bao2018-06-051-0/+2
| | | | | | | | | | | | | | | | | | | As warned below (while running the test), the default death test style (i.e. "fast") doesn't work well in a threaded context, which causes test flakiness (timeout or early exit). [WARNING] external/googletest/googletest/src/gtest-death-test.cc:836:: Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected 3 threads. This CL specifies the death test styles to be "threadsafe" for the following death tests. - RangeSetTest.GetBlockNumber - RangeSetTest.file_range - ScreenRecoveryUITest.LoadAnimation_MissingAnimation Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test passes and the above warning is gone. Change-Id: I245bbc09286702d5cb326f878c4391e842b66cc5
* ui: Use std::thread to create input/progress threads.Tao Bao2018-05-221-2/+10
| | | | | | Test: Build and boot into recovery on walleye. Check the long press detection; `Run graphics test`. Change-Id: Ic3e9b0652fc3ff6fb3ad118df5ebb9bb4abda2cd
* wear_ui: Address a TODO regarding {intro,loop}_frames.Tao Bao2018-05-141-3/+53
| | | | | | | Also add tests for LoadAnimation that cover the change. Test: Run `recovery_unit_test` on marlin. Change-Id: I0380a5cdd0d85d55baecf7759eb647b6a9f3a085
* screen_ui: Fix an issue in RTL locale detection.Tao Bao2018-05-091-1/+1
| | | | | | | | | | | | | | | | The CL in [1] moved android.os.RecoverySystem to send the locale argument in well-formed BCP 47 language tags (e.g. "en-US" instead of "en_US"), with the matching changes to recovery code in [2]. However, the one in ScreenRecoveryUI::SetLocale() was missed, which broke RTL locale detection when using new format. [1] commit 38715228 in platform/frameworks/base [2] commit 2078b22e in platform/bootable/recovery Test: Set the locale to "ar-EG". `Run graphics test` under recovery. Check the progress bar. Test: Run recovery_unit_test on marlin. Change-Id: I7c7f5e0725bfb096109c7192c19f3f008e8e47e3
* tests: Add tests for ScreenRecoveryUI.Tao Bao2018-05-091-0/+167
| | | | | | | | | | | | In order to support that, this CL adds Paths::set_resource_dir() to override the default resource dir ("/res/images/") that's only available under recovery. Note that since there're external modules depending on libminui, it adds a separate function of res_set_resource_dir(), instead of requiring the dependency on libotautil for everyone. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
* Move menu headers/items to std::vector<std::string>.Tao Bao2018-05-031-12/+15
| | | | | | | | | Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI that shows menu ('View recovery log', 'Wipe data', 'Run locale test'). Test: Start recovery with '--prompt_and_wipe_data'. Check the UI. Change-Id: If8a4209e0bb4ca64f719f9f9465d3b3589a69cdc
* screen_ui: Merge Menu::Start() into its ctor.Tao Bao2018-05-031-21/+7
| | | | | | | | | | | Since we instantiate a Menu object each time for a given set of header/items, we don't have a use case of re-populating an existing Menu with different data (which is what Menu::Start() does). Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI. Change-Id: Iaa2ba9d406ebd74c015e43198c17c5335b38df53
* Factor out a menu class for screen uiTianjie Xu2018-03-241-0/+198
Also consolidate the duplicate codes to draw the menu in ScreenRecoveryUI and WearRecoveryUI. This helps us to support text icons as menu in the future. Bug: 74397117 Test: Check the menu under recovery on bullhead and a wear device. Change-Id: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b Merged-In: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b