From 67e625de41840ded8ce5f6c63676ab40dc5091e2 Mon Sep 17 00:00:00 2001 From: Alejandro Nijamkin Date: Wed, 26 Jul 2023 17:13:29 -0700 Subject: Fixes failing test after coroutine lib upgrade. The changed test case started failing after the coroutines library has been upgraded; not sure why. This fixes it by making sure that we call runCurrent() right before we run the rest of the test to let the logic in the init block of the class under test do its thing and register a broadcast receiver through its callback-like flow. Bug: 292807808 Test: N/A Change-Id: Ifdc470e3350e36f616ce89e2185e855389b7547d Merged-In: Ifdc470e3350e36f616ce89e2185e855389b7547d (cherry picked from commit ba4953a76bac596c6b80757b24ad1179873fe868) --- .../com/android/systemui/user/domain/interactor/UserInteractorTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorTest.kt index e3b8649718c1..97377592ce24 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorTest.kt @@ -633,6 +633,7 @@ class UserInteractorTest : SysuiTestCase() { val userInfos = createUserInfos(count = 2, includeGuest = false) userRepository.setUserInfos(userInfos) userRepository.setSelectedUserInfo(userInfos[0]) + runCurrent() val refreshUsersCallCount = userRepository.refreshUsersCallCount fakeBroadcastDispatcher.registeredReceivers.forEach { @@ -653,6 +654,7 @@ class UserInteractorTest : SysuiTestCase() { val userInfos = createUserInfos(count = 2, includeGuest = false) userRepository.setUserInfos(userInfos) userRepository.setSelectedUserInfo(userInfos[0]) + runCurrent() val refreshUsersCallCount = userRepository.refreshUsersCallCount fakeBroadcastDispatcher.registeredReceivers.forEach { -- cgit v1.2.3-59-g8ed1b