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", |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 'primaryPattern': 'http://example.com/*', | 106 'primaryPattern': 'http://example.com/*', |
107 'secondaryPattern': 'http://example.com/path', | 107 'secondaryPattern': 'http://example.com/path', |
108 'setting': 'block' | 108 'setting': 'block' |
109 }, chrome.test.callbackFail("Specific paths are not allowed.")); | 109 }, chrome.test.callbackFail("Specific paths are not allowed.")); |
110 cs.javascript.set({ | 110 cs.javascript.set({ |
111 'primaryPattern': 'http://example.com/*', | 111 'primaryPattern': 'http://example.com/*', |
112 'secondaryPattern': 'file:///home/hansmoleman/*', | 112 'secondaryPattern': 'file:///home/hansmoleman/*', |
113 'setting': 'allow' | 113 'setting': 'allow' |
114 }, chrome.test.callbackFail( | 114 }, chrome.test.callbackFail( |
115 "Path wildcards in file URL patterns are not allowed.")); | 115 "Path wildcards in file URL patterns are not allowed.")); |
| 116 var caught = false; |
| 117 try { |
| 118 cs.javascript.set({primaryPattern: '<all_urls>', |
| 119 secondaryPattern: '<all_urls>', |
| 120 setting: 'something radically fake'}); |
| 121 } catch (e) { |
| 122 caught = true; |
| 123 } |
| 124 chrome.test.assertTrue(caught); |
116 } | 125 } |
117 ]); | 126 ]); |
OLD | NEW |