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

Unified Diff: chrome/test/data/extensions/api_test/content_settings/standard/test.html

Issue 7029031: Content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync & review Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/content_settings/standard/test.html
diff --git a/chrome/test/data/extensions/api_test/content_settings/standard/test.html b/chrome/test/data/extensions/api_test/content_settings/standard/test.html
index d36a03a3a76aec1c498a5a6134ac0d248c42307f..3a4149e59a32c7ae8e33762412448a44aca43e12 100644
--- a/chrome/test/data/extensions/api_test/content_settings/standard/test.html
+++ b/chrome/test/data/extensions/api_test/content_settings/standard/test.html
@@ -3,6 +3,35 @@
// Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettings
var cs = chrome.experimental.contentSettings;
+var default_content_settings = {
+ "cookies": "session_only",
+ "images": "allow",
+ "javascript": "block",
+ "plugins": "allow",
+ "popups": "block",
+ // TODO(bauerb)
+ // "geolocation": "ask",
+ "notifications": "ask"
+};
+
+var settings = {
+ "cookies": "block",
+ "images": "allow",
+ "javascript": "block",
+ "plugins": "block",
+ "popups": "allow",
+ // "geolocation": "block",
+ "notifications": "block"
+};
+
+Object.prototype.forEach = function(f) {
+ for (key in this) {
+ if (this.hasOwnProperty(key))
+ f(key, this[key]);
+ }
+}
+
+
function expect(expected, message) {
return chrome.test.callbackPass(function(value) {
chrome.test.assertEq(expected, value, message);
@@ -32,6 +61,39 @@ chrome.test.runTests([
cs.global.referrersEnabled.set(
{'value': true},
chrome.test.callbackPass());
+ },
+ function setDefaultContentSettings() {
+ default_content_settings.forEach(function(type, setting) {
+ cs[type].set({
+ 'topLevelPattern': {'pattern': '*'},
+ 'embeddedPattern': {'pattern': '*'},
+ 'setting': setting
+ }, chrome.test.callbackPass());
+ });
+ },
+ function setContentSettings() {
+ settings.forEach(function(type, setting) {
+ cs[type].set({
+ 'topLevelPattern': {'pattern': '[*.]google.com'},
+ 'embeddedPattern': {'pattern': '[*.]google.com'},
+ 'setting': setting
+ }, chrome.test.callbackPass());
+ });
+ },
+ function getContentSettings() {
+ settings.forEach(function(type, setting) {
+ var message = "Setting for " + type + " should be " + setting;
+ cs[type].get({
+ 'topLevelUrl': 'http://www.google.com',
+ 'embeddedUrl': 'http://www.google.com'
+ }, expect({'setting':setting}, message));
+ });
+ },
+ function invalidSettings() {
+ cs.cookies.get({
+ 'topLevelUrl': '',
+ 'embeddedUrl': 'moo'
+ }, chrome.test.callbackFail("The URL \"moo\" is invalid."));
}
]);
</script>
« no previous file with comments | « chrome/renderer/resources/renderer_extension_bindings.js ('k') | chrome/test/data/extensions/api_test/stubs/content_script.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698