OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description('Tests for the Push API.'); | 8 description('Tests for the Push API.'); |
9 | 9 |
10 if (!window.testRunner) | 10 if (!window.testRunner) |
11 debug('This test can not run without testRunner'); | 11 debug('This test can not run without testRunner'); |
12 | 12 |
13 window.jsTestIsAsync = true; | 13 window.jsTestIsAsync = true; |
14 | 14 |
15 shouldBeTrue('!!navigator.push'); | 15 shouldBeTrue('!!navigator.push'); |
16 shouldBeTrue('!!navigator.push.register'); | 16 shouldBeTrue('!!navigator.push.register'); |
17 shouldBeEqualToString('String(navigator.push.register("senderId"))', '[object Pr
omise]'); | 17 shouldBe('navigator.push.register("senderId").constructor', 'Promise'); |
18 | 18 |
19 // Currently we have an empty implementation that always fails. | 19 // Currently we have an empty implementation that always fails. |
20 navigator.push.register('senderId').then(function successCallback() { | 20 navigator.push.register('senderId').then(function successCallback() { |
21 testFailed('Success callback invoked unexpectedly.'); | 21 testFailed('Success callback invoked unexpectedly.'); |
22 finishJSTest(); | 22 finishJSTest(); |
23 }, function errorCallback(e) { | 23 }, function errorCallback(e) { |
24 error = e; | 24 error = e; |
25 shouldBeEqualToString('error.name', 'AbortError'); | 25 shouldBeEqualToString('error.name', 'AbortError'); |
26 finishJSTest(); | 26 finishJSTest(); |
27 }); | 27 }); |
28 | 28 |
29 </script> | 29 </script> |
30 </body> | 30 </body> |
31 </html> | 31 </html> |
OLD | NEW |