| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html lang="en"> | 2 <html lang="en"> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <title>Platform Notification Service BrowserTest service page</title> | 5 <title>Platform Notification Service BrowserTest service page</title> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <!-- This page is intended to be used by the cross-platform | 8 <!-- This page is intended to be used by the cross-platform |
| 9 PlatformNotificationServiceBrowserTest. --> | 9 PlatformNotificationServiceBrowserTest. --> |
| 10 <script src="notification_test_utils.js"></script> | 10 <script src="notification_test_utils.js"></script> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 lang: 'nl-NL', | 53 lang: 'nl-NL', |
| 54 body: 'Contents', | 54 body: 'Contents', |
| 55 tag: 'replace-id', | 55 tag: 'replace-id', |
| 56 icon: 'icon.png', | 56 icon: 'icon.png', |
| 57 timestamp: 621046800000, | 57 timestamp: 621046800000, |
| 58 renotify: true, | 58 renotify: true, |
| 59 silent: true, | 59 silent: true, |
| 60 requireInteraction: true, | 60 requireInteraction: true, |
| 61 data: [ | 61 data: [ |
| 62 { property: 'value' } | 62 { property: 'value' } |
| 63 ], |
| 64 actions: [ |
| 65 { action: 'actionId', title: 'actionTitle', icon: 'icon.png' } |
| 63 ] | 66 ] |
| 64 }); | 67 }); |
| 65 } | 68 } |
| 66 | 69 |
| 67 // Displays a persistent notification with vibrate field. | 70 // Displays a persistent notification with vibrate field. |
| 68 function DisplayPersistentNotificationVibrate() { | 71 function DisplayPersistentNotificationVibrate() { |
| 69 DisplayPersistentNotification('Title', { | 72 DisplayPersistentNotification('Title', { |
| 70 body: 'Contents', | 73 body: 'Contents', |
| 71 vibrate: [100, 200, 300] | 74 vibrate: [100, 200, 300] |
| 72 }); | 75 }); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 93 fetch('icon.png').then(function(response) { | 96 fetch('icon.png').then(function(response) { |
| 94 return response.blob(); | 97 return response.blob(); |
| 95 }).then(function(blob) { | 98 }).then(function(blob) { |
| 96 DisplayPersistentNotification('Blob Title', { | 99 DisplayPersistentNotification('Blob Title', { |
| 97 body: 'Contents', | 100 body: 'Contents', |
| 98 icon: URL.createObjectURL(blob) | 101 icon: URL.createObjectURL(blob) |
| 99 }); | 102 }); |
| 100 }); | 103 }); |
| 101 } | 104 } |
| 102 | 105 |
| 106 // Displays a persistent notification with action buttons. |
| 107 function DisplayPersistentNotificationWithActionButtons() { |
| 108 DisplayPersistentNotification('action_button_click', { |
| 109 body: 'Contents', |
| 110 actions: [ |
| 111 { action: 'actionId1', title: 'actionTitle1', icon: 'icon.png' }, |
| 112 { action: 'actionId2', title: 'actionTitle2', icon: 'icon.png' } |
| 113 ] |
| 114 }); |
| 115 } |
| 116 |
| 103 // Returns the latest received message from the worker. If no message has | 117 // Returns the latest received message from the worker. If no message has |
| 104 // been received, nothing will be done. For successfully registered | 118 // been received, nothing will be done. For successfully registered |
| 105 // Service Workers this is OK, however, since the "message" event handler | 119 // Service Workers this is OK, however, since the "message" event handler |
| 106 // in DisplayPersistentNotification will take care of notifying the DOM | 120 // in DisplayPersistentNotification will take care of notifying the DOM |
| 107 // Automation Controller instead. | 121 // Automation Controller instead. |
| 108 function GetMessageFromWorker() { | 122 function GetMessageFromWorker() { |
| 109 if (!messageStack.length) { | 123 if (!messageStack.length) { |
| 110 expectingMessage = true; | 124 expectingMessage = true; |
| 111 return; | 125 return; |
| 112 } | 126 } |
| 113 | 127 |
| 114 domAutomationController.send('' + messageStack.pop()); | 128 domAutomationController.send('' + messageStack.pop()); |
| 115 } | 129 } |
| 116 </script> | 130 </script> |
| 117 </body> | 131 </body> |
| 118 </html> | 132 </html> |
| OLD | NEW |