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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/windowclient-focus.html

Issue 1130113006: ServiceWorker: Introduce ServiceWorkerMessageEvent to replace MessageEvent (3/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make more tests pass Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: WindowClient.focus() tests (using testRunner)</title> 2 <title>Service Worker: WindowClient.focus() tests (using testRunner)</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/test-helpers.js"></script> 5 <script src="../resources/test-helpers.js"></script>
6 <script> 6 <script>
7 // This test is using testRunner to grant itself the notification permission and 7 // This test is using testRunner to grant itself the notification permission and
8 // to simulate a click on a notification. A couple of changes would allow it to 8 // to simulate a click on a notification. A couple of changes would allow it to
9 // be run as a manual test by other browser vendors. 9 // be run as a manual test by other browser vendors.
10 if (window.testRunner) 10 if (window.testRunner)
11 testRunner.setPermission('notifications', 'granted', location.origin, locati on.origin); 11 testRunner.setPermission('notifications', 'granted', location.origin, locati on.origin);
12 12
13 var t = async_test('WindowClient.focus() behaved as expected'); 13 var t = async_test('WindowClient.focus() behaved as expected');
14 t.step(function() { 14 t.step(function() {
15 var scope = 'resources/windowclient-focus.html' 15 var scope = 'resources/windowclient-focus.html'
16 service_worker_unregister_and_register( 16 service_worker_unregister_and_register(
17 t, 'resources/windowclient-focus.js', scope) 17 t, 'resources/windowclient-focus.js', scope)
18 .then(function(registration) { 18 .then(function(registration) {
19 return wait_for_state(t, registration.installing, 'activated'); 19 return wait_for_state(t, registration.installing, 'activated');
20 }) 20 })
21 .then(function() { return with_iframe(scope); }) 21 .then(function() { return with_iframe(scope); })
22 .then(function(frame) { 22 .then(function(frame) {
23 var w = frame.contentWindow; 23 var w = frame.contentWindow;
24 w.onmessage = t.step_func(onMessage); 24 w.navigator.serviceWorker.onmessage = t.step_func(onMessage);
25 w.navigator.serviceWorker.controller.postMessage('start'); 25 w.navigator.serviceWorker.controller.postMessage('start');
26 }) 26 })
27 .catch(unreached_rejection(t)); 27 .catch(unreached_rejection(t));
28 28
29 var result = []; 29 var result = [];
30 var expected = [ 30 var expected = [
31 'focus() can\'t focus a window without a user interaction', 31 'focus() can\'t focus a window without a user interaction',
32 'focus() error is InvalidAccessError', 32 'focus() error is InvalidAccessError',
33 'focus() succeeded', 33 'focus() succeeded',
34 'focus() result: [object WindowClient]', 34 'focus() result: [object WindowClient]',
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (message === 'quit') { 81 if (message === 'quit') {
82 assert_array_equals(result, expected, 82 assert_array_equals(result, expected,
83 'Worker should post back expected messages.'); 83 'Worker should post back expected messages.');
84 service_worker_unregister_and_done(t, scope); 84 service_worker_unregister_and_done(t, scope);
85 } else { 85 } else {
86 result.push(message); 86 result.push(message);
87 } 87 }
88 } 88 }
89 }); 89 });
90 </script> 90 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698