Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 TestAboutPageBrowserProxy.prototype = { | 55 TestAboutPageBrowserProxy.prototype = { |
| 56 __proto__: settings.TestBrowserProxy.prototype, | 56 __proto__: settings.TestBrowserProxy.prototype, |
| 57 | 57 |
| 58 /** @param {!UpdateStatus} updateStatus */ | 58 /** @param {!UpdateStatus} updateStatus */ |
| 59 setUpdateStatus: function(updateStatus) { | 59 setUpdateStatus: function(updateStatus) { |
| 60 this.updateStatus_ = updateStatus; | 60 this.updateStatus_ = updateStatus; |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 sendStatusNoInternet: function() { | |
| 64 cr.webUIListenerCallback('update-status-changed', { | |
| 65 progress: 0, | |
| 66 status: 'failed', | |
|
dpapad
2017/02/17 02:44:28
UpdateStatus.FAILED
stevenjb
2017/02/17 20:02:41
Done.
| |
| 67 message: 'offline', | |
| 68 connectionTypes: 'no internet', | |
| 69 }); | |
| 70 }, | |
| 71 | |
| 63 /** @override */ | 72 /** @override */ |
| 64 pageReady: function() { | 73 pageReady: function() { this.methodCalled('pageReady'); }, |
| 65 this.methodCalled('pageReady'); | |
| 66 }, | |
| 67 | 74 |
| 68 /** @override */ | 75 /** @override */ |
| 69 refreshUpdateStatus: function() { | 76 refreshUpdateStatus: function() { |
| 70 cr.webUIListenerCallback('update-status-changed', { | 77 cr.webUIListenerCallback('update-status-changed', { |
| 71 progress: 1, | 78 progress: 1, |
| 72 status: this.updateStatus_, | 79 status: this.updateStatus_, |
| 73 }); | 80 }); |
| 74 this.methodCalled('refreshUpdateStatus'); | 81 this.methodCalled('refreshUpdateStatus'); |
| 75 }, | 82 }, |
| 76 | 83 |
| 77 /** @override */ | 84 /** @override */ |
| 78 openFeedbackDialog: function() { | 85 openFeedbackDialog: function() { this.methodCalled('openFeedbackDialog'); }, |
| 79 this.methodCalled('openFeedbackDialog'); | |
| 80 }, | |
| 81 | 86 |
| 82 /** @override */ | 87 /** @override */ |
| 83 openHelpPage: function() { | 88 openHelpPage: function() { this.methodCalled('openHelpPage'); }, |
| 84 this.methodCalled('openHelpPage'); | |
| 85 }, | |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 if (cr.isMac) { | 91 if (cr.isMac) { |
| 89 /** @override */ | 92 /** @override */ |
| 90 TestAboutPageBrowserProxy.prototype.promoteUpdater = function() { | 93 TestAboutPageBrowserProxy.prototype.promoteUpdater = function() { |
| 91 this.methodCalled('promoteUpdater'); | 94 this.methodCalled('promoteUpdater'); |
| 92 }; | 95 }; |
| 93 } | 96 } |
| 94 | 97 |
| 95 if (cr.isChromeOS) { | 98 if (cr.isChromeOS) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); | 346 fireStatusChanged(UpdateStatus.NEARLY_UPDATED); |
| 344 assertFalse(relaunch.hidden); | 347 assertFalse(relaunch.hidden); |
| 345 | 348 |
| 346 var relaunch = page.$.relaunch; | 349 var relaunch = page.$.relaunch; |
| 347 assertTrue(!!relaunch); | 350 assertTrue(!!relaunch); |
| 348 MockInteractions.tap(relaunch); | 351 MockInteractions.tap(relaunch); |
| 349 return lifetimeBrowserProxy.whenCalled('relaunch'); | 352 return lifetimeBrowserProxy.whenCalled('relaunch'); |
| 350 }); | 353 }); |
| 351 | 354 |
| 352 if (cr.isChromeOS) { | 355 if (cr.isChromeOS) { |
| 356 test('NoInternet', function() { | |
| 357 assertTrue(page.$.updateStatusMessage.hidden); | |
| 358 aboutBrowserProxy.sendStatusNoInternet(); | |
| 359 Polymer.dom.flush(); | |
| 360 assertFalse(page.$.updateStatusMessage.hidden); | |
| 361 assertNotEquals( | |
| 362 -1, page.$.updateStatusMessage.innerHTML.indexOf('no internet')); | |
|
dpapad
2017/02/17 02:44:28
Nit (optional): You can use String#includes instea
stevenjb
2017/02/17 20:02:41
Huh. Good old JS, why have one method when you can
| |
| 363 }); | |
| 364 | |
| 353 /** | 365 /** |
| 354 * Test that all buttons update according to incoming | 366 * Test that all buttons update according to incoming |
| 355 * 'update-status-changed' events for the case where target and current | 367 * 'update-status-changed' events for the case where target and current |
| 356 * channel are the same. | 368 * channel are the same. |
| 357 */ | 369 */ |
| 358 test('ButtonsUpdate_SameChannel', function() { | 370 test('ButtonsUpdate_SameChannel', function() { |
| 359 var relaunch = page.$.relaunch; | 371 var relaunch = page.$.relaunch; |
| 360 var checkForUpdates = page.$.checkForUpdates; | 372 var checkForUpdates = page.$.checkForUpdates; |
| 361 var relaunchAndPowerwash = page.$.relaunchAndPowerwash; | 373 var relaunchAndPowerwash = page.$.relaunchAndPowerwash; |
| 362 | 374 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 registerTests: function() { | 863 registerTests: function() { |
| 852 if (cr.isChromeOS) { | 864 if (cr.isChromeOS) { |
| 853 registerDetailedBuildInfoTests(); | 865 registerDetailedBuildInfoTests(); |
| 854 registerChannelSwitcherDialogTests(); | 866 registerChannelSwitcherDialogTests(); |
| 855 } | 867 } |
| 856 registerAboutPageTests(); | 868 registerAboutPageTests(); |
| 857 }, | 869 }, |
| 858 registerOfficialBuildTests: registerOfficialBuildTests, | 870 registerOfficialBuildTests: registerOfficialBuildTests, |
| 859 }; | 871 }; |
| 860 }); | 872 }); |
| OLD | NEW |