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

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

Issue 7253041: Use primary/secondary for URLs and patterns everywhere in the content settings extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 5 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
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 // Content settings API test 2 // Content settings API test
3 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettings 3 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettings
4 4
5 var cs = chrome.experimental.contentSettings; 5 var cs = chrome.experimental.contentSettings;
6 var default_content_settings = { 6 var default_content_settings = {
7 "cookies": "session_only", 7 "cookies": "session_only",
8 "images": "allow", 8 "images": "allow",
9 "javascript": "block", 9 "javascript": "block",
10 "plugins": "allow", 10 "plugins": "allow",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 chrome.test.callbackPass()); 58 chrome.test.callbackPass());
59 }, 59 },
60 function setReferrersEnabled() { 60 function setReferrersEnabled() {
61 cs.global.referrersEnabled.set( 61 cs.global.referrersEnabled.set(
62 {'value': true}, 62 {'value': true},
63 chrome.test.callbackPass()); 63 chrome.test.callbackPass());
64 }, 64 },
65 function setDefaultContentSettings() { 65 function setDefaultContentSettings() {
66 default_content_settings.forEach(function(type, setting) { 66 default_content_settings.forEach(function(type, setting) {
67 cs[type].set({ 67 cs[type].set({
68 'topLevelPattern': '<all_urls>', 68 'primaryPattern': '<all_urls>',
69 'embeddedPattern': '<all_urls>', 69 'secondaryPattern': '<all_urls>',
70 'setting': setting 70 'setting': setting
71 }, chrome.test.callbackPass()); 71 }, chrome.test.callbackPass());
72 }); 72 });
73 }, 73 },
74 function setContentSettings() { 74 function setContentSettings() {
75 settings.forEach(function(type, setting) { 75 settings.forEach(function(type, setting) {
76 cs[type].set({ 76 cs[type].set({
77 'topLevelPattern': 'http://*.google.com/*', 77 'primaryPattern': 'http://*.google.com/*',
78 'embeddedPattern': 'http://*.google.com/*', 78 'secondaryPattern': 'http://*.google.com/*',
79 'setting': setting 79 'setting': setting
80 }, chrome.test.callbackPass()); 80 }, chrome.test.callbackPass());
81 }); 81 });
82 }, 82 },
83 function getContentSettings() { 83 function getContentSettings() {
84 settings.forEach(function(type, setting) { 84 settings.forEach(function(type, setting) {
85 var message = "Setting for " + type + " should be " + setting; 85 var message = "Setting for " + type + " should be " + setting;
86 cs[type].get({ 86 cs[type].get({
87 'topLevelUrl': 'http://www.google.com', 87 'primaryUrl': 'http://www.google.com',
88 'embeddedUrl': 'http://www.google.com' 88 'secondaryUrl': 'http://www.google.com'
89 }, expect({'setting':setting}, message)); 89 }, expect({'setting':setting}, message));
90 }); 90 });
91 }, 91 },
92 function invalidSettings() { 92 function invalidSettings() {
93 cs.cookies.get({ 93 cs.cookies.get({
94 'topLevelUrl': '', 94 'primaryUrl': 'moo',
95 'embeddedUrl': 'moo'
96 }, chrome.test.callbackFail("The URL \"moo\" is invalid.")); 95 }, chrome.test.callbackFail("The URL \"moo\" is invalid."));
97 cs.plugins.set({ 96 cs.plugins.set({
98 'topLevelPattern': 'http://example.com/*', 97 'primaryPattern': 'http://example.com/*',
99 'embeddedPattern': 'http://example.com/path', 98 'secondaryPattern': 'http://example.com/path',
100 'setting': 'block' 99 'setting': 'block'
101 }, chrome.test.callbackFail("Specific paths are not allowed.")); 100 }, chrome.test.callbackFail("Specific paths are not allowed."));
102 cs.javascript.set({ 101 cs.javascript.set({
103 'topLevelPattern': 'http://example.com/*', 102 'primaryPattern': 'http://example.com/*',
104 'embeddedPattern': 'file:///home/hansmoleman/*', 103 'secondaryPattern': 'file:///home/hansmoleman/*',
105 'setting': 'allow' 104 'setting': 'allow'
106 }, chrome.test.callbackFail("Path wildcards in file URL patterns are not all owed.")); 105 }, chrome.test.callbackFail("Path wildcards in file URL patterns are not all owed."));
107 } 106 }
108 ]); 107 ]);
109 </script> 108 </script>
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698