diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 20:31:22 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 20:31:22 +0000 |
commit | 61f39e60267e65361f30b1d6d47d0937bad16688 (patch) | |
tree | af08a9c0de75f393a50191551c636ed235c692d0 /chrome/test | |
parent | c4f17130b5d1f1a5f12a61abaf91fd3d26a61d73 (diff) | |
download | chromium_src-61f39e60267e65361f30b1d6d47d0937bad16688.zip chromium_src-61f39e60267e65361f30b1d6d47d0937bad16688.tar.gz chromium_src-61f39e60267e65361f30b1d6d47d0937bad16688.tar.bz2 |
Add a browser test to ensure that notifications that are requested via requestPermission work in extensions.
BUG=40495
Review URL: http://codereview.chromium.org/1568028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_manifest/background.html (renamed from chrome/test/data/extensions/api_test/notifications/has_permission/background.html) | 0 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_manifest/manifest.json (renamed from chrome/test/data/extensions/api_test/notifications/has_permission/manifest.json) | 0 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_manifest/notification.html (renamed from chrome/test/data/extensions/api_test/notifications/has_permission/notification.html) | 0 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.html | 37 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_prefs/manifest.json | 7 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/notifications/has_permission_prefs/notification.html | 12 |
6 files changed, 56 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission/background.html b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/background.html index 4b43004..4b43004 100644 --- a/chrome/test/data/extensions/api_test/notifications/has_permission/background.html +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/background.html diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission/manifest.json b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/manifest.json index a2fa64f..a2fa64f 100644 --- a/chrome/test/data/extensions/api_test/notifications/has_permission/manifest.json +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/manifest.json diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission/notification.html b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/notification.html index 8a78703..8a78703 100644 --- a/chrome/test/data/extensions/api_test/notifications/has_permission/notification.html +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_manifest/notification.html diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.html b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.html new file mode 100644 index 0000000..4b43004 --- /dev/null +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/background.html @@ -0,0 +1,37 @@ +<script> +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() { + var views = chrome.extension.getViews(); + chrome.test.assertEq(2, views.length); + notification.cancel(); + chrome.test.succeed(); +} + +chrome.test.runTests([ + function hasPermission() { + chrome.test.assertEq(0, // allowed + webkitNotifications.checkPermission()); + chrome.test.succeed(); + }, + function absoluteURL() { + showNotification(chrome.extension.getURL("notification.html")); + }, + function relativeURL() { + // TODO(aa): Relative URLs don't work for some reason. + // BUG: http://crbug.com/39216 + chrome.test.succeed(); + } +]); +</script> diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/manifest.json b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/manifest.json new file mode 100644 index 0000000..a38727d --- /dev/null +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "notifications test", + "version": "1", + "permissions": [ "tabs" ], + "background_page": "background.html", + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHKlH3JTbOwICsw3EkXFfW+nWFTwuD2dZi1U+rQ143AUxYg2ZwG7+61RulNH//cYdo9YD5KAlbl+BMDsiKYexXVhddmaVJ1mlvW+oMoRR7MKuVeXNdLyAarsWrlnvWFjvhQ1AMSIlhKAEqilVblvmHg8PZ5tTE5PkV0V6vWs37DQIDAQAB" +} diff --git a/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/notification.html b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/notification.html new file mode 100644 index 0000000..8a78703 --- /dev/null +++ b/chrome/test/data/extensions/api_test/notifications/has_permission_prefs/notification.html @@ -0,0 +1,12 @@ +<html> +<script> +// Test that we can call the tabs API. We don't care what the result is; tabs +// are tested elsewhere. We just care that we can call it without a +// permissions error. +chrome.windows.getAll(null, function() { + chrome.test.assertNoLastError(); + chrome.extension.getBackgroundPage().onNotificationDone(); +}); +</script> +Why hello there. +</html> |