Chromium Code Reviews| Index: chrome/test/data/notifications/platform_notification_service.html | 
| diff --git a/chrome/test/data/notifications/platform_notification_service.html b/chrome/test/data/notifications/platform_notification_service.html | 
| index 3c6ea37e2ad2376eaa6bcf2984f773bde2b6147d..e257635f26c7c4db0cdb4b0d662cc7c061525ecd 100644 | 
| --- a/chrome/test/data/notifications/platform_notification_service.html | 
| +++ b/chrome/test/data/notifications/platform_notification_service.html | 
| @@ -58,6 +58,49 @@ | 
| }); | 
| } | 
| + // Helper function to request icon.png, returns a promise that will be | 
| 
 
johnme
2015/03/19 12:24:29
Nit: you could just use fetch
 
Peter Beverloo
2015/03/19 12:30:02
Done.
 
 | 
| + // resolved with the response's content when complete. | 
| + function RequestResource(url, type) { | 
| + return new Promise(function(resolve) { | 
| + var request = new XMLHttpRequest(); | 
| + request.open('GET', url, true); | 
| + request.responseType = type; | 
| + | 
| + request.onload = function() { | 
| + resolve(request.response); | 
| + }; | 
| + | 
| + request.send(); | 
| + }); | 
| + } | 
| + | 
| + // Displays a persistent notification with a data: URL as its image. | 
| + function DisplayPersistentNotificationDataUrlImage() { | 
| + RequestResource('icon.png', 'arraybuffer').then(function(arrayBuffer) { | 
| + var uint8Array = new Uint8Array(arrayBuffer), | 
| + string = new Array(uint8Array.length); | 
| + | 
| + for (var i = 0; i < uint8Array.length; ++i) | 
| + string[i] = String.fromCharCode(uint8Array[i]); | 
| 
 
johnme
2015/03/19 12:24:29
I'm a little freaked out by the need to convert ev
 
Peter Beverloo
2015/03/19 12:30:02
Done.
 
 | 
| + | 
| + var data = string.join(''); | 
| + DisplayPersistentNotification('Data URL Title', { | 
| + body: 'Contents', | 
| + icon: 'data:image/png;base64,' + btoa(data) | 
| + }) | 
| + }); | 
| + } | 
| + | 
| + // Displays a persistent notification with a blob URL as its image. | 
| + function DisplayPersistentNotificationBlobImage() { | 
| + RequestResource('icon.png', 'blob').then(function(blob) { | 
| + DisplayPersistentNotification('Blob Title', { | 
| + body: 'Contents', | 
| + icon: URL.createObjectURL(blob) | 
| + }); | 
| + }); | 
| + } | 
| + | 
| // Returns the latest received message from the worker. If no message has | 
| // been received, nothing will be done. For successfully registered | 
| // Service Workers this is OK, however, since the "message" event handler |