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

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

Issue 2714883002: MD Settings: About page, show error messages with <br> and <pre> tags. (Closed)
Patch Set: Resolved conflicts. Created 3 years, 10 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/resources/settings/about_page/about_page.js ('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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 TestAboutPageBrowserProxy.prototype.setChannel = function( 145 TestAboutPageBrowserProxy.prototype.setChannel = function(
146 channel, isPowerwashAllowed) { 146 channel, isPowerwashAllowed) {
147 this.methodCalled('setChannel', [channel, isPowerwashAllowed]); 147 this.methodCalled('setChannel', [channel, isPowerwashAllowed]);
148 }; 148 };
149 } 149 }
150 150
151 151
152 function registerAboutPageTests() { 152 function registerAboutPageTests() {
153 /** 153 /**
154 * @param {!UpdateStatus} status 154 * @param {!UpdateStatus} status
155 * @param {number=} opt_progress 155 * @param {{
156 * progress: number|undefined,
157 * message: string|undefined
158 * }} opt_options
156 */ 159 */
157 function fireStatusChanged(status, opt_progress) { 160 function fireStatusChanged(status, opt_options) {
161 var options = opt_options || {};
158 cr.webUIListenerCallback('update-status-changed', { 162 cr.webUIListenerCallback('update-status-changed', {
159 progress: opt_progress === undefined ? 1 : opt_progress, 163 progress: options.progress === undefined ? 1 : options.progress,
164 message: options.message,
160 status: status, 165 status: status,
161 }); 166 });
162 } 167 }
163 168
164 suite('AboutPageTest', function() { 169 suite('AboutPageTest', function() {
165 var page = null; 170 var page = null;
166 171
167 /** @type {?settings.TestAboutPageBrowserProxy} */ 172 /** @type {?settings.TestAboutPageBrowserProxy} */
168 var aboutBrowserProxy = null; 173 var aboutBrowserProxy = null;
169 174
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 assertTrue(!!icon); 222 assertTrue(!!icon);
218 var statusMessageEl = page.$.updateStatusMessage; 223 var statusMessageEl = page.$.updateStatusMessage;
219 var previousMessageText = statusMessageEl.textContent; 224 var previousMessageText = statusMessageEl.textContent;
220 225
221 fireStatusChanged(UpdateStatus.CHECKING); 226 fireStatusChanged(UpdateStatus.CHECKING);
222 assertEquals(SPINNER_ICON, icon.src); 227 assertEquals(SPINNER_ICON, icon.src);
223 assertEquals(null, icon.getAttribute('icon')); 228 assertEquals(null, icon.getAttribute('icon'));
224 assertNotEquals(previousMessageText, statusMessageEl.textContent); 229 assertNotEquals(previousMessageText, statusMessageEl.textContent);
225 previousMessageText = statusMessageEl.textContent; 230 previousMessageText = statusMessageEl.textContent;
226 231
227 fireStatusChanged(UpdateStatus.UPDATING, 0); 232 fireStatusChanged(UpdateStatus.UPDATING, {progress: 0});
228 assertEquals(SPINNER_ICON, icon.src); 233 assertEquals(SPINNER_ICON, icon.src);
229 assertEquals(null, icon.getAttribute('icon')); 234 assertEquals(null, icon.getAttribute('icon'));
230 assertFalse(statusMessageEl.textContent.includes('%')); 235 assertFalse(statusMessageEl.textContent.includes('%'));
231 assertNotEquals(previousMessageText, statusMessageEl.textContent); 236 assertNotEquals(previousMessageText, statusMessageEl.textContent);
232 previousMessageText = statusMessageEl.textContent; 237 previousMessageText = statusMessageEl.textContent;
233 238
234 fireStatusChanged(UpdateStatus.UPDATING, 1); 239 fireStatusChanged(UpdateStatus.UPDATING, {progress: 1});
235 assertNotEquals(previousMessageText, statusMessageEl.textContent); 240 assertNotEquals(previousMessageText, statusMessageEl.textContent);
236 assertTrue(statusMessageEl.textContent.includes('%')); 241 assertTrue(statusMessageEl.textContent.includes('%'));
237 previousMessageText = statusMessageEl.textContent; 242 previousMessageText = statusMessageEl.textContent;
238 243
239 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); 244 fireStatusChanged(UpdateStatus.NEARLY_UPDATED);
240 assertEquals(null, icon.src); 245 assertEquals(null, icon.src);
241 assertEquals('settings:check-circle', icon.icon); 246 assertEquals('settings:check-circle', icon.icon);
242 assertNotEquals(previousMessageText, statusMessageEl.textContent); 247 assertNotEquals(previousMessageText, statusMessageEl.textContent);
243 previousMessageText = statusMessageEl.textContent; 248 previousMessageText = statusMessageEl.textContent;
244 249
245 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN); 250 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN);
246 assertEquals(null, icon.src); 251 assertEquals(null, icon.src);
247 assertEquals('cr20:domain', icon.icon); 252 assertEquals('cr20:domain', icon.icon);
248 assertEquals(0, statusMessageEl.textContent.trim().length); 253 assertEquals(0, statusMessageEl.textContent.trim().length);
249 254
250 fireStatusChanged(UpdateStatus.FAILED); 255 fireStatusChanged(UpdateStatus.FAILED);
251 assertEquals(null, icon.src); 256 assertEquals(null, icon.src);
252 assertEquals('settings:error', icon.icon); 257 assertEquals('settings:error', icon.icon);
253 assertEquals(0, statusMessageEl.textContent.trim().length); 258 assertEquals(0, statusMessageEl.textContent.trim().length);
254 259
255 fireStatusChanged(UpdateStatus.DISABLED); 260 fireStatusChanged(UpdateStatus.DISABLED);
256 assertEquals(null, icon.src); 261 assertEquals(null, icon.src);
257 assertEquals(null, icon.getAttribute('icon')); 262 assertEquals(null, icon.getAttribute('icon'));
258 assertEquals(0, statusMessageEl.textContent.trim().length); 263 assertEquals(0, statusMessageEl.textContent.trim().length);
259 }); 264 });
260 265
266 test('ErrorMessageWithHtml', function() {
267 var htmlError = 'hello<br>there<br>was<pre>an</pre>error';
268 fireStatusChanged(
269 UpdateStatus.FAILED, {message: htmlError});
270 var statusMessageEl = page.$.updateStatusMessage;
271 assertEquals(htmlError, statusMessageEl.innerHTML);
272 });
273
261 /** 274 /**
262 * Test that when the current platform has been marked as deprecated (but 275 * Test that when the current platform has been marked as deprecated (but
263 * not end of the line) a deprecation warning message is displayed, 276 * not end of the line) a deprecation warning message is displayed,
264 * without interfering with the update status message and icon. 277 * without interfering with the update status message and icon.
265 */ 278 */
266 test('ObsoleteSystem', function() { 279 test('ObsoleteSystem', function() {
267 loadTimeData.overrideValues({ 280 loadTimeData.overrideValues({
268 aboutObsoleteNowOrSoon: true, 281 aboutObsoleteNowOrSoon: true,
269 aboutObsoleteEndOfTheLine: false, 282 aboutObsoleteEndOfTheLine: false,
270 }); 283 });
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 registerTests: function() { 876 registerTests: function() {
864 if (cr.isChromeOS) { 877 if (cr.isChromeOS) {
865 registerDetailedBuildInfoTests(); 878 registerDetailedBuildInfoTests();
866 registerChannelSwitcherDialogTests(); 879 registerChannelSwitcherDialogTests();
867 } 880 }
868 registerAboutPageTests(); 881 registerAboutPageTests();
869 }, 882 },
870 registerOfficialBuildTests: registerOfficialBuildTests, 883 registerOfficialBuildTests: registerOfficialBuildTests,
871 }; 884 };
872 }); 885 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/about_page/about_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698