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

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

Issue 7064038: ExtensionApiTest.Notifications: wait until part 1 finishes cleanup before going to part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <script> 1 <script>
2 var notification = null; 2 var notification = null;
3 3
4 // Shows the notification window using the specified URL. 4 // Shows the notification window using the specified URL.
5 // Control continues at onNotificationDone(). 5 // Control continues at onNotificationDone().
6 function showNotification(url) { 6 function showNotification(url) {
7 notification = window.webkitNotifications.createHTMLNotification(url); 7 notification = window.webkitNotifications.createHTMLNotification(url);
8 notification.onerror = function() { 8 notification.onerror = function() {
9 chrome.test.fail("Failed to show notification."); 9 chrome.test.fail("Failed to show notification.");
10 }; 10 };
11 notification.show(); 11 notification.show();
12 } 12 }
13 13
14 // Called by the notification when it is done with its tests. 14 // Called by the notification when it is done with its tests.
15 function onNotificationDone() { 15 function onNotificationDone(notificationWindow) {
16 var views = chrome.extension.getViews(); 16 var views = chrome.extension.getViews();
17 chrome.test.assertEq(2, views.length); 17 chrome.test.assertEq(2, views.length);
18 notificationWindow.onunload = function() {
19 chrome.test.succeed();
20 }
18 notification.cancel(); 21 notification.cancel();
19 chrome.test.succeed();
20 } 22 }
21 23
22 chrome.test.runTests([ 24 chrome.test.runTests([
23 function hasPermission() { 25 function hasPermission() {
24 chrome.test.assertEq(0, // allowed 26 chrome.test.assertEq(0, // allowed
25 webkitNotifications.checkPermission()); 27 webkitNotifications.checkPermission());
26 chrome.test.succeed(); 28 chrome.test.succeed();
27 }, 29 },
28 function absoluteURL() { 30 function absoluteURL() {
29 showNotification(chrome.extension.getURL("notification.html")); 31 showNotification(chrome.extension.getURL("notification.html"));
30 }, 32 },
31 function relativeURL() { 33 function relativeURL() {
32 showNotification("notification.html"); 34 showNotification("notification.html");
33 } 35 }
34 ]); 36 ]);
35 </script> 37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698