OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>ServiceWorker object: scriptURL property</title> | 2 <title>ServiceWorker object: scriptURL 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 url_test(name, url) { | 8 function url_test(name, url) { |
9 var scope = 'scope/' + name; | 9 var scope = 'scope/' + name; |
10 async_test(function(t) { | 10 async_test(function(t) { |
11 var expectedURL = normalizeURL(url); | 11 var expectedURL = normalizeURL(url); |
12 service_worker_unregister_and_register(t, url, scope) | 12 service_worker_unregister_and_register(t, url, scope) |
13 .then(function(registration) { | 13 .then(function(registration) { |
14 return wait_for_update(t, registration); | 14 return wait_for_update(t, registration); |
15 }) | 15 }) |
16 .then(t.step_func(function(worker) { | 16 .then(t.step_func(function(worker) { |
17 assert_equals(worker.scriptURL, expectedURL, | 17 assert_equals(worker.scriptURL, expectedURL, |
18 'Returned ServiceWorker object should have scriptURL'); | 18 'Returned ServiceWorker object should have scriptURL'); |
19 service_worker_unregister_and_done(t, scope); | 19 service_worker_unregister_and_done(t, scope); |
20 })); | 20 })) |
21 t.done(); | 21 .catch(unreached_rejection(t)); |
22 }, 'Verify the scriptURL property: ' + name); | 22 }, 'Verify the scriptURL property: ' + name); |
23 } | 23 } |
24 | 24 |
25 url_test('relative', 'resources/empty-worker.js'); | 25 url_test('relative', 'resources/empty-worker.js'); |
26 url_test('with-fragment', 'resources/empty-worker.js#ref'); | 26 url_test('with-fragment', 'resources/empty-worker.js#ref'); |
27 url_test('absolute', | 27 url_test('absolute', |
28 'http://127.0.0.1:8000/serviceworker/resources/empty-worker.js'); | 28 'http://127.0.0.1:8000/serviceworker/resources/empty-worker.js'); |
29 | 29 |
30 </script> | 30 </script> |
OLD | NEW |