Disable KeyguardSliceViewControllerTest on watch.
This test never passed on wearables because they don't have a SliceManager system service. This CL skips the test cases if running on watch. Fix: 279820876 Test: N/A Change-Id: I38a63ab67bd6fd9f2c3e114f822dd609ecc96421
This commit is contained in:
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package com.android.keyguard;
|
||||
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import android.testing.AndroidTestingRunner;
|
||||
import android.testing.TestableLooper.RunWithLooper;
|
||||
@@ -76,12 +78,20 @@ public class KeyguardSliceViewControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void refresh_replacesSliceContentAndNotifiesListener() {
|
||||
// Skips the test if running on a watch because watches don't have a SliceManager system
|
||||
// service.
|
||||
assumeFalse(isWatch());
|
||||
|
||||
mController.refresh();
|
||||
verify(mView).hideSlice();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onAttachedToWindow_registersListeners() {
|
||||
// Skips the test if running on a watch because watches don't have a SliceManager system
|
||||
// service.
|
||||
assumeFalse(isWatch());
|
||||
|
||||
mController.init();
|
||||
verify(mTunerService).addTunable(any(TunerService.Tunable.class), anyString());
|
||||
verify(mConfigurationController).addCallback(
|
||||
@@ -90,6 +100,10 @@ public class KeyguardSliceViewControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onDetachedFromWindow_unregistersListeners() {
|
||||
// Skips the test if running on a watch because watches don't have a SliceManager system
|
||||
// service.
|
||||
assumeFalse(isWatch());
|
||||
|
||||
ArgumentCaptor<View.OnAttachStateChangeListener> attachListenerArgumentCaptor =
|
||||
ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class);
|
||||
|
||||
@@ -102,4 +116,9 @@ public class KeyguardSliceViewControllerTest extends SysuiTestCase {
|
||||
verify(mConfigurationController).removeCallback(
|
||||
any(ConfigurationController.ConfigurationListener.class));
|
||||
}
|
||||
|
||||
private boolean isWatch() {
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
return pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user