Chromium Code Reviews| 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 fe0aa45ef9117ca583f480fa36dd08d95593788c..61d0a1b3e8eff9782ec3bc9f0e7238786a2a7f61 100644 |
| --- a/chrome/test/data/webui/settings/about_page_tests.js |
| +++ b/chrome/test/data/webui/settings/about_page_tests.js |
| @@ -9,43 +9,48 @@ cr.define('settings_about_page', function() { |
| * @extends {settings.TestBrowserProxy} |
| */ |
| var TestAboutPageBrowserProxy = function() { |
| - settings.TestBrowserProxy.call(this, [ |
| + var methodNames = [ |
| 'pageReady', |
| 'refreshUpdateStatus', |
| 'openHelpPage', |
| 'openFeedbackDialog', |
| - 'getCurrentChannel', |
| - 'getTargetChannel', |
| - 'getVersionInfo', |
| - ]); |
| - |
| - /** @type {!VersionInfo} */ |
| - this.versionInfo_ = { |
| - arcVersion: '', |
| - osFirmware: '', |
| - osVersion: '', |
| - }; |
| + ]; |
| + |
| + if (cr.isChromeOS) { |
| + methodNames.push( |
| + 'getCurrentChannel', |
| + 'getTargetChannel', |
| + 'getVersionInfo', |
| + 'getRegulatoryInfo'); |
| + } |
| + |
| + settings.TestBrowserProxy.call(this, methodNames); |
| /** @private {!UpdateStatus} */ |
| this.updateStatus_ = UpdateStatus.UPDATED; |
| if (cr.isChromeOS) { |
| + /** @type {!VersionInfo} */ |
| + this.versionInfo_ = { |
| + arcVersion: '', |
| + osFirmware: '', |
| + osVersion: '', |
| + }; |
| + |
| /** @private {!BrowserChannel} */ |
| this.currentChannel_ = BrowserChannel.BETA; |
| /** @private {!BrowserChannel} */ |
| this.targetChannel_ = BrowserChannel.BETA; |
| + |
| + /** @private {?RegulatoryInfo} */ |
| + this.regulatoryInfo_ = null; |
| } |
| }; |
| TestAboutPageBrowserProxy.prototype = { |
| __proto__: settings.TestBrowserProxy.prototype, |
| - /** @param {!VersionInfo} */ |
| - setVersionInfo: function(versionInfo) { |
| - this.versionInfo_ = versionInfo; |
| - }, |
| - |
| /** @param {!UpdateStatus} updateStatus */ |
| setUpdateStatus: function(updateStatus) { |
| this.updateStatus_ = updateStatus; |
| @@ -75,6 +80,11 @@ cr.define('settings_about_page', function() { |
| }; |
| if (cr.isChromeOS) { |
| + /** @param {!VersionInfo} */ |
| + TestAboutPageBrowserProxy.prototype.setVersionInfo = function(versionInfo) { |
| + this.versionInfo_ = versionInfo; |
| + }; |
| + |
| /** |
| * @param {!BrowserChannel} current |
| * @param {!BrowserChannel} target |
| @@ -85,6 +95,13 @@ cr.define('settings_about_page', function() { |
| this.targetChannel_ = target; |
| }; |
| + |
| + /** @param {?RegulatoryInfo} regulatoryInfo */ |
| + TestAboutPageBrowserProxy.prototype.setRegulatoryInfo = function( |
| + regulatoryInfo) { |
| + this.regulatoryInfo_ = regulatoryInfo; |
| + }; |
| + |
| /** @override */ |
| TestAboutPageBrowserProxy.prototype.getCurrentChannel = function() { |
| this.methodCalled('getCurrentChannel'); |
| @@ -102,6 +119,12 @@ cr.define('settings_about_page', function() { |
| this.methodCalled('getVersionInfo'); |
| return Promise.resolve(this.versionInfo_); |
| }; |
| + |
| + /** @override */ |
|
dschuyler
2016/05/24 20:21:41
Should this have a @return?
dpapad
2016/05/24 21:21:08
Why is this different than any other method that h
|
| + TestAboutPageBrowserProxy.prototype.getRegulatoryInfo = function() { |
| + this.methodCalled('getRegulatoryInfo'); |
| + return Promise.resolve(this.regulatoryInfo_); |
| + }; |
| } |
| @@ -123,7 +146,7 @@ cr.define('settings_about_page', function() { |
| /** @return {!Promise} */ |
| function initNewPage() { |
| - browserProxy.resetResolver('refreshUpdateStatus'); |
| + browserProxy.reset(); |
| PolymerTest.clearBody(); |
| page = document.createElement('settings-about-page'); |
| document.body.appendChild(page); |
| @@ -258,6 +281,39 @@ cr.define('settings_about_page', function() { |
| assertTrue(page.$.relaunchAndPowerwash.hidden); |
| }); |
| }); |
| + |
| + test('RegulatoryInfo', function() { |
| + var regulatoryInfo = null; |
| + |
| + /** |
| + * Checks the visibility of the "regulatory info" section. |
| + * @param {boolean} isShowing Whether the section is expected to be |
| + * visible. |
|
dschuyler
2016/05/24 20:21:41
@return?
dpapad
2016/05/24 21:21:08
Done.
|
| + */ |
| + function checkRegulatoryInfo(isShowing) { |
| + return browserProxy.whenCalled('getRegulatoryInfo').then( |
| + function() { |
| + var regulatoryInfoEl = page.$.regulatoryInfo; |
| + assertTrue(!!regulatoryInfoEl); |
| + assertEquals(isShowing, !regulatoryInfoEl.hidden); |
| + |
| + if (isShowing) { |
| + var img = regulatoryInfoEl.querySelector('img'); |
| + assertTrue(!!img); |
| + assertEquals(regulatoryInfo.text, img.getAttribute('alt')); |
| + assertEquals(regulatoryInfo.url, img.getAttribute('src')); |
| + } |
| + }); |
| + } |
| + |
| + return checkRegulatoryInfo(false).then(function() { |
| + regulatoryInfo = {text: 'foo', url: 'bar'}; |
| + browserProxy.setRegulatoryInfo(regulatoryInfo); |
| + return initNewPage(); |
| + }).then(function() { |
| + return checkRegulatoryInfo(true); |
| + }); |
| + }); |
| } |
| if (!cr.isChromeOS) { |