| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Content settings API test | 5 // Content settings API test |
| 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettings | 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettings |
| 7 | 7 |
| 8 var cs = chrome.contentSettings; | 8 var cs = chrome.contentSettings; |
| 9 var default_content_settings = { | 9 var default_content_settings = { |
| 10 "cookies": "session_only", | 10 "cookies": "session_only", |
| 11 "images": "allow", | 11 "images": "allow", |
| 12 "javascript": "block", | 12 "javascript": "block", |
| 13 "plugins": "allow", | 13 "plugins": "allow", |
| 14 "popups": "block", | 14 "popups": "block", |
| 15 // TODO(bauerb) | 15 "location": "ask", |
| 16 // "geolocation": "ask", | |
| 17 "notifications": "ask" | 16 "notifications": "ask" |
| 18 }; | 17 }; |
| 19 | 18 |
| 20 var settings = { | 19 var settings = { |
| 21 "cookies": "block", | 20 "cookies": "block", |
| 22 "images": "allow", | 21 "images": "allow", |
| 23 "javascript": "block", | 22 "javascript": "block", |
| 24 "plugins": "block", | 23 "plugins": "block", |
| 25 "popups": "allow", | 24 "popups": "allow", |
| 26 // "geolocation": "block", | 25 "location": "block", |
| 27 "notifications": "block" | 26 "notifications": "block" |
| 28 }; | 27 }; |
| 29 | 28 |
| 30 Object.prototype.forEach = function(f) { | 29 Object.prototype.forEach = function(f) { |
| 31 var k; | 30 var k; |
| 32 for (k in this) { | 31 for (k in this) { |
| 33 if (this.hasOwnProperty(k)) | 32 if (this.hasOwnProperty(k)) |
| 34 f(k, this[k]); | 33 f(k, this[k]); |
| 35 } | 34 } |
| 36 }; | 35 }; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 'setting': 'block' | 85 'setting': 'block' |
| 87 }, chrome.test.callbackFail("Specific paths are not allowed.")); | 86 }, chrome.test.callbackFail("Specific paths are not allowed.")); |
| 88 cs.javascript.set({ | 87 cs.javascript.set({ |
| 89 'primaryPattern': 'http://example.com/*', | 88 'primaryPattern': 'http://example.com/*', |
| 90 'secondaryPattern': 'file:///home/hansmoleman/*', | 89 'secondaryPattern': 'file:///home/hansmoleman/*', |
| 91 'setting': 'allow' | 90 'setting': 'allow' |
| 92 }, chrome.test.callbackFail( | 91 }, chrome.test.callbackFail( |
| 93 "Path wildcards in file URL patterns are not allowed.")); | 92 "Path wildcards in file URL patterns are not allowed.")); |
| 94 } | 93 } |
| 95 ]); | 94 ]); |
| OLD | NEW |