| 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>
|
|
|