OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('settings_about_page', function() { | 5 cr.define('settings_about_page', function() { |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @implements {settings.AboutPageBrowserProxy} | 8 * @implements {settings.AboutPageBrowserProxy} |
9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 /** @return {!Promise} */ | 164 /** @return {!Promise} */ |
165 function initNewPage() { | 165 function initNewPage() { |
166 browserProxy.reset(); | 166 browserProxy.reset(); |
167 PolymerTest.clearBody(); | 167 PolymerTest.clearBody(); |
168 page = document.createElement('settings-about-page'); | 168 page = document.createElement('settings-about-page'); |
169 document.body.appendChild(page); | 169 document.body.appendChild(page); |
170 return browserProxy.whenCalled('refreshUpdateStatus'); | 170 return browserProxy.whenCalled('refreshUpdateStatus'); |
171 } | 171 } |
172 | 172 |
173 /** | 173 /** |
174 * Test that the status icon updates according to incoming | 174 * Test that the status icon and status message update according to |
175 * 'update-status-changed' events. | 175 * incoming 'update-status-changed' events. |
176 */ | 176 */ |
177 test('IconUpdates', function() { | 177 test('IconAndMessageUpdates', function() { |
178 var icon = page.$$('iron-icon'); | 178 var icon = page.$$('iron-icon'); |
179 assertTrue(!!icon); | 179 assertTrue(!!icon); |
| 180 var statusMessageEl = page.$.updateStatusMessage; |
| 181 var previousMessageText = statusMessageEl.textContent; |
180 | 182 |
181 fireStatusChanged(UpdateStatus.CHECKING); | 183 fireStatusChanged(UpdateStatus.CHECKING); |
182 assertEquals(SPINNER_ICON, icon.src); | 184 assertEquals(SPINNER_ICON, icon.src); |
183 assertEquals(null, icon.getAttribute('icon')); | 185 assertEquals(null, icon.getAttribute('icon')); |
| 186 assertNotEquals(previousMessageText, statusMessageEl.textContent); |
| 187 previousMessageText = statusMessageEl.textContent; |
184 | 188 |
185 fireStatusChanged(UpdateStatus.UPDATING); | 189 fireStatusChanged(UpdateStatus.UPDATING); |
186 assertEquals(SPINNER_ICON, icon.src); | 190 assertEquals(SPINNER_ICON, icon.src); |
187 assertEquals(null, icon.getAttribute('icon')); | 191 assertEquals(null, icon.getAttribute('icon')); |
| 192 assertNotEquals(previousMessageText, statusMessageEl.textContent); |
| 193 previousMessageText = statusMessageEl.textContent; |
188 | 194 |
189 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); | 195 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); |
190 assertEquals(null, icon.src); | 196 assertEquals(null, icon.src); |
191 assertEquals('settings:check-circle', icon.icon); | 197 assertEquals('settings:check-circle', icon.icon); |
192 | 198 assertNotEquals(previousMessageText, statusMessageEl.textContent); |
193 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); | 199 previousMessageText = statusMessageEl.textContent; |
194 assertEquals(null, icon.src); | |
195 assertEquals('settings:check-circle', icon.icon); | |
196 | 200 |
197 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN); | 201 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN); |
198 assertEquals(null, icon.src); | 202 assertEquals(null, icon.src); |
199 assertEquals('cr:domain', icon.icon); | 203 assertEquals('cr:domain', icon.icon); |
| 204 assertEquals(0, statusMessageEl.textContent.trim().length); |
200 | 205 |
201 fireStatusChanged(UpdateStatus.FAILED); | 206 fireStatusChanged(UpdateStatus.FAILED); |
202 assertEquals(null, icon.src); | 207 assertEquals(null, icon.src); |
203 assertEquals('settings:error', icon.icon); | 208 assertEquals('settings:error', icon.icon); |
| 209 assertEquals(0, statusMessageEl.textContent.trim().length); |
204 | 210 |
205 fireStatusChanged(UpdateStatus.DISABLED); | 211 fireStatusChanged(UpdateStatus.DISABLED); |
206 assertEquals(null, icon.src); | 212 assertEquals(null, icon.src); |
207 assertEquals(null, icon.getAttribute('icon')); | 213 assertEquals(null, icon.getAttribute('icon')); |
| 214 assertEquals(0, statusMessageEl.textContent.trim().length); |
208 }); | 215 }); |
209 | 216 |
210 /** | 217 /** |
211 * Test that when the current platform has been marked as deprecated (but | 218 * Test that when the current platform has been marked as deprecated (but |
212 * not end of the line) a deprecation warning message is displayed, | 219 * not end of the line) a deprecation warning message is displayed, |
213 * without interfering with the update status message and icon. | 220 * without interfering with the update status message and icon. |
214 */ | 221 */ |
215 test('ObsoleteSystem', function() { | 222 test('ObsoleteSystem', function() { |
216 loadTimeData.overrideValues({ | 223 loadTimeData.overrideValues({ |
217 aboutObsoleteNowOrSoon: true, | 224 aboutObsoleteNowOrSoon: true, |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 registerTests: function() { | 680 registerTests: function() { |
674 if (cr.isChromeOS) { | 681 if (cr.isChromeOS) { |
675 registerDetailedBuildInfoTests(); | 682 registerDetailedBuildInfoTests(); |
676 registerChannelSwitcherDialogTests(); | 683 registerChannelSwitcherDialogTests(); |
677 } | 684 } |
678 registerAboutPageTests(); | 685 registerAboutPageTests(); |
679 }, | 686 }, |
680 registerOfficialBuildTests: registerOfficialBuildTests, | 687 registerOfficialBuildTests: registerOfficialBuildTests, |
681 }; | 688 }; |
682 }); | 689 }); |
OLD | NEW |