Index: chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js |
diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js |
index 7efb8b172323cebd9c5498053ae9fefc76a6c170..d18ed8521db0c1081e732707f2c0505e0f27da97 100644 |
--- a/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js |
+++ b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js |
@@ -4,24 +4,25 @@ |
var notification = null; |
-// Shows the notification window using the specified URL. |
-// Control continues at onNotificationDone(). |
-function showNotification(url) { |
- notification = window.webkitNotifications.createHTMLNotification(url); |
+function showHTMLNotification() { |
+ // createHTMLNotification is not exposed even when the web page permission |
+ // is granted. |
+ if (window.webkitNotifications.createHTMLNotification) |
+ chrome.test.fail("createHTMLNotification is found."); |
+ else |
+ chrome.test.succeed(); |
+} |
+ |
+function showTextNotification() { |
+ notification = window.webkitNotifications.createNotification( |
+ "", "Foo", "This is text notification."); |
notification.onerror = function() { |
chrome.test.fail("Failed to show notification."); |
}; |
- notification.show(); |
-} |
- |
-// Called by the notification when it is done with its tests. |
-function onNotificationDone(notificationWindow) { |
- var views = chrome.extension.getViews(); |
- chrome.test.assertEq(2, views.length); |
- notificationWindow.onunload = function() { |
+ notification.ondisplay = function() { |
chrome.test.succeed(); |
- } |
- notification.cancel(); |
+ }; |
+ notification.show(); |
} |
chrome.test.runTests([ |
@@ -30,10 +31,10 @@ chrome.test.runTests([ |
webkitNotifications.checkPermission()); |
chrome.test.succeed(); |
}, |
- function absoluteURL() { |
- showNotification(chrome.extension.getURL("notification.html")); |
+ function htmlNotification() { |
+ showHTMLNotification(); |
Mihai Parparita -not on Chrome
2012/07/26 23:59:05
You might as well inline the test functions.
jianli
2012/07/27 00:34:10
Done.
|
}, |
- function relativeURL() { |
- showNotification("notification.html"); |
+ function textNotification() { |
+ showTextNotification(); |
} |
]); |