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

Side by Side Diff: chrome/test/data/extensions/api_test/notifications/has_permission_manifest/background.html

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
1 <script> 1 <!--
2 var notification = null; 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 var chromeExtensionsUrl = "chrome://extensions/"; 3 * source code is governed by a BSD-style license that can be found in the
4 4 * LICENSE file.
5 // Shows the notification window using the specified URL. 5 -->
6 // Control continues at onNotificationDone(). 6 <script src="background.js"></script>
7 function showNotification(url) {
8 notification = window.webkitNotifications.createHTMLNotification(url);
9 notification.onerror = function() {
10 chrome.test.fail("Failed to show notification.");
11 };
12 notification.show();
13 }
14
15 // Called by the notification when it is done with its tests.
16 function onNotificationDone() {
17 var views = chrome.extension.getViews();
18 chrome.test.assertEq(2, views.length);
19 notification.cancel();
20
21 // This last step tests that crbug.com/40967 stays fixed.
22 var listener = function(tabId, changeInfo, tab) {
23 if (changeInfo.status != 'complete')
24 return;
25 // web_page1 loaded, open extension page to inject script
26 if (tab.url == chromeExtensionsUrl) {
27 console.log(chromeExtensionsUrl + ' finished loading.');
28 chrome.tabs.onUpdated.removeListener(listener);
29 chrome.test.succeed();
30 }
31 };
32
33 chrome.tabs.onUpdated.addListener(listener);
34 chrome.tabs.create({ url: chromeExtensionsUrl });
35 }
36
37 chrome.test.runTests([
38 function hasPermission() {
39 chrome.test.assertEq(0, // allowed
40 webkitNotifications.checkPermission());
41 chrome.test.succeed();
42 },
43 function absoluteURL() {
44 showNotification(chrome.extension.getURL("notification.html"));
45 },
46 function relativeURL() {
47 showNotification('notification.html');
48 }
49 ]);
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698