Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: chrome/test/data/webui/settings/about_page_tests.js

Issue 2029453002: MD Settings: About page, implement obsolete/end-of-the-line status. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/about_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 function registerAboutPageTests() { 138 function registerAboutPageTests() {
139 /** @param {!UpdateStatus} status */ 139 /** @param {!UpdateStatus} status */
140 function fireStatusChanged(status) { 140 function fireStatusChanged(status) {
141 cr.webUIListenerCallback('update-status-changed', {status: status}); 141 cr.webUIListenerCallback('update-status-changed', {status: status});
142 } 142 }
143 143
144 suite('AboutPageTest', function() { 144 suite('AboutPageTest', function() {
145 var page = null; 145 var page = null;
146 var browserProxy = null; 146 var browserProxy = null;
147 var SPINNER_ICON = 'chrome://resources/images/throbber_small.svg';
147 148
148 setup(function() { 149 setup(function() {
149 browserProxy = new TestAboutPageBrowserProxy(); 150 browserProxy = new TestAboutPageBrowserProxy();
150 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; 151 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy;
151 return initNewPage(); 152 return initNewPage();
152 }); 153 });
153 154
155 teardown(function() {
156 page.remove();
157 page = null;
158 loadTimeData.overrideValues({
159 aboutObsoleteNowOrSoon: false,
160 aboutObsoleteEndOfTheLine: false,
161 });
162 });
163
154 /** @return {!Promise} */ 164 /** @return {!Promise} */
155 function initNewPage() { 165 function initNewPage() {
156 browserProxy.reset(); 166 browserProxy.reset();
157 PolymerTest.clearBody(); 167 PolymerTest.clearBody();
158 page = document.createElement('settings-about-page'); 168 page = document.createElement('settings-about-page');
159 document.body.appendChild(page); 169 document.body.appendChild(page);
160 return browserProxy.whenCalled('refreshUpdateStatus'); 170 return browserProxy.whenCalled('refreshUpdateStatus');
161 } 171 }
162 172
163 /** 173 /**
164 * Test that the status icon updates according to incoming 174 * Test that the status icon updates according to incoming
165 * 'update-status-changed' events. 175 * 'update-status-changed' events.
166 */ 176 */
167 test('IconUpdates', function() { 177 test('IconUpdates', function() {
168 var SPINNER_ICON = 'chrome://resources/images/throbber_small.svg';
169
170 var icon = page.$$('iron-icon'); 178 var icon = page.$$('iron-icon');
171 assertTrue(!!icon); 179 assertTrue(!!icon);
172 180
173 fireStatusChanged(UpdateStatus.CHECKING); 181 fireStatusChanged(UpdateStatus.CHECKING);
174 assertEquals(SPINNER_ICON, icon.src); 182 assertEquals(SPINNER_ICON, icon.src);
175 assertEquals(null, icon.getAttribute('icon')); 183 assertEquals(null, icon.getAttribute('icon'));
176 184
177 fireStatusChanged(UpdateStatus.UPDATING); 185 fireStatusChanged(UpdateStatus.UPDATING);
178 assertEquals(SPINNER_ICON, icon.src); 186 assertEquals(SPINNER_ICON, icon.src);
179 assertEquals(null, icon.getAttribute('icon')); 187 assertEquals(null, icon.getAttribute('icon'));
(...skipping 12 matching lines...) Expand all
192 200
193 fireStatusChanged(UpdateStatus.FAILED); 201 fireStatusChanged(UpdateStatus.FAILED);
194 assertEquals(null, icon.src); 202 assertEquals(null, icon.src);
195 assertEquals('settings:error', icon.icon); 203 assertEquals('settings:error', icon.icon);
196 204
197 fireStatusChanged(UpdateStatus.DISABLED); 205 fireStatusChanged(UpdateStatus.DISABLED);
198 assertEquals(null, icon.src); 206 assertEquals(null, icon.src);
199 assertEquals(null, icon.getAttribute('icon')); 207 assertEquals(null, icon.getAttribute('icon'));
200 }); 208 });
201 209
210 /**
211 * Test that when the current platform has been marked as deprecated (but
212 * not end of the line) a deprecation warning message is displayed,
213 * without interfering with the update status message and icon.
214 */
215 test('ObsoleteSystem', function() {
216 loadTimeData.overrideValues({
217 aboutObsoleteNowOrSoon: true,
218 aboutObsoleteEndOfTheLine: false,
219 });
220
221 return initNewPage().then(function() {
222 var icon = page.$$('iron-icon');
223 assertTrue(!!icon);
224 assertTrue(!!page.$.updateStatusMessage);
225 assertTrue(!!page.$.deprecationWarning);
226
227 assertFalse(page.$.deprecationWarning.hidden);
228 assertFalse(page.$.updateStatusMessage.hidden);
229
230 fireStatusChanged(UpdateStatus.CHECKING);
231 assertEquals(SPINNER_ICON, icon.src);
232 assertEquals(null, icon.getAttribute('icon'));
233 assertFalse(page.$.deprecationWarning.hidden);
234 assertFalse(page.$.updateStatusMessage.hidden);
235
236 fireStatusChanged(UpdateStatus.UPDATING);
237 assertEquals(SPINNER_ICON, icon.src);
238 assertEquals(null, icon.getAttribute('icon'));
239 assertFalse(page.$.deprecationWarning.hidden);
240 assertFalse(page.$.updateStatusMessage.hidden);
241
242 fireStatusChanged(UpdateStatus.NEARLY_UPDATED);
243 assertEquals(null, icon.src);
244 assertEquals('settings:check-circle', icon.icon);
245 assertFalse(page.$.deprecationWarning.hidden);
246 assertFalse(page.$.updateStatusMessage.hidden);
247 });
248 });
249
250 /**
251 * Test that when the current platform has reached the end of the line, a
252 * deprecation warning message and an error icon is displayed.
253 */
254 test('ObsoleteSystemEndOfLine', function() {
255 loadTimeData.overrideValues({
256 aboutObsoleteNowOrSoon: true,
257 aboutObsoleteEndOfTheLine: true,
258 });
259 return initNewPage().then(function() {
260 var icon = page.$$('iron-icon');
261 assertTrue(!!icon);
262 assertTrue(!!page.$.deprecationWarning);
263 assertTrue(!!page.$.updateStatusMessage);
264
265 assertFalse(page.$.deprecationWarning.hidden);
266 assertFalse(page.$.deprecationWarning.hidden);
267
268 fireStatusChanged(UpdateStatus.CHECKING);
269 assertEquals(null, icon.src);
270 assertEquals('settings:error', icon.icon);
271 assertFalse(page.$.deprecationWarning.hidden);
272 assertTrue(page.$.updateStatusMessage.hidden);
273
274 fireStatusChanged(UpdateStatus.FAILED);
275 assertEquals(null, icon.src);
276 assertEquals('settings:error', icon.icon);
277 assertFalse(page.$.deprecationWarning.hidden);
278 assertTrue(page.$.updateStatusMessage.hidden);
279
280 fireStatusChanged(UpdateStatus.UPDATED);
281 assertEquals(null, icon.src);
282 assertEquals('settings:error', icon.icon);
283 assertFalse(page.$.deprecationWarning.hidden);
284 assertTrue(page.$.updateStatusMessage.hidden);
285 });
286 });
287
202 if (cr.isChromeOS) { 288 if (cr.isChromeOS) {
203 /** 289 /**
204 * Test that all buttons update according to incoming 290 * Test that all buttons update according to incoming
205 * 'update-status-changed' events for the case where target and current 291 * 'update-status-changed' events for the case where target and current
206 * channel are the same. 292 * channel are the same.
207 */ 293 */
208 test('ButtonsUpdate_SameChannel', function() { 294 test('ButtonsUpdate_SameChannel', function() {
209 var relaunch = page.$.relaunch; 295 var relaunch = page.$.relaunch;
210 var checkForUpdates = page.$.checkForUpdates; 296 var checkForUpdates = page.$.checkForUpdates;
211 var relaunchAndPowerwash = page.$.relaunchAndPowerwash; 297 var relaunchAndPowerwash = page.$.relaunchAndPowerwash;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 registerTests: function() { 673 registerTests: function() {
588 if (cr.isChromeOS) { 674 if (cr.isChromeOS) {
589 registerDetailedBuildInfoTests(); 675 registerDetailedBuildInfoTests();
590 registerChannelSwitcherDialogTests(); 676 registerChannelSwitcherDialogTests();
591 } 677 }
592 registerAboutPageTests(); 678 registerAboutPageTests();
593 }, 679 },
594 registerOfficialBuildTests: registerOfficialBuildTests, 680 registerOfficialBuildTests: registerOfficialBuildTests,
595 }; 681 };
596 }); 682 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/about_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698