Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2203)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java

Issue 2832493002: [Android O] Only delete legacy notification channels on upgrade (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsInitializerTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java
index 7e725b9ece40c6b28ca8af47768b8e6fbe15fdde..03f85d0aeacc6a46dd70140279b9376d9eef9544 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java
@@ -92,10 +92,17 @@ public class ChannelsUpdaterTest {
assertThat(mMockSharedPreferences.getInt(ChannelsUpdater.CHANNELS_VERSION_KEY, -1), is(21));
}
- // Suppressed in order to construct the old channels with invalid parameters.
+ // Warnings suppressed in order to construct the legacy channels with invalid channel ids.
@SuppressWarnings("WrongConstant")
@Test
public void testUpdateChannels_deletesLegacyChannelsAndCreatesExpectedOnes() throws Exception {
+ // Fake some legacy channels (since we don't have any yet).
+ ChannelDefinitions channelDefinitions = new ChannelDefinitions() {
+ @Override
+ public String[] getLegacyChannelIds() {
+ return new String[] {"OldChannel", "AnotherOldChannel"};
+ }
+ };
mMockNotificationManager.createNotificationChannel(new ChannelDefinitions.Channel(
"OldChannel", 8292304, NotificationManager.IMPORTANCE_HIGH,
ChannelDefinitions.CHANNEL_GROUP_ID_GENERAL));
@@ -105,8 +112,8 @@ public class ChannelsUpdaterTest {
assertThat(mMockNotificationManager.getNotificationChannelIds(),
containsInAnyOrder("OldChannel", "AnotherOldChannel"));
- ChannelsUpdater updater = new ChannelsUpdater(
- true /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 12);
+ ChannelsUpdater updater = new ChannelsUpdater(true /* isAtLeastO */, mMockSharedPreferences,
+ new ChannelsInitializer(mMockNotificationManager, channelDefinitions), 12);
updater.updateChannels();
assertThat(mMockNotificationManager.getNotificationChannelIds(),
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsInitializerTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698