From 4ecf2ba455486399026100f4d0f11f75ebeb3eb8 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 10 Mar 2020 20:03:23 -0600 Subject: [PATCH] More following of refactoring. Bug: 150939131 Exempt-From-Owner-Approval: trivial refactoring Test: atest frameworks/base/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java Change-Id: I74ddfb6f776cd61f56126d304cd81fad5d16ff94 --- .../com/android/keyguard/clock/ClockManagerTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java index 61991816a407e..353fe625b8ea6 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java @@ -50,6 +50,8 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import java.util.Arrays; + @SmallTest @RunWith(AndroidTestingRunner.class) // Need to run tests on main looper because LiveData operations such as setData, observe, @@ -126,7 +128,7 @@ public final class ClockManagerTest extends SysuiTestCase { when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(null); when(mMockSettingsWrapper.getDockedClockFace(anyInt())).thenReturn(null); // WHEN settings change event is fired - mContentObserver.onChange(false, SETTINGS_URI, MAIN_USER_ID); + mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); // THEN the result is null, indicated the default clock face should be used. assertThat(mClockManager.getCurrentClock()).isNull(); } @@ -136,7 +138,7 @@ public final class ClockManagerTest extends SysuiTestCase { // GIVEN that settings is set to the bubble clock face when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); // WHEN settings change event is fired - mContentObserver.onChange(false, SETTINGS_URI, MAIN_USER_ID); + mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); // THEN the plugin is the bubble clock face. assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); } @@ -146,7 +148,7 @@ public final class ClockManagerTest extends SysuiTestCase { // GIVEN that settings is set to the bubble clock face when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); // WHEN settings change event is fired - mContentObserver.onChange(false, SETTINGS_URI, MAIN_USER_ID); + mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); // THEN the plugin is the bubble clock face. ArgumentCaptor captor = ArgumentCaptor.forClass(ClockPlugin.class); verify(mMockListener1).onClockChanged(captor.capture()); @@ -158,7 +160,7 @@ public final class ClockManagerTest extends SysuiTestCase { // GIVEN that settings is set to the bubble clock face when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); // WHEN settings change event is fired - mContentObserver.onChange(false, SETTINGS_URI, MAIN_USER_ID); + mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); // THEN the listeners receive separate instances of the Bubble clock plugin. ArgumentCaptor captor1 = ArgumentCaptor.forClass(ClockPlugin.class); ArgumentCaptor captor2 = ArgumentCaptor.forClass(ClockPlugin.class); @@ -175,7 +177,7 @@ public final class ClockManagerTest extends SysuiTestCase { // custom clock face. when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn("bad value"); // WHEN settings change event is fired - mContentObserver.onChange(false, SETTINGS_URI, MAIN_USER_ID); + mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); // THEN the result is null. assertThat(mClockManager.getCurrentClock()).isNull(); }