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

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

Issue 2476353007: MD Settings: ignore 0% updates on help/about page (Closed)
Patch Set: Created 4 years, 1 month 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 }, 58 },
59 59
60 /** @override */ 60 /** @override */
61 pageReady: function() { 61 pageReady: function() {
62 this.methodCalled('pageReady'); 62 this.methodCalled('pageReady');
63 }, 63 },
64 64
65 /** @override */ 65 /** @override */
66 refreshUpdateStatus: function() { 66 refreshUpdateStatus: function() {
67 cr.webUIListenerCallback('update-status-changed', { 67 cr.webUIListenerCallback('update-status-changed', {
68 progress: 0, 68 progress: 1,
69 status: this.updateStatus_, 69 status: this.updateStatus_,
70 }); 70 });
71 this.methodCalled('refreshUpdateStatus'); 71 this.methodCalled('refreshUpdateStatus');
72 }, 72 },
73 73
74 /** @override */ 74 /** @override */
75 openFeedbackDialog: function() { 75 openFeedbackDialog: function() {
76 this.methodCalled('openFeedbackDialog'); 76 this.methodCalled('openFeedbackDialog');
77 }, 77 },
78 78
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 /** @override */ 132 /** @override */
133 TestAboutPageBrowserProxy.prototype.setChannel = function( 133 TestAboutPageBrowserProxy.prototype.setChannel = function(
134 channel, isPowerwashAllowed) { 134 channel, isPowerwashAllowed) {
135 this.methodCalled('setChannel', [channel, isPowerwashAllowed]); 135 this.methodCalled('setChannel', [channel, isPowerwashAllowed]);
136 }; 136 };
137 } 137 }
138 138
139 139
140 function registerAboutPageTests() { 140 function registerAboutPageTests() {
141 /** @param {!UpdateStatus} status */ 141 /**
142 function fireStatusChanged(status) { 142 * @param {!UpdateStatus} status
143 * @param {number=} opt_progress
144 */
145 function fireStatusChanged(status, opt_progress) {
143 cr.webUIListenerCallback('update-status-changed', { 146 cr.webUIListenerCallback('update-status-changed', {
144 progress: 0, 147 progress: opt_progress === undefined ? 1 : opt_progress,
145 status: status, 148 status: status,
146 }); 149 });
147 } 150 }
148 151
149 suite('AboutPageTest', function() { 152 suite('AboutPageTest', function() {
150 var page = null; 153 var page = null;
151 154
152 /** @type {?settings.TestAboutPageBrowserProxy} */ 155 /** @type {?settings.TestAboutPageBrowserProxy} */
153 var aboutBrowserProxy = null; 156 var aboutBrowserProxy = null;
154 157
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 assertTrue(!!icon); 198 assertTrue(!!icon);
196 var statusMessageEl = page.$.updateStatusMessage; 199 var statusMessageEl = page.$.updateStatusMessage;
197 var previousMessageText = statusMessageEl.textContent; 200 var previousMessageText = statusMessageEl.textContent;
198 201
199 fireStatusChanged(UpdateStatus.CHECKING); 202 fireStatusChanged(UpdateStatus.CHECKING);
200 assertEquals(SPINNER_ICON, icon.src); 203 assertEquals(SPINNER_ICON, icon.src);
201 assertEquals(null, icon.getAttribute('icon')); 204 assertEquals(null, icon.getAttribute('icon'));
202 assertNotEquals(previousMessageText, statusMessageEl.textContent); 205 assertNotEquals(previousMessageText, statusMessageEl.textContent);
203 previousMessageText = statusMessageEl.textContent; 206 previousMessageText = statusMessageEl.textContent;
204 207
205 fireStatusChanged(UpdateStatus.UPDATING); 208 fireStatusChanged(UpdateStatus.UPDATING, 0);
206 assertEquals(SPINNER_ICON, icon.src); 209 assertEquals(SPINNER_ICON, icon.src);
207 assertEquals(null, icon.getAttribute('icon')); 210 assertEquals(null, icon.getAttribute('icon'));
211 assertFalse(statusMessageEl.textContent.includes('%'));
208 assertNotEquals(previousMessageText, statusMessageEl.textContent); 212 assertNotEquals(previousMessageText, statusMessageEl.textContent);
209 previousMessageText = statusMessageEl.textContent; 213 previousMessageText = statusMessageEl.textContent;
210 214
215 fireStatusChanged(UpdateStatus.UPDATING, 1);
216 assertNotEquals(previousMessageText, statusMessageEl.textContent);
217 assertTrue(statusMessageEl.textContent.includes('%'));
218 previousMessageText = statusMessageEl.textContent;
219
211 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); 220 fireStatusChanged(UpdateStatus.NEARLY_UPDATED);
212 assertEquals(null, icon.src); 221 assertEquals(null, icon.src);
213 assertEquals('settings:check-circle', icon.icon); 222 assertEquals('settings:check-circle', icon.icon);
214 assertNotEquals(previousMessageText, statusMessageEl.textContent); 223 assertNotEquals(previousMessageText, statusMessageEl.textContent);
215 previousMessageText = statusMessageEl.textContent; 224 previousMessageText = statusMessageEl.textContent;
216 225
217 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN); 226 fireStatusChanged(UpdateStatus.DISABLED_BY_ADMIN);
218 assertEquals(null, icon.src); 227 assertEquals(null, icon.src);
219 assertEquals('cr:domain', icon.icon); 228 assertEquals('cr:domain', icon.icon);
220 assertEquals(0, statusMessageEl.textContent.trim().length); 229 assertEquals(0, statusMessageEl.textContent.trim().length);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 registerTests: function() { 714 registerTests: function() {
706 if (cr.isChromeOS) { 715 if (cr.isChromeOS) {
707 registerDetailedBuildInfoTests(); 716 registerDetailedBuildInfoTests();
708 registerChannelSwitcherDialogTests(); 717 registerChannelSwitcherDialogTests();
709 } 718 }
710 registerAboutPageTests(); 719 registerAboutPageTests();
711 }, 720 },
712 registerOfficialBuildTests: registerOfficialBuildTests, 721 registerOfficialBuildTests: registerOfficialBuildTests,
713 }; 722 };
714 }); 723 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698