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

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

Issue 8763008: Move yet another block of tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var notification = null;
6
7 // Shows the notification window using the specified URL.
8 // Control continues at onNotificationDone().
9 function showNotification(url) {
10 notification = window.webkitNotifications.createHTMLNotification(url);
11 notification.onerror = function() {
12 chrome.test.fail("Failed to show notification.");
13 };
14 notification.show();
15 }
16
17 // Called by the notification when it is done with its tests.
18 function onNotificationDone(notificationWindow) {
19 var views = chrome.extension.getViews();
20 chrome.test.assertEq(2, views.length);
21 notificationWindow.onunload = function() {
22 chrome.test.succeed();
23 }
24 notification.cancel();
25 }
26
27 chrome.test.runTests([
28 function hasPermission() {
29 chrome.test.assertEq(0, // allowed
30 webkitNotifications.checkPermission());
31 chrome.test.succeed();
32 },
33 function absoluteURL() {
34 showNotification(chrome.extension.getURL("notification.html"));
35 },
36 function relativeURL() {
37 showNotification("notification.html");
38 }
39 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698