 Chromium Code Reviews
 Chromium Code Reviews Issue 2538043006:
  Settings: About: Fix cros channel info.  (Closed)
    
  
    Issue 2538043006:
  Settings: About: Fix cros channel info.  (Closed) 
  | Index: chrome/test/data/webui/settings/about_page_tests.js | 
| diff --git a/chrome/test/data/webui/settings/about_page_tests.js b/chrome/test/data/webui/settings/about_page_tests.js | 
| index 6ffdaf98f6c5744c174da12356764229d291431d..74188b00a4772d87c5113aced1118a0b9b6f5db6 100644 | 
| --- a/chrome/test/data/webui/settings/about_page_tests.js | 
| +++ b/chrome/test/data/webui/settings/about_page_tests.js | 
| @@ -21,6 +21,7 @@ cr.define('settings_about_page', function() { | 
| 'getCurrentChannel', | 
| 'getTargetChannel', | 
| 'getVersionInfo', | 
| + 'getCanChangeChannel', | 
| 'getRegulatoryInfo', | 
| 'setChannel'); | 
| } | 
| @@ -38,6 +39,9 @@ cr.define('settings_about_page', function() { | 
| osVersion: '', | 
| }; | 
| + /** @type {boolean} */ | 
| 
dpapad
2016/12/05 18:52:27
@private
 
stevenjb
2016/12/06 20:38:03
Done.
 | 
| + this.canChangeChannel_ = true; | 
| + | 
| /** @private {!BrowserChannel} */ | 
| this.currentChannel_ = BrowserChannel.BETA; | 
| @@ -88,6 +92,12 @@ cr.define('settings_about_page', function() { | 
| this.versionInfo_ = versionInfo; | 
| }; | 
| + /** @param {boolean} */ | 
| + TestAboutPageBrowserProxy.prototype.setCanChangeChannel = function( | 
| + canChangeChannel) { | 
| + this.canChangeChannel_ = canChangeChannel; | 
| + }; | 
| + | 
| /** | 
| * @param {!BrowserChannel} current | 
| * @param {!BrowserChannel} target | 
| @@ -124,6 +134,12 @@ cr.define('settings_about_page', function() { | 
| }; | 
| /** @override */ | 
| + TestAboutPageBrowserProxy.prototype.getCanChangeChannel = function() { | 
| + this.methodCalled('getCanChangeChannel'); | 
| + return Promise.resolve(this.canChangeChannel_); | 
| + }; | 
| + | 
| + /** @override */ | 
| TestAboutPageBrowserProxy.prototype.getRegulatoryInfo = function() { | 
| this.methodCalled('getRegulatoryInfo'); | 
| return Promise.resolve(this.regulatoryInfo_); | 
| @@ -580,7 +596,7 @@ cr.define('settings_about_page', function() { | 
| return Promise.all([ | 
| browserProxy.whenCalled('pageReady'), | 
| browserProxy.whenCalled('getVersionInfo'), | 
| - browserProxy.whenCalled('getCurrentChannel'), | 
| + browserProxy.whenCalled('getTargetChannel'), | 
| ]).then(function() { | 
| assertEquals(versionInfo.arcVersion, page.$.arcVersion.textContent); | 
| assertEquals(versionInfo.osVersion, page.$.osVersion.textContent); | 
| @@ -596,23 +612,24 @@ cr.define('settings_about_page', function() { | 
| * changing channels is allowed. | 
| 
dpapad
2016/12/05 18:52:27
@return {!Promise} missing
 | 
| */ | 
| function checkChangeChannelButton(canChangeChannel) { | 
| - loadTimeData.overrideValues({ | 
| - aboutCanChangeChannel: canChangeChannel | 
| - }); | 
| + browserProxy.setCanChangeChannel(canChangeChannel); | 
| page = document.createElement('settings-detailed-build-info'); | 
| document.body.appendChild(page); | 
| - | 
| - var changeChannelButton = page.$$('paper-button'); | 
| - assertTrue(!!changeChannelButton); | 
| - assertEquals(canChangeChannel, !changeChannelButton.disabled) | 
| + return Promise.all([ | 
| + browserProxy.whenCalled('getCanChangeChannel'), | 
| 
dpapad
2016/12/05 18:52:27
Why use Promise.all() for a single Promise?
 
stevenjb
2016/12/06 20:38:03
Done.
 | 
| + ]).then(function() { | 
| + var changeChannelButton = page.$$('paper-button'); | 
| + assertTrue(!!changeChannelButton); | 
| + assertEquals(canChangeChannel, !changeChannelButton.disabled); | 
| + }); | 
| } | 
| test('ChangeChannel_Enabled', function() { | 
| - checkChangeChannelButton(true); | 
| + return checkChangeChannelButton(true); | 
| }); | 
| test('ChangeChannel_Disabled', function() { | 
| - checkChangeChannelButton(false); | 
| + return checkChangeChannelButton(false); | 
| }); | 
| }); | 
| } | 
| @@ -635,7 +652,7 @@ cr.define('settings_about_page', function() { | 
| radioButtons = dialog.shadowRoot.querySelectorAll( | 
| 'paper-radio-button'); | 
| assertEquals(3, radioButtons.length); | 
| - return browserProxy.whenCalled('getCurrentChannel'); | 
| + return browserProxy.whenCalled('getTargetChannel'); | 
| }); | 
| teardown(function() { dialog.remove(); }); |