| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 DisplayPersistentNotification('Title', { | 51 DisplayPersistentNotification('Title', { |
| 52 dir: 'rtl', | 52 dir: 'rtl', |
| 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 silent: true | 57 silent: true |
| 58 }); | 58 }); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Displays a persistent notification with a data: URL as its image. |
| 62 function DisplayPersistentNotificationDataUrlImage() { |
| 63 fetch('icon.png').then(function(response) { |
| 64 return response.blob(); |
| 65 }).then(function(blob) { |
| 66 var reader = new FileReader(); |
| 67 reader.readAsDataURL(blob); |
| 68 reader.onloadend = function() { |
| 69 DisplayPersistentNotification('Data URL Title', { |
| 70 body: 'Contents', |
| 71 icon: reader.result |
| 72 }); |
| 73 }; |
| 74 }); |
| 75 } |
| 76 |
| 77 // Displays a persistent notification with a blob URL as its image. |
| 78 function DisplayPersistentNotificationBlobImage() { |
| 79 fetch('icon.png').then(function(response) { |
| 80 return response.blob(); |
| 81 }).then(function(blob) { |
| 82 DisplayPersistentNotification('Blob Title', { |
| 83 body: 'Contents', |
| 84 icon: URL.createObjectURL(blob) |
| 85 }); |
| 86 }); |
| 87 } |
| 88 |
| 61 // Returns the latest received message from the worker. If no message has | 89 // Returns the latest received message from the worker. If no message has |
| 62 // been received, nothing will be done. For successfully registered | 90 // been received, nothing will be done. For successfully registered |
| 63 // Service Workers this is OK, however, since the "message" event handler | 91 // Service Workers this is OK, however, since the "message" event handler |
| 64 // in DisplayPersistentNotification will take care of notifying the DOM | 92 // in DisplayPersistentNotification will take care of notifying the DOM |
| 65 // Automation Controller instead. | 93 // Automation Controller instead. |
| 66 function GetMessageFromWorker() { | 94 function GetMessageFromWorker() { |
| 67 if (!messageStack.length) { | 95 if (!messageStack.length) { |
| 68 expectingMessage = true; | 96 expectingMessage = true; |
| 69 return; | 97 return; |
| 70 } | 98 } |
| 71 | 99 |
| 72 domAutomationController.send('' + messageStack.pop()); | 100 domAutomationController.send('' + messageStack.pop()); |
| 73 } | 101 } |
| 74 </script> | 102 </script> |
| 75 </body> | 103 </body> |
| 76 </html> | 104 </html> |
| OLD | NEW |