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

Side by Side Diff: LayoutTests/push_messaging/push-messaging.html

Issue 676003002: Add layout tests for hasPermission (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@push_has_permission
Patch Set: Created 6 years, 2 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
OLDNEW
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)
(...skipping 13 matching lines...) Expand all
24 }); 24 });
25 } 25 }
26 testPushRegistrationError(); 26 testPushRegistrationError();
27 27
28 function testPushRegistrationSuccess() { 28 function testPushRegistrationSuccess() {
29 window.testRunner.setMockPushClientSuccess('endpoint', 'registrationId'); 29 window.testRunner.setMockPushClientSuccess('endpoint', 'registrationId');
30 navigator.push.register('senderId').then(function(reg) { 30 navigator.push.register('senderId').then(function(reg) {
31 registration = reg; 31 registration = reg;
32 shouldBeEqualToString('registration.pushEndpoint', 'endpoint'); 32 shouldBeEqualToString('registration.pushEndpoint', 'endpoint');
33 shouldBeEqualToString('registration.pushRegistrationId', 'registrationId '); 33 shouldBeEqualToString('registration.pushRegistrationId', 'registrationId ');
34 finishJSTest(); 34 » testPushHasPermission('granted');
Michael van Ouwerkerk 2014/10/24 12:53:01 Is this a tab for whitespace? Oh dear.
Miguel Garcia 2014/10/31 17:04:47 Done. Sorry about that, I configured eclipse prope
Miguel Garcia 2014/10/31 17:04:47 Done.
35 }, function(e) { 35 }, function(e) {
36 testFailed('Error callback invoked unexpectedly.'); 36 testFailed('Error callback invoked unexpectedly.');
37 finishJSTest(); 37 finishJSTest();
38 }); 38 });
39 } 39 }
40
41 function testPushHasPermission(expectedStatus) {
Michael van Ouwerkerk 2014/10/24 12:53:01 Please separate the tests more cleanly by making t
Miguel Garcia 2014/10/31 17:04:47 Done.
42 navigator.push.hasPermission().then(function(permissionStatus) {
43 status = permissionStatus;
44 shouldBeEqualToString("status", expectedStatus);
Michael van Ouwerkerk 2014/10/24 12:53:01 nit: single quotes for js strings
Peter Beverloo 2014/10/24 13:03:24 shouldBeEqualToString takes two literal strings wh
Miguel Garcia 2014/10/31 17:04:47 Not that it matters now but expectedStatus is alre
45 finishJSTest();
46 }, function() {
47 testFailed('Error callback invoked unexpectedly.');
48 finishJSTest();
49 });
50 }
51
40 </script> 52 </script>
41 </body> 53 </body>
42 </html> 54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698