Chromium Code Reviews| 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-details. */ | 5 /** @fileoverview Suite of tests for site-details. */ |
| 6 suite('SiteDetails', function() { | 6 suite('SiteDetails', function() { |
| 7 /** | 7 /** |
| 8 * A site list element created before each test. | 8 * A site list element created before each test. |
| 9 * @type {SiteDetails} | 9 * @type {SiteDetails} |
| 10 */ | 10 */ |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 origin: 'https://foo-allow.com:443', | 29 origin: 'https://foo-allow.com:443', |
| 30 setting: 'allow', | 30 setting: 'allow', |
| 31 source: 'preference', | 31 source: 'preference', |
| 32 }, | 32 }, |
| 33 ], | 33 ], |
| 34 camera: [ | 34 camera: [ |
| 35 { | 35 { |
| 36 embeddingOrigin: 'https://foo-allow.com:443', | 36 embeddingOrigin: 'https://foo-allow.com:443', |
| 37 origin: 'https://foo-allow.com:443', | 37 origin: 'https://foo-allow.com:443', |
| 38 setting: 'allow', | 38 setting: 'allow', |
| 39 source: 'preference', | 39 source: 'extension', |
| 40 }, | 40 }, |
| 41 ], | 41 ], |
| 42 cookies: [ | 42 cookies: [ |
| 43 { | 43 { |
| 44 embeddingOrigin: 'https://foo-allow.com:443', | 44 embeddingOrigin: 'https://foo-allow.com:443', |
| 45 origin: 'https://foo-allow.com:443', | 45 origin: 'https://foo-allow.com:443', |
| 46 setting: 'allow', | 46 setting: 'allow', |
| 47 source: 'preference', | 47 source: 'preference', |
| 48 }, | 48 }, |
| 49 ], | 49 ], |
| 50 geolocation: [ | 50 geolocation: [ |
| 51 { | 51 { |
| 52 embeddingOrigin: 'https://foo-allow.com:443', | 52 embeddingOrigin: 'https://foo-allow.com:443', |
| 53 origin: 'https://foo-allow.com:443', | 53 origin: 'https://foo-allow.com:443', |
| 54 setting: 'allow', | 54 setting: 'block', |
| 55 source: 'preference', | 55 source: 'policy', |
| 56 }, | 56 }, |
| 57 ], | 57 ], |
| 58 images: [ | 58 images: [ |
| 59 { | 59 { |
| 60 embeddingOrigin: 'https://foo-allow.com:443', | 60 embeddingOrigin: 'https://foo-allow.com:443', |
| 61 origin: 'https://foo-allow.com:443', | 61 origin: 'https://foo-allow.com:443', |
| 62 setting: 'allow', | 62 setting: 'allow', |
| 63 source: 'preference', | 63 source: 'preference', |
| 64 }, | 64 }, |
| 65 ], | 65 ], |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 134 |
| 135 fetchUsageTotal: function(origin) { | 135 fetchUsageTotal: function(origin) { |
| 136 testElement.storedData_ = '1 KB'; | 136 testElement.storedData_ = '1 KB'; |
| 137 }, | 137 }, |
| 138 }); | 138 }); |
| 139 var api = document.createElement('mock-website-usage-private-api'); | 139 var api = document.createElement('mock-website-usage-private-api'); |
| 140 testElement.$.usageApi = api; | 140 testElement.$.usageApi = api; |
| 141 Polymer.dom(parent).appendChild(api); | 141 Polymer.dom(parent).appendChild(api); |
| 142 | 142 |
| 143 browserProxy.setPrefs(prefs); | 143 browserProxy.setPrefs(prefs); |
| 144 testElement.site = { | 144 testElement.origin = 'https://foo-allow.com:443'; |
| 145 origin: 'https://foo-allow.com:443', | |
| 146 displayName: 'https://foo-allow.com:443', | |
| 147 embeddingOrigin: '', | |
| 148 }; | |
| 149 | 145 |
| 150 Polymer.dom.flush(); | 146 Polymer.dom.flush(); |
| 151 | 147 |
| 152 // expect usage to be rendered | 148 // Expect usage to be rendered. |
| 153 assertTrue(!!testElement.$$('#usage')); | 149 assertTrue(!!testElement.$$('#usage')); |
| 154 }); | 150 }); |
| 151 | |
| 152 test('correct pref settings are shown', function() { | |
| 153 browserProxy.setPrefs(prefs); | |
| 154 testElement.origin = 'https://foo-allow.com:443'; | |
| 155 | |
| 156 testElement.root.querySelectorAll('site-details-permission') | |
| 157 .forEach(function(siteDetailsPermission) { | |
| 158 browserProxy.whenCalled('getCategoryPermissionForOrigin') | |
|
raymes
2017/06/19 04:13:12
As we discussed I think the test might have to be
Patti Lor
2017/06/20 08:25:54
Done, thank you for bringing this up because I wou
| |
| 159 .then(function() { | |
| 160 // Verify settings match the values specified in |prefs|. | |
| 161 var setting = 'allow'; | |
| 162 if (siteDetailsPermission.site.category == 'location') | |
| 163 setting = 'block'; | |
| 164 assertEquals(setting, siteDetailsPermission.site.setting); | |
| 165 assertEquals(setting, siteDetailsPermission.$.permission.value); | |
| 166 browserProxy.resetResolver('getCategoryPermissionForOrigin'); | |
| 167 }); | |
| 168 }); | |
| 169 }); | |
| 155 }); | 170 }); |
| OLD | NEW |