Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8854)

Unified Diff: chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.js

Issue 10808113: Only allows extensions to create HTML notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
]);

Powered by Google App Engine
This is Rietveld 408576698