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

Side by Side Diff: chrome/test/data/extensions/api_test/notifications/has_permission_manifest/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 var chromeExtensionsUrl = "chrome://extensions/";
7
8 // Shows the notification window using the specified URL.
9 // Control continues at onNotificationDone().
10 function showNotification(url) {
11 notification = window.webkitNotifications.createHTMLNotification(url);
12 notification.onerror = function() {
13 chrome.test.fail("Failed to show notification.");
14 };
15 notification.show();
16 }
17
18 // Called by the notification when it is done with its tests.
19 function onNotificationDone() {
20 var views = chrome.extension.getViews();
21 chrome.test.assertEq(2, views.length);
22 notification.cancel();
23
24 // This last step tests that crbug.com/40967 stays fixed.
25 var listener = function(tabId, changeInfo, tab) {
26 if (changeInfo.status != 'complete')
27 return;
28 // web_page1 loaded, open extension page to inject script
29 if (tab.url == chromeExtensionsUrl) {
30 console.log(chromeExtensionsUrl + ' finished loading.');
31 chrome.tabs.onUpdated.removeListener(listener);
32 chrome.test.succeed();
33 }
34 };
35
36 chrome.tabs.onUpdated.addListener(listener);
37 chrome.tabs.create({ url: chromeExtensionsUrl });
38 }
39
40 chrome.test.runTests([
41 function hasPermission() {
42 chrome.test.assertEq(0, // allowed
43 webkitNotifications.checkPermission());
44 chrome.test.succeed();
45 },
46 function absoluteURL() {
47 showNotification(chrome.extension.getURL("notification.html"));
48 },
49 function relativeURL() {
50 showNotification('notification.html');
51 }
52 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698