summaryrefslogtreecommitdiff
path: root/tests/utils
AgeCommit message (Collapse)Author
2025-03-09Merge "frameworks/base: remove deprecated Mockito usages" into main Adrian Roos
2025-03-06Improve Baklava detection in TestLooper Shai Barack
Flag: EXEMPT test-only code Bug: 379472827 Change-Id: Idf4fb68eba9b50a798455e8e32bede20b34fabdf
2025-03-05frameworks/base: remove deprecated Mockito usages Adrian Roos
Test: m checkbuild Flag: TEST_ONLY Bug: 310268946 Change-Id: Id68adb5ab554a8031f8d03f6158c0e9ffa03604c
2025-02-19Revert "Use Flag instead of method check to detect new message queue ↵ Maciej Żenczykowski
testability API" This reverts commit 949e5e48020db3c8d5b3b0a2b1b3d9120cab4ad2. Reason for revert: somehow incompatible with mainline R/S/T/U/V https://android-build.corp.google.com/test_investigate/?blocking=blocking&status=none&invocationId=I90800010367953228&testResultId=TR09129634304861714&legacy= java.lang.NoClassDefFoundError: android.net.connectivity.android.os.test.TestLooper at android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest.prepareService(MulticastRoutingCoordinatorServiceTest.kt:153) at android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest.testConstructor_multicastRoutingSocketIsCreated(MulticastRoutingCoordinatorServiceTest.kt:204) ... 8 trimmed Caused by: java.lang.NoSuchMethodError: No static method messageQueueTestability()Z in class Lcom/android/internal/hidden_from_bootclasspath/android/os/Flags; or its super classes (declaration of 'com.android.internal.hidden_from_bootclasspath.android.os.Flags' appears in /system/framework/framework.jar!classes4.dex) at android.net.connectivity.android.os.test.TestLooper.newTestabilityApisSupported(TestLooper.java:71) at android.net.connectivity.android.os.test.TestLooper.<clinit>(TestLooper.java:84) at android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest.prepareService(MulticastRoutingCoordinatorServiceTest.kt:153) at android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest.testMulticastRouting_applyForwardNone(MulticastRoutingCoordinatorServiceTest.kt:210) ... 9 more Change-Id: I40192ddd4366792b6d8742826e575b2569337c85
2025-02-14Use Flag instead of method check to detect new message queue testability API Shai Barack
Change-Id: I9fcb063b502722b6f6678c0218628a4e18193726 Flag: android.os.message_queue_testability
2025-02-14Reland "Remove MessageQueue reflection from TestLooper" Shai Barack
This reverts commit b652cb193092176cdc88d1268d5c9430d7a9aafa. Reason for revert: fixed underlying issue Change-Id: I21bd4453b42be42bc4dcc70a38242a7fa9bc8e1e
2025-01-31Revert "Reland "Remove MessageQueue reflection from TestLooper"" Shai Barack
This reverts commit a8ddc3595e3cc4f8596d5f5d22a854f16b26c98f. Reason for revert: seems to still fail the same tests as b/393534402 in post-submit Change-Id: Ieecdf67d5d0fbf3bfbae3312005d5b95e0f0b55b
2025-01-31Reland "Remove MessageQueue reflection from TestLooper" Shai Barack
This reverts commit c69688d86efd4eab0427be93573f0844b0966bb0. Reason for revert: fixed underlying issue, verified b/393534402 Change-Id: Idf55fd2ed3b24c7db6c599418dc6693b8a00d996
2025-01-31Revert "Remove MessageQueue reflection from TestLooper" Linus Tufvesson
This reverts commit ef7309768eddd05aa6d9fcacfed9447a1a9c9584. Reason for revert: `Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA;` is a ticking bomb for the SDK team. Can you please hold off on this assumption until we've finalized the SDK and bumped the SDK_INT for all relevant configurations (next, trunk and trunk-staging). (I bumped it to 36 for trunk-staging in ag/31522509 which triggered this code to be active and (probably) led to b/393534402) Change-Id: I9e6279f5d4845469cd29e47501da3e8546fc71d2
2025-01-28Remove MessageQueue reflection from TestLooper Shai Barack
Bug: 379472827 Change-Id: I9d6ee7b96bfe7e497abede1954b80357f0c6ed29 Flag: android.os.message_queue_testability
2025-01-27Merge "Revert "Remove MessageQueue reflection from TestLooper"" into main Treehugger Robot
2025-01-27Revert "Remove MessageQueue reflection from TestLooper" Shai Barack
This reverts commit 80a59fdb0209efc5832364ef8caf617652d430e7. Reason for revert: b/392708156 Bug: 392708156 Change-Id: I6b2a8621e00a5b98d124042bbbbbd9fe840fa3db
2025-01-27Merge "Remove MessageQueue reflection from TestLooper" into main Treehugger Robot
2025-01-27Remove MessageQueue reflection from TestLooper Shai Barack
Bug: 379472827 Change-Id: I5275e87a01b190c6888913ca1d137c7f2f0f3f21 Flag: android.os.message_queue_testability
2025-01-27Merge "Direct people away from Test{,able}Looper" into main Treehugger Robot
2025-01-27Give MessageQueue OWNERS ownership of Looper-related test utilities Shai Barack
Flag: EXEMPT OWNERS change Change-Id: Ib333d05ce03468dce9bfdf790730c97762c219f5
2025-01-26Direct people away from Test{,able}Looper Shai Barack
Recommend actively maintained and more correct alternatives. Change-Id: I6fce500e1a8baba1aa435301c8cd460cbb3ff24c Flag: android.os.message_queue_testability Bug: 112000181
2024-11-11Remove references to MessageQueue.mUseConcurrent in test utilities Shai Barack
This is no longer needed to support tests passing when CombinedMessageQueue is enabled. Change-Id: I8e54618505b90209a12bfd36f7b67363f274983d Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION
2024-11-05Make CombinedMessageQueue pick an implementation per instance Shai Barack
This makes the class play more nicely with testing solutions such as TestLooper and Robolectric Shadows that use reflection to drive MessageQueue. Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION Change-Id: If0aaa8d5e57aad1e7200e8900ca9fc5b35c8e0b5
2024-11-01Fix TestLooper to work with CombinedMessageQueue Shai Barack
CombinedMessageQueue uses a concurrent message queue implementation, which is not compatible with the way TestLooper works. This CL disables concurrent mode for TestLooper when CombinedMessageQueue is used. Change-Id: Iffa2978064368755dd06a03c6c472f96288a2888 Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION Bug: 336880969 Bug: 376602406 Bug: 376602402
2024-09-15Batch migration of frameworks/base TEST_MAPPING to test_module_config modules Ronald Braunstein
As part of go/test-module-config we are moving test options from TEST_MAPPING -> Android.bp files. In previous Cls, we created the new `test_module_config` rules in Android.bp This is updating the TEST_MAPPING file to use those rules. It is also removing "FlakyTest and IgnoreTest" exclude annoations as they are now added in gcl files per run rather than ad-hoc per module. I have a script that looks at the generated tradefed config file for the new options added in Android.bp files, then it looks at TEST_MAPPING files and find the places to update where the options match for the test. I am also doing abtd runs of each TEST_MAPPING file before and after my change and ensuring the number of tests run is the same (or at least as many). There are cases where tradefed would comping include-filters across TEST_MAPPING entries for the same module, but now they will be purposefully split up, causing some tests to be run under two different modules. Flag: TEST_ONLY Test: Ran adbt on each TEST_MAPPING and compared before and after results. Verified we were still running all the tests we were before. i.e. after the adbt run, I would download the test artfiact for the tradefed detailed evenvt and compare test counts. You can see CtsAppTestCases became CtsAppTestCases_cts_requesttileserviceaddtest, etc. I'm not including results for all 100 TEST_MAPPING files, but I did verify with scripts and eyes. Minor differences (like 2011 vs 2009) on a test that didn't change are ignored, but in general there were more tests run, not fewer. % diff <(grep started frameworks_base_services_core_java_com_android_server_statusbar_TEST_MAPPING/BASE.details) <(grep started frameworks_base_services_core_java_com_android_server_statusbar_TEST_MAPPING/NEW.details) | grep run < [run x86_64 CtsAppTestCases (testCount: 6,attempt: 0) started] > [run x86_64 CtsAppTestCases_cts_requesttileserviceaddtest (testCount: 6,attempt: 0) started] < [run x86_64 CtsLocationFineTestCases (testCount: 96,attempt: 0) started] > [run x86_64 CtsLocationFineTestCases_android_server_location (testCount: 96,attempt: 0) started] < [run x86_64 FrameworksNetTests (testCount: 2009,attempt: 0) started] > [run x86_64 FrameworksNetTests (testCount: 2011,attempt: 0) started] Test-Mapping-Slo-Bypass-Bug: b/335015078 Change-Id: If6e3cd0624ac1c16f1cd088566d967769f47199c
2024-09-11Make java_sdk_library dependencies explicit Jihoon Kang
modules should specify the submodule of java_sdk_library that the module actually depends on Test: CI Flag: EXEMPT build dependency cleanup Bug: 358613520 Merged-In: I80af0b9efa88c668306f0ff1d51491a8180dc57f Change-Id: I80af0b9efa88c668306f0ff1d51491a8180dc57f
2024-04-19Add tests for IME predictive back animation Johannes Gallmann
Bug: 322836622 Flag: ACONFIG android.view.inputmethod.predictive_back_ime DISABLED Test: atest FrameworksCoreTests:InsetsControllerTest Test: atest FrameworksCoreTests:ImeBackAnimationControllerTest Change-Id: I4f3691da317544a43721d4671f4e901d33c35b90
2023-12-19Update the imports to androidx.test.filters.* Fangqiu Su
Bug: 316941721 Test: mmma . Change-Id: Ie8326973c44e87c4265254863d1788d8a3e25a35
2023-09-28Use androidx FlakyTest annotation for device tests. Anna Zhuravleva
Platform_testing large test annotation is for host side tests and will be restricted, device tests should use androidx annotation. Bug: 293837621 Test: presubmit Change-Id: Ie7059450d2904ce424a6338069873020b78cc6dd
2023-09-08Use androidx LargeTest annotation for device tests. Anna Zhuravleva
Platform_testing LargeTest annotation is for host side tests, device tests should use androidx annotation. Bug: 293837621 Test: build Change-Id: I8ea6f256b542a4ed0030b3d366c37f6fdafa6b3b
2023-08-23Introducing LocalServicesKeeperRule petsjonkin
Apply rule in AmbientLuxTest and DPCTest. Inject DisplayManagerInternal in ColorFade for test Bug: b/287945043 Test: atest AmbientLuxTest, atest ColorFadeTest, atest DisplayPowerControllerTest Change-Id: I97e9f67d18f1e9eb1e25b147efe369098de50258
2023-07-27Move tests for frameworks-base-testutils lib into their own target Ahmad Khalil
The test modules that include these util classes are running the util tests as well, because they're in the same java library. This change separates the util classes from their tests, with a new separate test mapping. Fix: 292212651 Test: atest frameworks-base-testutils-tests Change-Id: Ic8309a303307457e0e642370bc2a0a0335e4e8f6
2023-05-03Merge "FakePermissionEnforcer: provide a revokeAll method" am: b46adf6c75 ↵ Treehugger Robot
am: 486413f75a am: dbe84b81af am: 706ad760dc am: c16699a947 am: 1806a42549 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2578470 Change-Id: Icf18889e3923d8710afc2b4fd6dd8d3fdcd2544f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-03Merge "FakePermissionEnforcer: provide a revokeAll method" am: b46adf6c75 ↵ Treehugger Robot
am: 486413f75a am: dbe84b81af Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2578470 Change-Id: I22fd3c4eeab98b791d04bf1706cfe0dd1b4d3053 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-03FakePermissionEnforcer: provide a revokeAll method mattgilbride
This is useful in test suites that grant permissions on individual tests, and then revoke all permissions in an @After method. Bug: N/A Test: TH Change-Id: Ic3445f283702c7092c224bbe6f2340f5911b0541
2023-04-14Refreshes Accessibility core & service TEST_MAPPING files. Daniel Norman
- Adds FrameworksCoreTests:android.accessibilityservice to services/accessibility/TEST_MAPPING postsubmit. These tests weren't covered by any other a11y TEST_MAPPING. - Adds new TEST_MAPPING files, primarily in test dirs themselves. This ensures that test-only changes actually run their own tests. - All of these TEST_MAPPING files now import services/accessibility/TEST_MAPPING which contains the superset of our tests. In general this is useful because many of our files affect tests outside their direct package (e.g. changing a Node property could affect a Service test). This minimizes config complexity at the cost of sometimes running too many tests. Bug: 267225211 Test: atest --collect-tests-only \ --test-mapping <path to files next to new TEST_MAPPING> Change-Id: I674b93747f2f7e34b3038a07034029a982ac7f75
2023-03-30Merge "Introduce FakePermissionEnforcer" am: 8b5e1f2f31 am: 2bc83b47a1 am: ↵ Thiébaud Weksteen
7c0b116751 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2504875 Change-Id: I55842da1eec3d4b3c8223e1bfed106502c3f040f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-23Introduce FakePermissionEnforcer Thiébaud Weksteen
This fake allows tests to mock permissions of AIDL clients. Bug: 269684922 Test: atest FrameworksServicesTests:com.android.server.net.NetworkManagementServiceTest Change-Id: Iea4ec02d4be27f8043c1a57db11cadfd6d90b3ba
2022-12-07Merge "Override a sendBroadcastUser() variant in ↵ Treehugger Robot
BroadcastInterceptingContext." am: af61e0738c am: 33f61f4c18 am: c6728f55a5 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2321006 Change-Id: I20bc1a45a2f8422c67abb051d04e7032e3ac67ae Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02Add DisplayShapeTest to WM test Shawn Lin
Bug: 255712445 Test: make Change-Id: I5ba6173f9bdefccfe5c27096ea4947c2cfc157dd
2022-12-02Override a sendBroadcastUser() variant in BroadcastInterceptingContext. Sudheer Shanka
Bug: 255525222 Test: TH Change-Id: Icc776a388c9e9b1ab327ef7eb2209f35c92bb944
2022-11-21Delete dead code Victor Hsieh
The only user was deleted in ag/20445927. Bug: N/A Test: TH Change-Id: I695409f2e925ba003b946809976ef534b5b36194
2022-11-10Override registerReceiver methods in test Context to accept flags Michael Groover
The BroadcastInterceptingContext allows a broadcast Intent to be intercepted in the local process and sent directly to the receiver's onReceive method. This commit updates this class to also override the registerReceiver methods that accept the flags parameter to ensure broadcasts can be sent to receivers registering with flags during tests. Bug: 234659204 Test: atest com.android.networkstack.tethering.EntitlementManagerTest Change-Id: I9366ed1a3eb5f370b93e72981abac535f675a2bb
2022-04-11Re-root and use device remount APIs for SystemPreparer Winson
This might improve success rates for remounting the device. The command goes through shell with no inherent state, so it's unclear how it can fail, but going through the official methods might help. Bug: 197552347 Test: atest --rerun-until-failure 100 \ com.android.server.pm.test.OverlayActorVisibilityTest Change-Id: I25c1f938064e72ddc288b12c048f0cd82217b583
2022-02-10Enable to add ComponentCallbacks to Activity Charles Chen
This CL is mainly from the requirements to receive WindowMetrics updates in Jetpack Library. It also benefits the developers if they want to listen to Activity's configuration changes outside Activity Test: atest RegisterComponentCallbacksTest Bug: 199442549 Change-Id: Iff5c0a4d9c61d30b84ff9aee465f1b6b06f1a48d
2021-11-17Merge "SystemPreparer: remove support for FDE devices" am: 98f0a11a8a am: ↵ Treehugger Robot
7e0aeb84b0 am: 0ae29439c6 am: 95c68c6024 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1889876 Change-Id: Id91f2a2da0f16db1a3040817cf6645543b50830d
2021-11-17Merge "SystemPreparer: remove support for FDE devices" am: 98f0a11a8a am: ↵ Treehugger Robot
7e0aeb84b0 am: 0ae29439c6 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1889876 Change-Id: Ice36d05d07c69fbd84e6a9a5f3f173769b0551c7
2021-11-17SystemPreparer: remove support for FDE devices Eric Biggers
Bug: 191796797 Change-Id: I82fd9aeb5330444436f004e8971066c253ede0cf
2021-08-10Update framework-base-testutils to use new mockito Quang Luong
Update framework-base-testutils to use mockito-target-extended-minus-junit4 instead of mockito-target-minus-junit4 to allow tests to take advantage of the new static and final method mocking capabilities. Bug: 187755981 Test: build Change-Id: Ie0e4da02b7263cb6a89d91aeaa7230f3e932c4f2
2021-06-18Merge "Handle WindowProviderService#onConfigurationChanged" into sc-v2-dev ↵ Charles Chen
am: 41fc06529b Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14550549 Change-Id: I9d6656b2f4bd55a1d45bb1c3fba7eca29d44865c
2021-06-18Handle WindowProviderService#onConfigurationChanged Charles Chen
This CL makes WindowProviderService receive onConfigurationChanged callback when there's a config update from WM side. Test: atest WindowContextTests Test: atest ActivityThreadTest ActivityClientTest ConfigurationHelperTest fixes: 185766946 Change-Id: I922d52c1c38aecc1a948c79039cc03354adc646f
2021-05-18Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework" ↵ Nikita Iashchenko
am: a4466fbe61 am: 719831b948 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1686657 Change-Id: I08b1d281a3b71556d783b1d4f352bc7a4ba8e879
2021-05-13Move IoUtils#deleteContents from CorePlatformApi set to framework Nikita Iashchenko
As a part of internal core libraries cleanup move usages of IoUtils#deleteContents from CorePlatformApi set to framework. Bug: 154796679 Test: m update-api Change-Id: If7037029026b6753ab64be09aa52c40e04d5c7b1
2021-04-21Temp allowlist bluetooth broadcast to start FGS for 10 seconds. Hui Yu
Add an overloaded version of Context.sendBroadcastMultiplePermissions() that can specify BroadcastOptions, it is called by com.android.bluetooth package. Bug: 182816627 Test: atest AdapterServiceTest Test: atest AvrcpControllerStateMachineTest Test: atest BondStateMachineTest Test: atest MapClientStateMachineTest Test: atest RemoteDevicesTest Change-Id: I8bb2d2ed98ece70ebbe9d3a1b549b966d690de4f