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 cr.define('site_details', function() { | 6 cr.define('site_details', function() { |
7 function registerTests() { | 7 function registerTests() { |
8 suite('SiteDetails', function() { | 8 suite('SiteDetails', function() { |
9 /** | 9 /** |
10 * A site list element created before each test. | 10 * A site list element created before each test. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; | 97 settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; |
98 PolymerTest.clearBody(); | 98 PolymerTest.clearBody(); |
99 testElement = document.createElement('site-details'); | 99 testElement = document.createElement('site-details'); |
100 document.body.appendChild(testElement); | 100 document.body.appendChild(testElement); |
101 }); | 101 }); |
102 | 102 |
103 test('empty state', function() { | 103 test('empty state', function() { |
104 var category = settings.ContentSettingsTypes.NOTIFICATIONS; | 104 var category = settings.ContentSettingsTypes.NOTIFICATIONS; |
105 var site = { | 105 var site = { |
106 origin: 'http://www.google.com', | 106 origin: 'http://www.google.com', |
| 107 originForDisplay: 'http://www.google.com', |
107 embeddingOrigin: '', | 108 embeddingOrigin: '', |
108 }; | 109 }; |
109 browserProxy.setPrefs(prefsEmpty); | 110 browserProxy.setPrefs(prefsEmpty); |
110 testElement.category = category; | 111 testElement.category = category; |
111 testElement.site = site | 112 testElement.site = site |
112 | 113 |
113 assertTrue(testElement.$.usage.hidden); | 114 assertTrue(testElement.$.usage.hidden); |
114 assertTrue(testElement.$.storage.hidden); | 115 assertTrue(testElement.$.storage.hidden); |
115 | 116 |
116 // TODO(finnur): Check for the Permission heading hiding when no | 117 // TODO(finnur): Check for the Permission heading hiding when no |
117 // permissions are showing. | 118 // permissions are showing. |
118 | 119 |
119 var msg = 'No category should be showing, height'; | 120 var msg = 'No category should be showing, height'; |
120 assertEquals(0, testElement.$.camera.offsetHeight, msg); | 121 assertEquals(0, testElement.$.camera.offsetHeight, msg); |
121 assertEquals(0, testElement.$.cookies.offsetHeight, msg); | 122 assertEquals(0, testElement.$.cookies.offsetHeight, msg); |
122 assertEquals(0, testElement.$.fullscreen.offsetHeight, msg); | 123 assertEquals(0, testElement.$.fullscreen.offsetHeight, msg); |
123 assertEquals(0, testElement.$.geolocation.offsetHeight, msg); | 124 assertEquals(0, testElement.$.geolocation.offsetHeight, msg); |
124 assertEquals(0, testElement.$.javascript.offsetHeight, msg); | 125 assertEquals(0, testElement.$.javascript.offsetHeight, msg); |
125 assertEquals(0, testElement.$.mic.offsetHeight, msg); | 126 assertEquals(0, testElement.$.mic.offsetHeight, msg); |
126 assertEquals(0, testElement.$.notification.offsetHeight, msg); | 127 assertEquals(0, testElement.$.notification.offsetHeight, msg); |
127 assertEquals(0, testElement.$.popups.offsetHeight, msg); | 128 assertEquals(0, testElement.$.popups.offsetHeight, msg); |
128 }); | 129 }); |
129 | 130 |
130 test('all categories visible', function() { | 131 test('all categories visible', function() { |
131 var category = settings.ContentSettingsTypes.NOTIFICATIONS; | 132 var category = settings.ContentSettingsTypes.NOTIFICATIONS; |
132 var site = { | 133 var site = { |
133 origin: 'https://foo-allow.com:443', | 134 origin: 'https://foo-allow.com:443', |
| 135 originForDisplay: 'https://foo-allow.com:443', |
134 embeddingOrigin: '', | 136 embeddingOrigin: '', |
135 }; | 137 }; |
136 | 138 |
137 browserProxy.setPrefs(prefs); | 139 browserProxy.setPrefs(prefs); |
138 testElement.category = category; | 140 testElement.category = category; |
139 testElement.site = site; | 141 testElement.site = site; |
140 | 142 |
141 var msg = 'All categories should be showing'; | 143 var msg = 'All categories should be showing'; |
142 assertFalse(testElement.$.camera.hidden, msg); | 144 assertFalse(testElement.$.camera.hidden, msg); |
143 assertFalse(testElement.$.cookies.hidden, msg); | 145 assertFalse(testElement.$.cookies.hidden, msg); |
(...skipping 18 matching lines...) Expand all Loading... |
162 testElement.storedData_ = '1 KB'; | 164 testElement.storedData_ = '1 KB'; |
163 }, | 165 }, |
164 }); | 166 }); |
165 var api = document.createElement('mock-website-usage-private-api'); | 167 var api = document.createElement('mock-website-usage-private-api'); |
166 testElement.$.usageApi = api; | 168 testElement.$.usageApi = api; |
167 Polymer.dom(parent).appendChild(api); | 169 Polymer.dom(parent).appendChild(api); |
168 | 170 |
169 browserProxy.setPrefs(prefs); | 171 browserProxy.setPrefs(prefs); |
170 testElement.site = { | 172 testElement.site = { |
171 origin: 'https://foo-allow.com:443', | 173 origin: 'https://foo-allow.com:443', |
| 174 originForDisplay: 'https://foo-allow.com:443', |
172 embeddingOrigin: '', | 175 embeddingOrigin: '', |
173 }; | 176 }; |
174 | 177 |
175 assertFalse(testElement.$.usage.hidden); | 178 assertFalse(testElement.$.usage.hidden); |
176 assertFalse(testElement.$.storage.hidden); | 179 assertFalse(testElement.$.storage.hidden); |
177 }); | 180 }); |
178 }); | 181 }); |
179 } | 182 } |
180 return { | 183 return { |
181 registerTests: registerTests, | 184 registerTests: registerTests, |
182 }; | 185 }; |
183 }); | 186 }); |
OLD | NEW |