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

Side by Side Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-vibrate-throw.html

Issue 1042513002: Add the vibrate attribute to the Notification object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 <title>Notifications: ServiceWorkerRegistration.showNotification().</title> 4 <title>Notifications: Verifying the exception throwing behavior, when silent set true and vibrate is presented in showNotification().</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script> 7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <script> 10 <script>
11 // Tests that the showNotification() function rejects the returned promise with a 11 // Tests that the showNotification() function rejects the returned promise with a
12 // TypeError when no permission has been granted for Web Notifications. 12 // TypeError when silent set true and vibrate is presented.
13 async_test(function(test) { 13 async_test(function(test) {
14 var scope = 'resources/scope/service-worker-show-notification-no-permi ssion', 14 var scope = 'resources/scope/' + location.pathname,
15 workerUrl = 'resources/empty-worker.js'; 15 workerUrl = 'resources/empty-worker.js';
16 16
17 if (window.testRunner) 17 testRunner.grantWebNotificationPermission(location.origin, true);
18 testRunner.grantWebNotificationPermission(location.origin, false);
19 18
20 var registration = null; 19 var registration = null;
21 service_worker_unregister_and_register(test, workerUrl, scope).then(fu nction(swRegistration) { 20 service_worker_unregister_and_register(test, workerUrl, scope).then(fu nction(swRegistration) {
22 registration = swRegistration; 21 registration = swRegistration;
23 return wait_for_state(test, registration.installing, 'activated'); 22 return wait_for_state(test, registration.installing, 'activated');
24 }).then(function() { 23 }).then(function() {
25 assert_inherits(registration, 'showNotification', 'showNotificatio n() must be exposed.');
26 registration.showNotification('Title', { 24 registration.showNotification('Title', {
27 body: 'Hello, world!', 25 body: 'Hello, world!',
28 icon: '/icon.png' 26 vibrate: [100, 200, 300],
27 silent: true
29 }).then(function() { 28 }).then(function() {
30 assert_unreached('showNotification() is expected to reject.'); 29 assert_unreached('showNotification() is expected to reject.');
31 }).catch(function(error) { 30 }).catch(function(error) {
32 assert_equals(error.name, 'TypeError'); 31 assert_equals(error.name, 'TypeError');
33 assert_equals(error.message, 'No notification permission has b een granted for this origin.'); 32 assert_equals(error.message, 'Silent notifications must not sp ecify vibration patterns.');
34 test.done(); 33 test.done();
35 }); 34 });
36 35
37 }).catch(unreached_rejection(test)); 36 }).catch(unreached_rejection(test));
38 37
39 }, 'showNotification() must reject if no Web Notification permission has b een granted.'); 38 }, 'showNotification() must reject If options\'s silent is true, and optio ns\'s vibrate is presenteded.');
40 </script> 39 </script>
41 </body> 40 </body>
42 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698