Commit 23f9a619 authored by Anita Woodruff's avatar Anita Woodruff Committed by Commit Bot

[Android Tests] Fix notification channel tests that only run on O

- Some of these tests were consistently failing but went unnoticed
because they only run on Android O+ and there are no cq-blocking
O bots yet.

- Tested by running all tests with *Channels* in the name on an
Android O device.

Change-Id: I29d92984eb9f9d74062ec36dc391412be8b0fa51
Reviewed-on: https://chromium-review.googlesource.com/1158834Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Anita Woodruff <awdf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579852}
parent 3d248fc5
...@@ -159,6 +159,9 @@ public class ChannelsUpdaterTest { ...@@ -159,6 +159,9 @@ public class ChannelsUpdaterTest {
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
public void testUpdateChannels_deletesLegacyChannelsAndCreatesExpectedOnes() throws Exception { public void testUpdateChannels_deletesLegacyChannelsAndCreatesExpectedOnes() throws Exception {
// Set up any legacy channels. // Set up any legacy channels.
mNotificationManagerProxy.createNotificationChannelGroup(
ChannelDefinitions.getChannelGroup(ChannelDefinitions.ChannelGroupId.GENERAL)
.toNotificationChannelGroup(mMockResources));
for (String id : ChannelDefinitions.getLegacyChannelIds()) { for (String id : ChannelDefinitions.getLegacyChannelIds()) {
NotificationChannel channel = NotificationChannel channel =
new NotificationChannel(id, id, NotificationManager.IMPORTANCE_LOW); new NotificationChannel(id, id, NotificationManager.IMPORTANCE_LOW);
......
...@@ -33,7 +33,7 @@ import org.chromium.chrome.browser.notifications.NotificationManagerProxyImpl; ...@@ -33,7 +33,7 @@ import org.chromium.chrome.browser.notifications.NotificationManagerProxyImpl;
import org.chromium.chrome.browser.notifications.NotificationSettingsBridge; import org.chromium.chrome.browser.notifications.NotificationSettingsBridge;
import org.chromium.chrome.browser.preferences.website.ContentSetting; import org.chromium.chrome.browser.preferences.website.ContentSetting;
import org.chromium.chrome.browser.preferences.website.PermissionInfo; import org.chromium.chrome.browser.preferences.website.PermissionInfo;
import org.chromium.content.browser.test.NativeLibraryTestRule; import org.chromium.chrome.browser.test.ChromeBrowserTestRule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -53,11 +53,11 @@ import java.util.List; ...@@ -53,11 +53,11 @@ import java.util.List;
public class SiteChannelsManagerTest { public class SiteChannelsManagerTest {
private SiteChannelsManager mSiteChannelsManager; private SiteChannelsManager mSiteChannelsManager;
@Rule @Rule
public NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule(); public ChromeBrowserTestRule mChromeBrowserTestRule = new ChromeBrowserTestRule();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
mNativeLibraryTestRule.loadNativeLibraryAndInitBrowserProcess(); mChromeBrowserTestRule.loadNativeLibraryAndInitBrowserProcess();
Context mContext = InstrumentationRegistry.getTargetContext(); Context mContext = InstrumentationRegistry.getTargetContext();
NotificationManagerProxy notificationManagerProxy = new NotificationManagerProxyImpl( NotificationManagerProxy notificationManagerProxy = new NotificationManagerProxyImpl(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment