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

Side by Side Diff: LayoutTests/http/tests/serviceworker/serviceworkerglobalscope-scope.html

Issue 340763002: Fix serviceworker default registration scope. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change the test cases Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/serviceworkerobject-scope.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>ServiceWorkerGlobalScope: scope property</title> 2 <title>ServiceWorkerGlobalScope: scope property</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 7
8 function scope_test(name, scope) { 8 function scope_test(name, scope) {
9 var t = async_test('Verify the scope property: ' + name); 9 var t = async_test('Verify the scope property: ' + name);
10 10
11 t.step(function() { 11 t.step(function() {
12 var expectedScope, options; 12 var expectedScope, options;
13 if (scope) { 13 if (scope) {
14 expectedScope = new URL(scope, document.location).toString(); 14 expectedScope = new URL(scope, document.location).toString();
15 } else { 15 } else {
16 expectedScope = new URL('*', document.location).toString(); 16 expectedScope = new URL('/*', document.location).toString();
17 } 17 }
18 18
19 service_worker_unregister_and_register( 19 service_worker_unregister_and_register(
20 t, 'resources/serviceworkerglobalscope-scope-worker.js', scope, 20 t, 'resources/serviceworkerglobalscope-scope-worker.js', scope,
21 function(worker) { 21 function(worker) {
22 var messageChannel = new MessageChannel(); 22 var messageChannel = new MessageChannel();
23 messageChannel.port1.onmessage = t.step_func(function(e) { 23 messageChannel.port1.onmessage = t.step_func(function(e) {
24 message = e.data; 24 message = e.data;
25 assert_equals(message.initialScope, expectedScope, 'Worker s hould see the scope on eval.'); 25 assert_equals(message.initialScope, expectedScope, 'Worker s hould see the scope on eval.');
26 assert_equals(message.currentScope, expectedScope, 'Worker s cope should not change.'); 26 assert_equals(message.currentScope, expectedScope, 'Worker s cope should not change.');
27 service_worker_unregister_and_done(t, scope); 27 service_worker_unregister_and_done(t, scope);
28 }); 28 });
29 worker.postMessage('', [messageChannel.port2]); 29 worker.postMessage('', [messageChannel.port2]);
30 }); 30 });
31 }); 31 });
32 } 32 }
33 33
34 scope_test('default'); 34 scope_test('default');
35 scope_test('wildcard', '*'); 35 scope_test('wildcard', '*');
36 scope_test('relative path', '/a/b/c/'); 36 scope_test('relative path', '/a/b/c/');
37 scope_test('relative path with wildcard', '/a/b/c/*'); 37 scope_test('relative path with wildcard', '/a/b/c/*');
38 scope_test('absolute url', 'http://127.0.0.1:8000/'); 38 scope_test('absolute url', 'http://127.0.0.1:8000/');
39 scope_test('absolute url with wildcard', 'http://127.0.0.1:8000/*'); 39 scope_test('absolute url with wildcard', 'http://127.0.0.1:8000/*');
40 40
41 </script> 41 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/serviceworkerobject-scope.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698