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

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

Issue 2494813002: MD Settings: slight tweaks to when the metrics reporting restart button shows up (Closed)
Patch Set: fixes Created 4 years, 1 month 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/privacy_page/privacy_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/metrics_reporting_tests.js
diff --git a/chrome/test/data/webui/settings/metrics_reporting_tests.js b/chrome/test/data/webui/settings/metrics_reporting_tests.js
index 1c612a7bc5b081f94fcbcd55f3640f87a594f061..2f0e3d5d5a8cb74202a99957f9838ae657aafa74 100644
--- a/chrome/test/data/webui/settings/metrics_reporting_tests.js
+++ b/chrome/test/data/webui/settings/metrics_reporting_tests.js
@@ -21,7 +21,6 @@ suite('metrics reporting', function() {
test('changes to whether metrics reporting is enabled/managed', function() {
return testBrowserProxy.whenCalled('getMetricsReporting').then(function() {
Polymer.dom.flush();
- assertFalse(!!page.$$('#metricsReporting paper-button'));
var checkbox = page.$.metricsReportingCheckbox;
assertEquals(testBrowserProxy.metricsReporting.enabled, checkbox.checked);
@@ -35,8 +34,6 @@ suite('metrics reporting', function() {
cr.webUIListenerCallback('metrics-reporting-change', changedMetrics);
Polymer.dom.flush();
- assertTrue(!!page.$$('#metricsReporting paper-button'));
-
assertEquals(changedMetrics.enabled, checkbox.checked);
indicatorVisible = !!page.$$('#indicator');
assertEquals(changedMetrics.managed, indicatorVisible);
@@ -45,7 +42,52 @@ suite('metrics reporting', function() {
MockInteractions.tap(checkbox);
return testBrowserProxy.whenCalled('setMetricsReportingEnabled', toggled);
- }).then(function() {
+ });
+ });
+
+ test('metrics reporting restart button', function() {
+ return testBrowserProxy.whenCalled('getMetricsReporting').then(function() {
+ Polymer.dom.flush();
+
+ // Restart button should be hidden by default (in any state).
+ assertFalse(!!page.$$('#metricsReporting paper-button'));
+
+ // Simulate toggling via policy.
+ cr.webUIListenerCallback('metrics-reporting-change', {
+ enabled: false,
+ managed: true,
+ });
+ Polymer.dom.flush();
+
+ // No restart button should show because the value is managed.
+ assertFalse(!!page.$$('#metricsReporting paper-button'));
+
+ cr.webUIListenerCallback('metrics-reporting-change', {
+ enabled: true,
+ managed: true,
+ });
+ Polymer.dom.flush();
+
+ // Changes in policy should not show the restart button because the value
+ // is still managed.
+ assertFalse(!!page.$$('#metricsReporting paper-button'));
+
+ // Remove the policy and toggle the value.
+ cr.webUIListenerCallback('metrics-reporting-change', {
+ enabled: false,
+ managed: false,
+ });
+ Polymer.dom.flush();
+
+ // Now the restart button should be showing.
+ assertTrue(!!page.$$('#metricsReporting paper-button'));
+
+ // Receiving the same values should have no effect.
+ cr.webUIListenerCallback('metrics-reporting-change', {
+ enabled: false,
+ managed: false,
+ });
+ Polymer.dom.flush();
assertTrue(!!page.$$('#metricsReporting paper-button'));
});
});
« no previous file with comments | « chrome/browser/resources/settings/privacy_page/privacy_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698