From 205af35b52da04e3e190c252d42ac349b32575ec Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 9 Feb 2022 19:40:08 +0000 Subject: [PATCH] Update KeyguardIndicationControllerTest Test: atest SystemUITests Fixes: 218698841 Change-Id: I8d67ff84a1e7f1bb3b319ef335496db8b131f3a9 --- .../KeyguardIndicationControllerTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 592432947df23..419e84edd298c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -244,6 +244,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verify(mKeyguardStateController).addCallback( mKeyguardStateControllerCallbackCaptor.capture()); mKeyguardStateControllerCallback = mKeyguardStateControllerCallbackCaptor.getValue(); + + mExecutor.runAllReady(); + reset(mRotateTextViewController); } @Test @@ -328,6 +331,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_unmanaged() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false); when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(false); sendUpdateDisclosureBroadcast(); @@ -339,6 +343,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_deviceOwner_noOrganizationName() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true); when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(null); sendUpdateDisclosureBroadcast(); @@ -350,6 +355,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_orgOwnedDeviceWithManagedProfile_noOrganizationName() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(true); when(mUserManager.getProfiles(anyInt())).thenReturn(Collections.singletonList( new UserInfo(10, /* name */ null, /* flags */ FLAG_MANAGED_PROFILE))); @@ -363,6 +369,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_deviceOwner_withOrganizationName() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true); when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(ORGANIZATION_NAME); sendUpdateDisclosureBroadcast(); @@ -374,6 +381,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_orgOwnedDeviceWithManagedProfile_withOrganizationName() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(true); when(mUserManager.getProfiles(anyInt())).thenReturn(Collections.singletonList( new UserInfo(10, /* name */ null, FLAG_MANAGED_PROFILE))); @@ -386,6 +394,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void disclosure_updateOnTheFly() { + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false); createController(); @@ -416,6 +425,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void disclosure_deviceOwner_financedDeviceWithOrganizationName() { createController(); + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true); when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(ORGANIZATION_NAME); when(mDevicePolicyManager.getDeviceOwnerType(DEVICE_OWNER_COMPONENT)) @@ -738,12 +748,13 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void testEmptyOwnerInfoHidesIndicationArea() { createController(); - // GIVEN the owner info is set to an empty string + // GIVEN the owner info is set to an empty string & keyguard is showing + when(mKeyguardStateController.isShowing()).thenReturn(true); when(mLockPatternUtils.getDeviceOwnerInfo()).thenReturn(""); // WHEN asked to update the indication area mController.setVisible(true); - mExecutor.runAllReady(); + int runTasks = mExecutor.runAllReady(); // THEN the owner info should be hidden verifyHideIndication(INDICATION_TYPE_OWNER_INFO);