| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Suite of tests for site-list. */ | 5 /** @fileoverview Suite of tests for site-list. */ |
| 6 cr.define('site_list', function() { | 6 cr.define('site_list', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('SiteList', function() { | 8 suite('SiteList', function() { |
| 9 /** | 9 /** |
| 10 * A site list element created before each test. | 10 * A site list element created before each test. |
| 11 * @type {SiteList} | 11 * @type {SiteList} |
| 12 */ | 12 */ |
| 13 var testElement; | 13 var testElement; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * The mock proxy object to use during test. | 16 * The mock proxy object to use during test. |
| 17 * @type {TestSiteSettingsPrefsBrowserProxy} | 17 * @type {TestSiteSettingsPrefsBrowserProxy} |
| 18 */ | 18 */ |
| 19 var browserProxy = null; | 19 var browserProxy = null; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * An example pref with 2 blocked location items and 2 allowed. This pref | 22 * An example pref with 2 blocked location items and 2 allowed. This pref |
| 23 * is also used for the All Sites category and therefore needs values for | 23 * is also used for the All Sites category and therefore needs values for |
| 24 * all types, even though some might be blank. | 24 * all types, even though some might be blank. |
| 25 * @type {SiteSettingsPref} | 25 * @type {SiteSettingsPref} |
| 26 */ | 26 */ |
| 27 var prefs = { | 27 var prefs = { |
| 28 exceptions: { | 28 exceptions: { |
| 29 media_stream_camera: [], | 29 auto_downloads: [], |
| 30 background_sync: [], |
| 31 camera: [], |
| 30 cookies: [], | 32 cookies: [], |
| 31 fullscreen: [], | 33 fullscreen: [], |
| 32 geolocation: [ | 34 geolocation: [ |
| 33 { | 35 { |
| 34 embeddingOrigin: 'https://foo-allow.com:443', | 36 embeddingOrigin: 'https://foo-allow.com:443', |
| 35 origin: 'https://foo-allow.com:443', | 37 origin: 'https://foo-allow.com:443', |
| 36 setting: 'allow', | 38 setting: 'allow', |
| 37 source: 'preference', | 39 source: 'preference', |
| 38 }, | 40 }, |
| 39 { | 41 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 }, | 52 }, |
| 51 { | 53 { |
| 52 embeddingOrigin: 'https://bar-block.com:443', | 54 embeddingOrigin: 'https://bar-block.com:443', |
| 53 origin: 'https://bar-block.com:443', | 55 origin: 'https://bar-block.com:443', |
| 54 setting: 'block', | 56 setting: 'block', |
| 55 source: 'preference', | 57 source: 'preference', |
| 56 }, | 58 }, |
| 57 ], | 59 ], |
| 58 images: [], | 60 images: [], |
| 59 javascript: [], | 61 javascript: [], |
| 60 media_stream_mic: [], | 62 keygen: [], |
| 63 mic: [], |
| 61 notifications: [], | 64 notifications: [], |
| 65 plugins: [], |
| 62 popups: [], | 66 popups: [], |
| 67 unsandboxed_plugins: [], |
| 63 } | 68 } |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 /** | 71 /** |
| 67 * An example pref with mixed schemes (present and absent). | 72 * An example pref with mixed schemes (present and absent). |
| 68 * @type {SiteSettingsPref} | 73 * @type {SiteSettingsPref} |
| 69 */ | 74 */ |
| 70 var prefsMixedSchemes = { | 75 var prefsMixedSchemes = { |
| 71 exceptions: { | 76 exceptions: { |
| 72 geolocation: [ | 77 geolocation: [ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 ] | 90 ] |
| 86 } | 91 } |
| 87 }; | 92 }; |
| 88 | 93 |
| 89 /** | 94 /** |
| 90 * An example pref with mixed origin and pattern. | 95 * An example pref with mixed origin and pattern. |
| 91 * @type {SiteSettingsPref} | 96 * @type {SiteSettingsPref} |
| 92 */ | 97 */ |
| 93 var prefsMixedOriginAndPattern = { | 98 var prefsMixedOriginAndPattern = { |
| 94 exceptions: { | 99 exceptions: { |
| 95 media_stream_camera: [], | 100 auto_downloads: [], |
| 101 background_sync: [], |
| 102 camera: [], |
| 96 cookies: [], | 103 cookies: [], |
| 97 fullscreen: [], | 104 fullscreen: [], |
| 98 geolocation: [ | 105 geolocation: [ |
| 99 { | 106 { |
| 100 origin: 'https://foo.com', | 107 origin: 'https://foo.com', |
| 101 embeddingOrigin: '*', | 108 embeddingOrigin: '*', |
| 102 setting: 'allow', | 109 setting: 'allow', |
| 103 source: 'preference', | 110 source: 'preference', |
| 104 }, | 111 }, |
| 105 ], | 112 ], |
| 113 images: [], |
| 106 javascript: [ | 114 javascript: [ |
| 107 { | 115 { |
| 108 origin: 'https://[*.]foo.com', | 116 origin: 'https://[*.]foo.com', |
| 109 embeddingOrigin: '*', | 117 embeddingOrigin: '*', |
| 110 setting: 'allow', | 118 setting: 'allow', |
| 111 source: 'preference', | 119 source: 'preference', |
| 112 }, | 120 }, |
| 113 ], | 121 ], |
| 114 images: [], | 122 keygen: [], |
| 115 media_stream_mic: [], | 123 mic: [], |
| 116 notifications: [], | 124 notifications: [], |
| 125 plugins: [], |
| 117 popups: [], | 126 popups: [], |
| 127 unsandboxed_plugins: [], |
| 118 } | 128 } |
| 119 }; | 129 }; |
| 120 | 130 |
| 121 /** | 131 /** |
| 122 * An example pref with multiple categories and multiple allow/block | 132 * An example pref with multiple categories and multiple allow/block |
| 123 * state. | 133 * state. |
| 124 * @type {SiteSettingsPref} | 134 * @type {SiteSettingsPref} |
| 125 */ | 135 */ |
| 126 var prefsVarious = { | 136 var prefsVarious = { |
| 127 exceptions: { | 137 exceptions: { |
| 128 media_stream_camera: [], | 138 auto_downloads: [], |
| 139 background_sync: [], |
| 140 camera: [], |
| 129 cookies: [], | 141 cookies: [], |
| 130 fullscreen: [], | 142 fullscreen: [], |
| 131 geolocation: [ | 143 geolocation: [ |
| 132 { | 144 { |
| 133 embeddingOrigin: 'https://foo.com', | 145 embeddingOrigin: 'https://foo.com', |
| 134 origin: 'https://foo.com', | 146 origin: 'https://foo.com', |
| 135 setting: 'allow', | 147 setting: 'allow', |
| 136 source: 'preference', | 148 source: 'preference', |
| 137 }, | 149 }, |
| 138 { | 150 { |
| 139 embeddingOrigin: 'https://bar.com', | 151 embeddingOrigin: 'https://bar.com', |
| 140 origin: 'https://bar.com', | 152 origin: 'https://bar.com', |
| 141 setting: 'block', | 153 setting: 'block', |
| 142 source: 'preference', | 154 source: 'preference', |
| 143 }, | 155 }, |
| 144 ], | 156 ], |
| 145 images: [], | 157 images: [], |
| 146 javascript: [], | 158 javascript: [], |
| 147 media_stream_mic: [], | 159 keygen: [], |
| 160 mic: [], |
| 148 notifications: [ | 161 notifications: [ |
| 149 { | 162 { |
| 150 embeddingOrigin: 'https://google.com', | 163 embeddingOrigin: 'https://google.com', |
| 151 origin: 'https://google.com', | 164 origin: 'https://google.com', |
| 152 setting: 'block', | 165 setting: 'block', |
| 153 source: 'preference', | 166 source: 'preference', |
| 154 }, | 167 }, |
| 155 { | 168 { |
| 156 embeddingOrigin: 'https://bar.com', | 169 embeddingOrigin: 'https://bar.com', |
| 157 origin: 'https://bar.com', | 170 origin: 'https://bar.com', |
| 158 setting: 'block', | 171 setting: 'block', |
| 159 source: 'preference', | 172 source: 'preference', |
| 160 }, | 173 }, |
| 161 { | 174 { |
| 162 embeddingOrigin: 'https://foo.com', | 175 embeddingOrigin: 'https://foo.com', |
| 163 origin: 'https://foo.com', | 176 origin: 'https://foo.com', |
| 164 setting: 'block', | 177 setting: 'block', |
| 165 source: 'preference', | 178 source: 'preference', |
| 166 }, | 179 }, |
| 167 ], | 180 ], |
| 181 plugins: [], |
| 168 popups: [], | 182 popups: [], |
| 183 unsandboxed_plugins: [], |
| 169 } | 184 } |
| 170 }; | 185 }; |
| 171 | 186 |
| 172 /** | 187 /** |
| 173 * An example pref with 1 allowed location item. | 188 * An example pref with 1 allowed location item. |
| 174 * @type {SiteSettingsPref} | 189 * @type {SiteSettingsPref} |
| 175 */ | 190 */ |
| 176 var prefsOneEnabled = { | 191 var prefsOneEnabled = { |
| 177 exceptions: { | 192 exceptions: { |
| 178 geolocation: [ | 193 geolocation: [ |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 function(contentType) { | 595 function(contentType) { |
| 581 // No further checks needed. If this fails, it will hang the test. | 596 // No further checks needed. If this fails, it will hang the test. |
| 582 }); | 597 }); |
| 583 }); | 598 }); |
| 584 }); | 599 }); |
| 585 } | 600 } |
| 586 return { | 601 return { |
| 587 registerTests: registerTests, | 602 registerTests: registerTests, |
| 588 }; | 603 }; |
| 589 }); | 604 }); |
| OLD | NEW |