OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Registration</title> | 2 <title>Service Worker: Registration</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> | 5 <script> |
6 (function() { | 6 (function() { |
7 var t = async_test('Registering normal pattern'); | 7 var t = async_test('Registering normal pattern'); |
8 t.step(function() { | 8 t.step(function() { |
9 navigator.serviceWorker.register( | 9 navigator.serviceWorker.register( |
10 'resources/registration-worker.js', | 10 'resources/registration-worker.js', |
11 {scope: '/*'} | 11 {scope: '/*'} |
12 ).then( | 12 ).then( |
13 t.step_func(function(worker) { | 13 t.step_func(function(worker) { |
14 assert_true(!!worker, 'Successfully registered.'); | 14 assert_true(worker instanceof ServiceWorker, |
| 15 'Successfully registered.'); |
15 t.done(); | 16 t.done(); |
16 }), | 17 }), |
17 t.step_func(function(reason) { | 18 t.step_func(function(reason) { |
18 assert_unreached('Registration should succeed, but failed: ' + r
eason.name); | 19 assert_unreached('Registration should succeed, but failed: ' + r
eason.name); |
19 }) | 20 }) |
20 ); | 21 ); |
21 }); | 22 }); |
22 }()); | 23 }()); |
23 | 24 |
24 (function() { | 25 (function() { |
(...skipping 27 matching lines...) Expand all Loading... |
52 t.step_func(function(reason) { | 53 t.step_func(function(reason) { |
53 assert_equals(reason.name, 'SecurityError', | 54 assert_equals(reason.name, 'SecurityError', |
54 'Registration script outside domain should fail wit
h SecurityError.'); | 55 'Registration script outside domain should fail wit
h SecurityError.'); |
55 t.done(); | 56 t.done(); |
56 }) | 57 }) |
57 ); | 58 ); |
58 }); | 59 }); |
59 }()); | 60 }()); |
60 | 61 |
61 </script> | 62 </script> |
OLD | NEW |