Commit 22156329 authored by peter's avatar peter Committed by Commit bot

Fix NotificationUIManagerTest::testShowAndCloseMultipleNotifications.

Do this by making sure that we don't unregister the Service Worker for
each notification that's being shown, which actually closes the existing
ones on the platform.

BUG=472926

Review URL: https://codereview.chromium.org/1082273003

Cr-Commit-Position: refs/heads/master@{#325436}
parent c29d5c5f
...@@ -13,7 +13,6 @@ import android.test.suitebuilder.annotation.SmallTest; ...@@ -13,7 +13,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.browser.preferences.website.ContentSetting; import org.chromium.chrome.browser.preferences.website.ContentSetting;
...@@ -292,12 +291,8 @@ public class NotificationUIManagerTest extends ChromeShellTestBase { ...@@ -292,12 +291,8 @@ public class NotificationUIManagerTest extends ChromeShellTestBase {
* Verifies that multiple notifications without a tag can be opened and closed without * Verifies that multiple notifications without a tag can be opened and closed without
* affecting eachother. * affecting eachother.
*/ */
/* @LargeTest
@MediumTest
@Feature({"Browser", "Notifications"}) @Feature({"Browser", "Notifications"})
crbug.com/472926
*/
@DisabledTest
public void testShowAndCloseMultipleNotifications() throws Exception { public void testShowAndCloseMultipleNotifications() throws Exception {
setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW); setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW);
......
...@@ -2,11 +2,15 @@ ...@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
var activatedServiceWorkerPromise = null;
// Returns a promise that will be resolved with an activated Service // Returns a promise that will be resolved with an activated Service
// Worker, or rejects when the Service Worker could not be started. There // Worker, or rejects when the Service Worker could not be started. There
// will be a message port to and from the worker in |messagePort|. // will be a message port to and from the worker in |messagePort|.
function GetActivatedServiceWorker(script, scope) { function GetActivatedServiceWorker(script, scope) {
return navigator.serviceWorker.getRegistration(scope) if (activatedServiceWorkerPromise == null) {
activatedServiceWorkerPromise =
navigator.serviceWorker.getRegistration(scope)
.then(function(registration) { .then(function(registration) {
// Unregister any existing Service Worker. // Unregister any existing Service Worker.
if (registration) if (registration)
...@@ -43,4 +47,7 @@ function GetActivatedServiceWorker(script, scope) { ...@@ -43,4 +47,7 @@ function GetActivatedServiceWorker(script, scope) {
messagePort.start(); messagePort.start();
}); });
}); });
}
return activatedServiceWorkerPromise;
} }
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