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

Unified Diff: chrome/test/data/webui/settings/about_page_tests.js

Issue 2006073002: MD Settings: About page, show regulatory info, if available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@about_copyright
Patch Set: Address comment. Created 4 years, 7 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4e50c4f9afa7b895d3cc7c9068718cdf47e936bd 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 */
+ 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,40 @@ 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.
+ * @return {!Promise}
+ */
+ 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) {
« 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