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

Unified Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html

Issue 933153003: Add some image loading layout tests for Web Notifications. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
Index: LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html
diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html
new file mode 100644
index 0000000000000000000000000000000000000000..b3b3b61ec55e157e0cdc8eb72250ee8c377cbe9c
--- /dev/null
+++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Notifications: Showing a notification with an image and then abort the load immediately.</title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+ <script src="../serviceworker/resources/test-helpers.js"></script>
+ <script src="resources/test-helpers.js"></script>
+ </head>
+ <body>
+ <script>
+ // Tests that showing a notification with an image that takes 200ms to load, which
+ // is unlikely to succeed because the Service Worker registration will be unregistered
+ // immediately after, does not cause a crash.
+
+ async_test(function(test) {
+ var scope = 'resources/scope/' + location.pathname,
+ script = 'resources/instrumentation-service-worker.js';
+
+ testRunner.grantWebNotificationPermission(location.origin, true);
+ getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
+ // (1) Display a Web Notification through the Service Worker with which
+ // will take 200ms to load, and unregister the Service Worker immediately
+ // after that to abort the in-progress load.
+ info.port.postMessage({
+ command: 'show',
+
+ title: 'My Notification',
+ options: { body: 'Hello, world!',
+ icon: '/resources/slow-image.php?redirect_name=square100.png&mimeType=image/png&sleep=200' }
+ });
+
+ return info.registration.unregister().then(function () {
+ test.done();
+ });
+ }).catch(unreached_rejection(test));
+
+ }, 'Showing a notification with an image and then abort the load immediately.');
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698