Loading packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +7 −1 Original line number Diff line number Diff line Loading @@ -44,8 +44,10 @@ import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.SmartReplyController; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Rule; import org.mockito.Mockito; import java.io.FileInputStream; import java.io.IOException; Loading Loading @@ -120,11 +122,15 @@ public abstract class SysuiTestCase { TestableLooper.get(this).processAllMessages(); } disallowTestableLooperAsMainThread(); SystemUIFactory.cleanup(); mContext.cleanUpReceivers(this.getClass().getSimpleName()); mFakeBroadcastDispatcher.cleanUpReceivers(this.getClass().getSimpleName()); } @AfterClass public static void mockitoTearDown() { Mockito.framework().clearInlineMocks(); } /** * Tests are run on the TestableLooper; however, there are parts of SystemUI that assert that * the code is run from the main looper. Therefore, we allow the TestableLooper to pass these Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntryB import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; Loading Loading @@ -86,6 +87,7 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { super(mock(HeadsUpManagerLogger.class)); mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME; mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME; mHandler.removeCallbacksAndMessages(null); mHandler = mTestHandler; } Loading Loading @@ -145,6 +147,11 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { mAlertingNotificationManager = createAlertingNotificationManager(); } @After public void tearDown() { mTestHandler.removeCallbacksAndMessages(null); } @Test public void testShowNotification_addsEntry() { mAlertingNotificationManager.showNotification(mEntry); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerLegacyTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.google.android.collect.Lists; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -131,6 +132,11 @@ public class NotificationLoggerLegacyTest extends SysuiTestCase { verify(mNotifPipeline, never()).addCollectionListener(any()); } @After public void tearDown() { mLogger.mHandler.removeCallbacksAndMessages(null); } @Test public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception { NotificationVisibility[] newlyVisibleKeys = { Loading Loading @@ -281,6 +287,7 @@ public class NotificationLoggerLegacyTest extends SysuiTestCase { mNotificationPanelLoggerFake ); mBarService = barService; mHandler.removeCallbacksAndMessages(null); // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.google.android.collect.Lists; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -132,6 +133,11 @@ public class NotificationLoggerTest extends SysuiTestCase { verify(mNotifPipeline).addCollectionListener(any()); } @After public void tearDown() { mLogger.mHandler.removeCallbacksAndMessages(null); } @Test public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception { NotificationVisibility[] newlyVisibleKeys = { Loading Loading @@ -282,6 +288,7 @@ public class NotificationLoggerTest extends SysuiTestCase { mNotificationPanelLoggerFake ); mBarService = barService; mHandler.removeCallbacksAndMessages(null); // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.graphics.drawable.Icon; import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.testing.TestableLooper; Loading Loading @@ -139,6 +140,8 @@ public class NotificationTestHelper { mock(NotificationGroupManagerLegacy.class), mock(ConfigurationControllerImpl.class) ); mHeadsUpManager.mHandler.removeCallbacksAndMessages(null); mHeadsUpManager.mHandler = new Handler(mTestLooper.getLooper()); mGroupMembershipManager.setHeadsUpManager(mHeadsUpManager); mIconManager = new IconManager( mock(CommonNotifCollection.class), Loading Loading
packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +7 −1 Original line number Diff line number Diff line Loading @@ -44,8 +44,10 @@ import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.SmartReplyController; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Rule; import org.mockito.Mockito; import java.io.FileInputStream; import java.io.IOException; Loading Loading @@ -120,11 +122,15 @@ public abstract class SysuiTestCase { TestableLooper.get(this).processAllMessages(); } disallowTestableLooperAsMainThread(); SystemUIFactory.cleanup(); mContext.cleanUpReceivers(this.getClass().getSimpleName()); mFakeBroadcastDispatcher.cleanUpReceivers(this.getClass().getSimpleName()); } @AfterClass public static void mockitoTearDown() { Mockito.framework().clearInlineMocks(); } /** * Tests are run on the TestableLooper; however, there are parts of SystemUI that assert that * the code is run from the main looper. Therefore, we allow the TestableLooper to pass these Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntryB import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; Loading Loading @@ -86,6 +87,7 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { super(mock(HeadsUpManagerLogger.class)); mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME; mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME; mHandler.removeCallbacksAndMessages(null); mHandler = mTestHandler; } Loading Loading @@ -145,6 +147,11 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { mAlertingNotificationManager = createAlertingNotificationManager(); } @After public void tearDown() { mTestHandler.removeCallbacksAndMessages(null); } @Test public void testShowNotification_addsEntry() { mAlertingNotificationManager.showNotification(mEntry); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerLegacyTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.google.android.collect.Lists; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -131,6 +132,11 @@ public class NotificationLoggerLegacyTest extends SysuiTestCase { verify(mNotifPipeline, never()).addCollectionListener(any()); } @After public void tearDown() { mLogger.mHandler.removeCallbacksAndMessages(null); } @Test public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception { NotificationVisibility[] newlyVisibleKeys = { Loading Loading @@ -281,6 +287,7 @@ public class NotificationLoggerLegacyTest extends SysuiTestCase { mNotificationPanelLoggerFake ); mBarService = barService; mHandler.removeCallbacksAndMessages(null); // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.google.android.collect.Lists; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -132,6 +133,11 @@ public class NotificationLoggerTest extends SysuiTestCase { verify(mNotifPipeline).addCollectionListener(any()); } @After public void tearDown() { mLogger.mHandler.removeCallbacksAndMessages(null); } @Test public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception { NotificationVisibility[] newlyVisibleKeys = { Loading Loading @@ -282,6 +288,7 @@ public class NotificationLoggerTest extends SysuiTestCase { mNotificationPanelLoggerFake ); mBarService = barService; mHandler.removeCallbacksAndMessages(null); // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.graphics.drawable.Icon; import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.testing.TestableLooper; Loading Loading @@ -139,6 +140,8 @@ public class NotificationTestHelper { mock(NotificationGroupManagerLegacy.class), mock(ConfigurationControllerImpl.class) ); mHeadsUpManager.mHandler.removeCallbacksAndMessages(null); mHeadsUpManager.mHandler = new Handler(mTestLooper.getLooper()); mGroupMembershipManager.setHeadsUpManager(mHeadsUpManager); mIconManager = new IconManager( mock(CommonNotifCollection.class), Loading