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

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

Issue 2583743002: Add mac-only "Set Up Automatic Updates..." button to the new about page. (Closed)
Patch Set: add back nullptr check Created 4 years 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/ui/webui/settings/about_handler.cc ('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 08c8baade359a16ba6aa54a410b5e0898a761675..dfb4a1d8679f6bea187bc627a9010c66e9e9959e 100644
--- a/chrome/test/data/webui/settings/about_page_tests.js
+++ b/chrome/test/data/webui/settings/about_page_tests.js
@@ -24,6 +24,9 @@ cr.define('settings_about_page', function() {
'setChannel');
}
+ if (cr.isMac)
+ methodNames.push('promoteUpdater');
+
settings.TestBrowserProxy.call(this, methodNames);
/** @private {!UpdateStatus} */
@@ -82,6 +85,13 @@ cr.define('settings_about_page', function() {
},
};
+ if (cr.isMac) {
+ /** @override */
+ TestAboutPageBrowserProxy.prototype.promoteUpdater = function() {
+ this.methodCalled('promoteUpdater');
+ };
+ }
+
if (cr.isChromeOS) {
/** @param {!VersionInfo} */
TestAboutPageBrowserProxy.prototype.setVersionInfo = function(versionInfo) {
@@ -557,6 +567,107 @@ cr.define('settings_about_page', function() {
MockInteractions.tap(page.$.reportIssue);
return browserProxy.whenCalled('openFeedbackDialog');
});
+
+ if (cr.isMac) {
+ /**
+ * A list of possible scenarios for the promoteUpdater.
+ * @enum {!PromoteUpdaterStatus}
+ */
+ var PromoStatusScenarios = {
+ CANT_PROMOTE: {
+ hidden: true,
+ disabled: true,
+ actionable: false,
+ },
+ CAN_PROMOTE: {
+ hidden: false,
+ disabled: false,
+ actionable: true,
+ },
+ IN_BETWEEN: {
+ hidden: false,
+ disabled: true,
+ actionable: true,
+ },
+ PROMOTED: {
+ hidden: false,
+ disabled: true,
+ actionable: false,
+ },
+ };
+
+ /**
+ * @param {!PromoteUpdaterStatus} status
+ */
+ function firePromoteUpdaterStatusChanged(status) {
+ cr.webUIListenerCallback('promotion-state-changed', status);
+ }
+
+ /**
+ * Tests that the button's states are wired up to the status correctly.
+ */
+ test('PromoteUpdaterButtonCorrectStates', function() {
+ var item = page.$$('#promoteUpdater');
+ var arrow = page.$$('#promoteUpdater button');
+ assertFalse(!!item);
+ assertFalse(!!arrow);
+
+ firePromoteUpdaterStatusChanged(PromoStatusScenarios.CANT_PROMOTE);
+ Polymer.dom.flush();
+ item = page.$$('#promoteUpdater');
+ arrow = page.$$('#promoteUpdater button');
+ assertFalse(!!item);
+ assertFalse(!!arrow);
+
+ firePromoteUpdaterStatusChanged(PromoStatusScenarios.CAN_PROMOTE);
+ Polymer.dom.flush();
+
+ item = page.$$('#promoteUpdater');
+ assertTrue(!!item);
+ assertFalse(item.hasAttribute('disabled'));
+ assertTrue(item.hasAttribute('actionable'));
+
+ arrow = page.$$('#promoteUpdater button');
+ assertTrue(!!arrow);
+ assertFalse(arrow.hidden);
+ assertFalse(arrow.hasAttribute('disabled'));
+
+ firePromoteUpdaterStatusChanged(PromoStatusScenarios.IN_BETWEEN);
+ Polymer.dom.flush();
+ item = page.$$('#promoteUpdater');
+ assertTrue(!!item);
+ assertTrue(item.hasAttribute('disabled'));
+ assertTrue(item.hasAttribute('actionable'));
+
+ arrow = page.$$('#promoteUpdater button');
+ assertTrue(!!arrow);
+ assertFalse(arrow.hidden);
+ assertTrue(arrow.hasAttribute('disabled'));
+
+ firePromoteUpdaterStatusChanged(PromoStatusScenarios.PROMOTED);
+ Polymer.dom.flush();
+ item = page.$$('#promoteUpdater');
+ assertTrue(!!item);
+ assertTrue(item.hasAttribute('disabled'));
+ assertFalse(item.hasAttribute('actionable'));
+
+ arrow = page.$$('#promoteUpdater button');
+ assertTrue(!!arrow);
+ assertTrue(arrow.hidden);
+ assertTrue(arrow.hasAttribute('disabled'));
+ });
+
+ test('PromoteUpdaterButtonWorksWhenEnabled', function() {
+ firePromoteUpdaterStatusChanged(PromoStatusScenarios.CAN_PROMOTE);
+ Polymer.dom.flush();
+ var item = page.$$('#promoteUpdater');
+ assertTrue(!!item);
+
+ MockInteractions.tap(item);
+
+ return browserProxy.whenCalled('promoteUpdater');
+ });
+ }
});
}
« no previous file with comments | « chrome/browser/ui/webui/settings/about_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698