Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodAlphaViewModelTest.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,11 @@ package com.android.systemui.keyguard.ui.viewmodel package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -74,9 +77,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @Test @DisableSceneContainer @DisableSceneContainer @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = testScope.runTest { testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionSteps( keyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -186,9 +189,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @Test @DisableSceneContainer @DisableSceneContainer @EnableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_whenGone_equalsZero() = fun alpha_whenGone_equalsZero() = testScope.runTest { testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionStep( keyguardTransitionRepository.sendTransitionStep( Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt +32 −36 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.keyguard.ui.viewmodel package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.Flags as AConfigFlags import com.android.systemui.Flags as AConfigFlags Loading Loading @@ -69,10 +71,11 @@ class AodBurnInViewModelTest : SysuiTestCase() { private val burnInFlow = MutableStateFlow(BurnInModel()) private val burnInFlow = MutableStateFlow(BurnInModel()) @Before @Before @DisableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun setUp() { fun setUp() { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) kosmos.burnInInteractor = burnInInteractor kosmos.burnInInteractor = burnInInteractor Loading Loading @@ -174,10 +177,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = testScope.runTest { testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters = burnInParameters.copy( burnInParameters.copy( minViewY = 100, minViewY = 100, Loading Loading @@ -226,10 +228,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = testScope.runTest { testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters = burnInParameters.copy( burnInParameters.copy( minViewY = 100, minViewY = 100, Loading Loading @@ -310,104 +311,99 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherLargeClock() = fun translationAndScale_composeFlagOff_weatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherSmallClock() = fun translationAndScale_composeFlagOff_weatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = true, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherLargeClock() = fun translationAndScale_composeFlagOn_weatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherSmallClock() = fun translationAndScale_composeFlagOn_weatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = true, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) private fun testBurnInViewModelForClocks( private fun testBurnInViewModelForClocks( isSmallClock: Boolean, isSmallClock: Boolean, isWeatherClock: Boolean, isWeatherClock: Boolean, expectedScaleOnly: Boolean, expectedScaleOnly: Boolean, enableMigrateClocksToBlueprintFlag: Boolean, enableComposeLockscreenFlag: Boolean ) = ) = testScope.runTest { testScope.runTest { if (enableMigrateClocksToBlueprintFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } if (enableComposeLockscreenFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } if (isSmallClock) { if (isSmallClock) { keyguardClockRepository.setClockSize(ClockSize.SMALL) keyguardClockRepository.setClockSize(ClockSize.SMALL) // we need the following step to update stateFlow value // we need the following step to update stateFlow value Loading packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard package com.android.keyguard import android.content.BroadcastReceiver import android.content.BroadcastReceiver import android.platform.test.annotations.DisableFlags import android.view.View import android.view.View import android.view.ViewTreeObserver import android.view.ViewTreeObserver import android.widget.FrameLayout import android.widget.FrameLayout Loading Loading @@ -263,9 +264,9 @@ class ClockEventControllerTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun keyguardCallback_visibilityChanged_clockDozeCalled() = fun keyguardCallback_visibilityChanged_clockDozeCalled() = runBlocking(IMMEDIATE) { runBlocking(IMMEDIATE) { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() verify(keyguardUpdateMonitor).registerCallback(capture(captor)) verify(keyguardUpdateMonitor).registerCallback(capture(captor)) Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −42 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import android.database.ContentObserver; import android.database.ContentObserver; import android.os.UserHandle; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import android.provider.Settings; import android.view.View; import android.view.View; Loading @@ -48,11 +49,10 @@ import org.mockito.verification.VerificationMode; @SmallTest @SmallTest @RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { @Test @Test public void testInit_viewAlreadyAttached() { public void testInit_viewAlreadyAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); mController.init(); verifyAttachment(times(1)); verifyAttachment(times(1)); Loading @@ -60,8 +60,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testInit_viewNotYetAttached() { public void testInit_viewNotYetAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); Loading @@ -78,16 +76,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testInitSubControllers() { public void testInitSubControllers() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); mController.init(); verify(mKeyguardSliceViewController).init(); verify(mKeyguardSliceViewController).init(); } } @Test @Test public void testInit_viewDetached() { public void testInit_viewDetached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); mController.init(); mController.init(); Loading @@ -101,8 +95,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testPluginPassesStatusBarState() { public void testPluginPassesStatusBarState() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); Loading @@ -116,8 +108,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { public void testSmartspaceEnabledRemovesKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -126,8 +116,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void onLocaleListChangedRebuildsSmartspaceView() { public void onLocaleListChangedRebuildsSmartspaceView() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -138,8 +126,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -153,8 +139,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { public void testSmartspaceDisabledShowsKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(false); when(mSmartspaceController.isEnabled()).thenReturn(false); mController.init(); mController.init(); Loading @@ -163,8 +147,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testRefresh() { public void testRefresh() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.refresh(); mController.refresh(); verify(mSmartspaceController).requestSmartspaceUpdate(); verify(mSmartspaceController).requestSmartspaceUpdate(); Loading @@ -172,8 +154,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testChangeToDoubleLineClockSetsSmallClock() { public void testChangeToDoubleLineClockSetsSmallClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, UserHandle.USER_CURRENT)) UserHandle.USER_CURRENT)) .thenReturn(0); .thenReturn(0); Loading @@ -197,15 +177,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClock_ForwardsToClock() { public void testGetClock_ForwardsToClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); assertEquals(mClockController, mController.getClock()); assertEquals(mClockController, mController.getClock()); } } @Test @Test public void testGetLargeClockBottom_returnsExpectedValue() { public void testGetLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -218,8 +194,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetSmallLargeClockBottom_returnsExpectedValue() { public void testGetSmallLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -232,16 +206,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClockBottom_nullClock_returnsZero() { public void testGetClockBottom_nullClock_returnsZero() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); when(mClockEventController.getClock()).thenReturn(null); assertEquals(0, mController.getClockBottom(10)); assertEquals(0, mController.getClockBottom(10)); } } @Test @Test public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor.forClass(ContentObserver.class); ArgumentCaptor.forClass(ContentObserver.class); Loading @@ -260,8 +230,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); Loading @@ -284,15 +252,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClock_nullClock_returnsNull() { public void testGetClock_nullClock_returnsNull() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); when(mClockEventController.getClock()).thenReturn(null); assertNull(mController.getClock()); assertNull(mController.getClock()); } } private void verifyAttachment(VerificationMode times) { private void verifyAttachment(VerificationMode times) { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); verify(mClockRegistry, times).registerClockChangeListener( verify(mClockRegistry, times).registerClockChangeListener( any(ClockRegistry.ClockChangeListener.class)); any(ClockRegistry.ClockChangeListener.class)); verify(mClockEventController, times).registerListeners(mView); verify(mClockEventController, times).registerListeners(mView); Loading @@ -300,8 +264,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSplitShadeEnabledSetToSmartspaceController() { public void testSplitShadeEnabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(true); mController.setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); Loading @@ -309,8 +271,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSplitShadeDisabledSetToSmartspaceController() { public void testSplitShadeDisabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(false); mController.setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import android.content.Context; import android.content.Context; import android.platform.test.annotations.DisableFlags; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableLooper.RunWithLooper; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.LayoutInflater; Loading Loading @@ -60,6 +61,7 @@ import org.mockito.MockitoAnnotations; // the main thread before acquiring a wake lock. This class is constructed when // the main thread before acquiring a wake lock. This class is constructed when // the keyguard_clock_switch layout is inflated. // the keyguard_clock_switch layout is inflated. @RunWithLooper(setAsMainLooper = true) @RunWithLooper(setAsMainLooper = true) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchTest extends SysuiTestCase { public class KeyguardClockSwitchTest extends SysuiTestCase { @Mock @Mock ViewGroup mMockKeyguardSliceView; ViewGroup mMockKeyguardSliceView; Loading @@ -81,8 +83,6 @@ public class KeyguardClockSwitchTest extends SysuiTestCase { @Before @Before public void setUp() { public void setUp() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodAlphaViewModelTest.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,11 @@ package com.android.systemui.keyguard.ui.viewmodel package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -74,9 +77,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @Test @DisableSceneContainer @DisableSceneContainer @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = testScope.runTest { testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionSteps( keyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -186,9 +189,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @Test @DisableSceneContainer @DisableSceneContainer @EnableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_whenGone_equalsZero() = fun alpha_whenGone_equalsZero() = testScope.runTest { testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionStep( keyguardTransitionRepository.sendTransitionStep( Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt +32 −36 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.keyguard.ui.viewmodel package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.Flags as AConfigFlags import com.android.systemui.Flags as AConfigFlags Loading Loading @@ -69,10 +71,11 @@ class AodBurnInViewModelTest : SysuiTestCase() { private val burnInFlow = MutableStateFlow(BurnInModel()) private val burnInFlow = MutableStateFlow(BurnInModel()) @Before @Before @DisableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun setUp() { fun setUp() { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) kosmos.burnInInteractor = burnInInteractor kosmos.burnInInteractor = burnInInteractor Loading Loading @@ -174,10 +177,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = testScope.runTest { testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters = burnInParameters.copy( burnInParameters.copy( minViewY = 100, minViewY = 100, Loading Loading @@ -226,10 +228,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = testScope.runTest { testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters = burnInParameters.copy( burnInParameters.copy( minViewY = 100, minViewY = 100, Loading Loading @@ -310,104 +311,99 @@ class AodBurnInViewModelTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherLargeClock() = fun translationAndScale_composeFlagOff_weatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherSmallClock() = fun translationAndScale_composeFlagOff_weatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = true, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherLargeClock() = fun translationAndScale_composeFlagOn_weatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherSmallClock() = fun translationAndScale_composeFlagOn_weatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = true, isWeatherClock = true, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = false, isSmallClock = false, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = true, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) @Test @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = testBurnInViewModelForClocks( testBurnInViewModelForClocks( isSmallClock = true, isSmallClock = true, isWeatherClock = false, isWeatherClock = false, expectedScaleOnly = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) ) private fun testBurnInViewModelForClocks( private fun testBurnInViewModelForClocks( isSmallClock: Boolean, isSmallClock: Boolean, isWeatherClock: Boolean, isWeatherClock: Boolean, expectedScaleOnly: Boolean, expectedScaleOnly: Boolean, enableMigrateClocksToBlueprintFlag: Boolean, enableComposeLockscreenFlag: Boolean ) = ) = testScope.runTest { testScope.runTest { if (enableMigrateClocksToBlueprintFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } if (enableComposeLockscreenFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } if (isSmallClock) { if (isSmallClock) { keyguardClockRepository.setClockSize(ClockSize.SMALL) keyguardClockRepository.setClockSize(ClockSize.SMALL) // we need the following step to update stateFlow value // we need the following step to update stateFlow value Loading
packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard package com.android.keyguard import android.content.BroadcastReceiver import android.content.BroadcastReceiver import android.platform.test.annotations.DisableFlags import android.view.View import android.view.View import android.view.ViewTreeObserver import android.view.ViewTreeObserver import android.widget.FrameLayout import android.widget.FrameLayout Loading Loading @@ -263,9 +264,9 @@ class ClockEventControllerTest : SysuiTestCase() { } } @Test @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun keyguardCallback_visibilityChanged_clockDozeCalled() = fun keyguardCallback_visibilityChanged_clockDozeCalled() = runBlocking(IMMEDIATE) { runBlocking(IMMEDIATE) { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() verify(keyguardUpdateMonitor).registerCallback(capture(captor)) verify(keyguardUpdateMonitor).registerCallback(capture(captor)) Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −42 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import android.database.ContentObserver; import android.database.ContentObserver; import android.os.UserHandle; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import android.provider.Settings; import android.view.View; import android.view.View; Loading @@ -48,11 +49,10 @@ import org.mockito.verification.VerificationMode; @SmallTest @SmallTest @RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { @Test @Test public void testInit_viewAlreadyAttached() { public void testInit_viewAlreadyAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); mController.init(); verifyAttachment(times(1)); verifyAttachment(times(1)); Loading @@ -60,8 +60,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testInit_viewNotYetAttached() { public void testInit_viewNotYetAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); Loading @@ -78,16 +76,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testInitSubControllers() { public void testInitSubControllers() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); mController.init(); verify(mKeyguardSliceViewController).init(); verify(mKeyguardSliceViewController).init(); } } @Test @Test public void testInit_viewDetached() { public void testInit_viewDetached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); mController.init(); mController.init(); Loading @@ -101,8 +95,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testPluginPassesStatusBarState() { public void testPluginPassesStatusBarState() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); Loading @@ -116,8 +108,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { public void testSmartspaceEnabledRemovesKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -126,8 +116,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void onLocaleListChangedRebuildsSmartspaceView() { public void onLocaleListChangedRebuildsSmartspaceView() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -138,8 +126,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); mController.init(); mController.init(); Loading @@ -153,8 +139,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { public void testSmartspaceDisabledShowsKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(false); when(mSmartspaceController.isEnabled()).thenReturn(false); mController.init(); mController.init(); Loading @@ -163,8 +147,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testRefresh() { public void testRefresh() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.refresh(); mController.refresh(); verify(mSmartspaceController).requestSmartspaceUpdate(); verify(mSmartspaceController).requestSmartspaceUpdate(); Loading @@ -172,8 +154,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testChangeToDoubleLineClockSetsSmallClock() { public void testChangeToDoubleLineClockSetsSmallClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, UserHandle.USER_CURRENT)) UserHandle.USER_CURRENT)) .thenReturn(0); .thenReturn(0); Loading @@ -197,15 +177,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClock_ForwardsToClock() { public void testGetClock_ForwardsToClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); assertEquals(mClockController, mController.getClock()); assertEquals(mClockController, mController.getClock()); } } @Test @Test public void testGetLargeClockBottom_returnsExpectedValue() { public void testGetLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -218,8 +194,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetSmallLargeClockBottom_returnsExpectedValue() { public void testGetSmallLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -232,16 +206,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClockBottom_nullClock_returnsZero() { public void testGetClockBottom_nullClock_returnsZero() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); when(mClockEventController.getClock()).thenReturn(null); assertEquals(0, mController.getClockBottom(10)); assertEquals(0, mController.getClockBottom(10)); } } @Test @Test public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor.forClass(ContentObserver.class); ArgumentCaptor.forClass(ContentObserver.class); Loading @@ -260,8 +230,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true); Loading @@ -284,15 +252,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testGetClock_nullClock_returnsNull() { public void testGetClock_nullClock_returnsNull() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); when(mClockEventController.getClock()).thenReturn(null); assertNull(mController.getClock()); assertNull(mController.getClock()); } } private void verifyAttachment(VerificationMode times) { private void verifyAttachment(VerificationMode times) { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); verify(mClockRegistry, times).registerClockChangeListener( verify(mClockRegistry, times).registerClockChangeListener( any(ClockRegistry.ClockChangeListener.class)); any(ClockRegistry.ClockChangeListener.class)); verify(mClockEventController, times).registerListeners(mView); verify(mClockEventController, times).registerListeners(mView); Loading @@ -300,8 +264,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSplitShadeEnabledSetToSmartspaceController() { public void testSplitShadeEnabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(true); mController.setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); Loading @@ -309,8 +271,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test @Test public void testSplitShadeDisabledSetToSmartspaceController() { public void testSplitShadeDisabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(false); mController.setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import android.content.Context; import android.content.Context; import android.platform.test.annotations.DisableFlags; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableLooper.RunWithLooper; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.LayoutInflater; Loading Loading @@ -60,6 +61,7 @@ import org.mockito.MockitoAnnotations; // the main thread before acquiring a wake lock. This class is constructed when // the main thread before acquiring a wake lock. This class is constructed when // the keyguard_clock_switch layout is inflated. // the keyguard_clock_switch layout is inflated. @RunWithLooper(setAsMainLooper = true) @RunWithLooper(setAsMainLooper = true) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchTest extends SysuiTestCase { public class KeyguardClockSwitchTest extends SysuiTestCase { @Mock @Mock ViewGroup mMockKeyguardSliceView; ViewGroup mMockKeyguardSliceView; Loading @@ -81,8 +83,6 @@ public class KeyguardClockSwitchTest extends SysuiTestCase { @Before @Before public void setUp() { public void setUp() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) Loading