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

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

Issue 291263002: ServiceWorker: Strip fragment from scope and script URLs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test case for query in scope Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/virtual/serviceworker/http/tests/serviceworker/serviceworkerobject-scope-expected.txt » ('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>ServiceWorker object: scope and url property</title> 2 <title>ServiceWorker object: scope and url 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, url, scope) { 8 function scope_test(name, url, scope) {
9 var t = async_test('Verify the scope and url property: ' + name); 9 var t = async_test('Verify the scope and url property: ' + name);
10 10
11 t.step(function() { 11 t.step(function() {
12 var expectedScope; 12 var expectedScope;
13 if (scope) 13 if (scope)
14 expectedScope = normalizeURL(scope); 14 expectedScope = normalizeURL(scope);
15 else 15 else
16 expectedScope = normalizeURL('*'); 16 expectedScope = normalizeURL('*');
17 var expectedURL = normalizeURL(url); 17 var expectedURL = normalizeURL(url);
18 18
19 expectedScope = expectedScope.replace(/#.*$/, '');
20 expectedURL = expectedURL.replace(/#.*$/, '');
kinuko 2014/05/21 03:37:15 It might be good to include this in normalizeURL h
jsbell 2014/05/22 16:49:05 Done.
21
19 service_worker_unregister_and_register(t, url, scope, onRegister); 22 service_worker_unregister_and_register(t, url, scope, onRegister);
20 23
21 function onRegister(worker) { 24 function onRegister(worker) {
22 assert_equals(worker.scope, expectedScope, 'Returned ServiceWorker o bject should have scope'); 25 assert_equals(worker.scope, expectedScope, 'Returned ServiceWorker o bject should have scope');
23 assert_equals(worker.url, expectedURL, 'Returned ServiceWorker objec t should have url'); 26 assert_equals(worker.url, expectedURL, 'Returned ServiceWorker objec t should have url');
24 service_worker_unregister_and_done(t, scope); 27 service_worker_unregister_and_done(t, scope);
25 } 28 }
26 }); 29 });
27 } 30 }
28 31
29 scope_test('default', 'resources/worker-no-op.js'); 32 scope_test('default', 'resources/worker-no-op.js');
30 scope_test('wildcard', 'resources/worker-no-op.js', '*'); 33 scope_test('wildcard', 'resources/worker-no-op.js', '*');
34 scope_test('script with fragment', 'resources/worker-no-op.js#ref', 'http://127. 0.0.1:8000/*');
35 scope_test('scope with fragment', 'resources/worker-no-op.js', 'http://127.0.0.1 :8000/*#ref');
36 scope_test('scope with query', 'resources/worker-no-op.js', '/a?b=c');
31 scope_test('relative path', 'resources/worker-no-op.js', '/a/b/c/'); 37 scope_test('relative path', 'resources/worker-no-op.js', '/a/b/c/');
32 scope_test('relative path with wildcard', 'resources/empty-worker.js', '/a/b/c/* '); 38 scope_test('relative path with wildcard', 'resources/empty-worker.js', '/a/b/c/* ');
33 scope_test('absolute url', 'resources/empty-worker.js', 'http://127.0.0.1:8000/' ); 39 scope_test('absolute url', 'resources/empty-worker.js', 'http://127.0.0.1:8000/' );
34 scope_test('absolute url with wildcard', 'resources/empty-worker.js', 'http://12 7.0.0.1:8000/*'); 40 scope_test('absolute url with wildcard', 'resources/empty-worker.js', 'http://12 7.0.0.1:8000/*');
35 41
36 </script> 42 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/virtual/serviceworker/http/tests/serviceworker/serviceworkerobject-scope-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698