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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/postmessage.html

Issue 2763113002: Upstream service worker postMessage tests to WPT (Closed)
Patch Set: Created 3 years, 9 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: third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/postmessage.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/postmessage.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/postmessage.html
deleted file mode 100644
index 7a78f5360baf49430a0ee32091aa31e09be75938..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/postmessage.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html>
-<title>ServiceWorkerGlobalScope: postMessage</title>
-<script src='../../resources/testharness.js'></script>
-<script src='../../resources/testharnessreport.js'></script>
-<script src='../resources/test-helpers.js'></script>
-<script>
-
-promise_test(function(t) {
- var script = 'resources/postmessage-loopback-worker.js';
- var scope = 'resources/scope/postmessage-loopback';
- var registration;
-
- return service_worker_unregister_and_register(t, script, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, registration.installing, 'activated');
- })
- .then(function() {
- var channel = new MessageChannel();
- var saw_message = new Promise(function(resolve) {
- channel.port1.onmessage = function(event) {
- resolve(event.data);
- };
- });
- registration.active.postMessage({port: channel.port2},
- [channel.port2]);
- return saw_message;
- })
- .then(function(result) {
- assert_equals(result, 'OK');
- return service_worker_unregister_and_done(t, scope);
- });
- }, 'Post loopback messages');
-
-promise_test(function(t) {
- var script1 = 'resources/postmessage-ping-worker.js';
- var script2 = 'resources/postmessage-pong-worker.js';
- var scope = 'resources/scope/postmessage-pingpong';
- var registration;
- var frame;
-
- return service_worker_unregister_and_register(t, script1, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, registration.installing, 'activated');
- })
- .then(function() {
- // A controlled frame is necessary for keeping a waiting worker.
- return with_iframe(scope);
- })
- .then(function(f) {
- frame = f;
- return navigator.serviceWorker.register(script2, {scope: scope});
- })
- .then(function(r) {
- return wait_for_state(t, r.installing, 'installed');
- })
- .then(function() {
- var channel = new MessageChannel();
- var saw_message = new Promise(function(resolve) {
- channel.port1.onmessage = function(event) {
- resolve(event.data);
- };
- });
- registration.active.postMessage({port: channel.port2},
- [channel.port2]);
- return saw_message;
- })
- .then(function(result) {
- assert_equals(result, 'OK');
- frame.remove();
- return service_worker_unregister_and_done(t, scope);
- });
- }, 'Post messages among service workers');
-
-</script>

Powered by Google App Engine
This is Rietveld 408576698