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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/serviceworker-message-event.html

Issue 2466513002: Deprecate ServiceWorkerMessageEvent in favor of MessageEvent (Closed)
Patch Set: Rebase and update cross-origin-objects-exceptions-expected.txt Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: ServiceWorkerMessageEvent</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7
8 promise_test(function(t) {
9 var scope = 'resources/blank.html';
10 var url = 'resources/postmessage-to-client-worker.js';
11 return service_worker_unregister_and_register(t, url, scope)
12 .then(function(r) {
13 return wait_for_state(t, r.installing, 'activated');
14 })
15 .then(function() {
16 return with_iframe(scope);
17 })
18 .then(function(frame) {
19 var w = frame.contentWindow;
20 var worker = w.navigator.serviceWorker.controller;
21 // Test constructor with ServiceWorker object as source.
22 var e = new ServiceWorkerMessageEvent('eventType', {source: worker});
23 assert_equals(e.source, worker,
24 'Source should equal to the passing service worker');
25 return new Promise(function(resolve) {
26 w.navigator.serviceWorker.onmessage = t.step_func(function(e) {
27 assert_true(e instanceof w.ServiceWorkerMessageEvent);
28 assert_true(e.source instanceof w.ServiceWorker);
29 assert_equals(e.type, 'message');
30 assert_equals(e.source, worker,
31 'Source worker should equal to the controller');
32 assert_equals(e.ports.length, 0);
33 resolve();
34 });
35 worker.postMessage('PING');
36 });
37 })
38 .then(function() {
39 return service_worker_unregister_and_done(t, scope);
40 });
41 }, 'Test ServiceWorkerMessageEvent type.');
42
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698