Merge "Fix broken tests" into qt-dev
diff --git a/tests/robotests/src/com/android/settings/notification/AllowSoundPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/AllowSoundPreferenceControllerTest.java
index 88f8303..9d27541 100644
--- a/tests/robotests/src/com/android/settings/notification/AllowSoundPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/AllowSoundPreferenceControllerTest.java
@@ -139,7 +139,7 @@
}
@Test
- public void testUpdateState_notConfigurable() {
+ public void testUpdateState_notBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -150,7 +150,7 @@
Preference pref = new RestrictedSwitchPreference(mContext);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/BadgePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BadgePreferenceControllerTest.java
index 8265295..9ea201a 100644
--- a/tests/robotests/src/com/android/settings/notification/BadgePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BadgePreferenceControllerTest.java
@@ -187,7 +187,7 @@
}
@Test
- public void testUpdateState_channelNotConfigurable() {
+ public void testUpdateState_channelNotBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -198,7 +198,7 @@
Preference pref = new RestrictedSwitchPreference(mContext);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
index 54bbd08..0d0b485 100644
--- a/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
@@ -202,7 +202,7 @@
}
@Test
- public void testUpdateState_channelNotConfigurable() {
+ public void testUpdateState_channelNotBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -213,7 +213,7 @@
Preference pref = new RestrictedSwitchPreference(mContext);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
index 0b2af49..929c14d 100644
--- a/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
@@ -110,7 +110,7 @@
}
@Test
- public void testUpdateState_notConfigurable() {
+ public void testUpdateState_notBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -121,7 +121,7 @@
Preference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/LightsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/LightsPreferenceControllerTest.java
index dd6a620..3724ddb 100644
--- a/tests/robotests/src/com/android/settings/notification/LightsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/LightsPreferenceControllerTest.java
@@ -158,7 +158,7 @@
}
@Test
- public void testUpdateState_notConfigurable() {
+ public void testUpdateState_notBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -169,19 +169,6 @@
Preference pref = new RestrictedSwitchPreference(mContext);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
- }
-
- @Test
- public void testUpdateState_configurable() {
- NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
- NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.getId()).thenReturn("something");
- mController.onResume(appRow, channel, null, null);
-
- Preference pref = new RestrictedSwitchPreference(mContext);
- mController.updateState(pref);
-
assertTrue(pref.isEnabled());
}
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java
index 8c74334..a72597b 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java
@@ -209,6 +209,7 @@
appRow.lockedChannelId = sameId;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn(sameId);
+ when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
mController.onResume(appRow, channel, null, null);
assertFalse(mController.isChannelBlockable());
@@ -223,8 +224,10 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = "something";
appRow.lockedImportance = true;
+ NotificationChannel channel = mock(NotificationChannel.class);
+ when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
- mController.onResume(appRow, mock(NotificationChannel.class), null, null);
+ mController.onResume(appRow, channel, null, null);
assertFalse(mController.isChannelBlockable());
appRow.lockedImportance = false;
diff --git a/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
index 866f866..1d9836e 100644
--- a/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
@@ -161,7 +161,7 @@
}
@Test
- public void testUpdateState_notConfigurable() {
+ public void testUpdateState_notBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -173,7 +173,7 @@
Preference pref = new NotificationSoundPreference(mContext, attributeSet);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/VibrationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/VibrationPreferenceControllerTest.java
index e1d5b73..adc10f4 100644
--- a/tests/robotests/src/com/android/settings/notification/VibrationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/VibrationPreferenceControllerTest.java
@@ -140,7 +140,7 @@
}
@Test
- public void testUpdateState_notConfigurable() {
+ public void testUpdateState_notBlockable() {
String lockedId = "locked";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.lockedChannelId = lockedId;
@@ -151,7 +151,7 @@
Preference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
- assertFalse(pref.isEnabled());
+ assertTrue(pref.isEnabled());
}
@Test