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..b68f2158373f3f9da894f6f531887b761f1a8559 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 |
@@ -2,38 +2,29 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-var notification = null; |
- |
-// Shows the notification window using the specified URL. |
-// Control continues at onNotificationDone(). |
-function showNotification(url) { |
- notification = window.webkitNotifications.createHTMLNotification(url); |
- 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() { |
- chrome.test.succeed(); |
- } |
- notification.cancel(); |
-} |
- |
chrome.test.runTests([ |
function hasPermission() { |
chrome.test.assertEq(0, // allowed |
webkitNotifications.checkPermission()); |
chrome.test.succeed(); |
}, |
- function absoluteURL() { |
- showNotification(chrome.extension.getURL("notification.html")); |
+ 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 relativeURL() { |
- showNotification("notification.html"); |
+ function showTextNotification() { |
+ var notification = window.webkitNotifications.createNotification( |
+ "", "Foo", "This is text notification."); |
+ notification.onerror = function() { |
+ chrome.test.fail("Failed to show notification."); |
+ }; |
+ notification.ondisplay = function() { |
+ chrome.test.succeed(); |
+ }; |
+ notification.show(); |
} |
]); |