Chromium Code Reviews| Index: chrome/test/data/push_messaging/push_test.js |
| diff --git a/chrome/test/data/push_messaging/push_test.js b/chrome/test/data/push_messaging/push_test.js |
| index 3412439feace0bfc8db520021f1f768e831a0e57..b47b754a627aa22b677f23f367b7fcac7dad3511 100644 |
| --- a/chrome/test/data/push_messaging/push_test.js |
| +++ b/chrome/test/data/push_messaging/push_test.js |
| @@ -6,6 +6,7 @@ |
| var resultQueue = new ResultQueue(); |
| var pushSubscription = null; |
| +var lastPermissionRequestResult = ''; |
| var pushSubscriptionOptions = { |
| userVisibleOnly: true |
| @@ -64,10 +65,20 @@ ResultQueue.prototype.popImmediately = function() { |
| // this is granted, Push API subscription can succeed. |
| function requestNotificationPermission() { |
| Notification.requestPermission(function(permission) { |
| - sendResultToTest('permission status - ' + permission); |
| + lastPermissionRequestResult = permission; |
|
johnme
2015/06/02 14:12:38
What's the purpose of this change? Note that sendR
|
| }); |
| } |
| +// The result of requesting permission in requestNotificationPermission() will |
| +// be sent back. If the permission request has not yet completed, try again |
| +// after a timeout. |
| +function getLastPermissionRequestResult(timeout) { |
| + if (lastPermissionRequestResult === '') |
| + window.setTimeout(getLastPermissionRequestResult, timeout); |
| + else |
| + sendResultToTest('permission status - ' + lastPermissionRequestResult); |
| +} |
| + |
| function registerServiceWorker() { |
| // The base dir used to resolve service_worker.js and the scope depends on |
| // whether this script is included from an html file in ./, subscope1/, or |