Chromium Code Reviews| Index: chrome/test/data/webui/settings/chrome_cleanup_page_test.js |
| diff --git a/chrome/test/data/webui/settings/chrome_cleanup_page_test.js b/chrome/test/data/webui/settings/chrome_cleanup_page_test.js |
| index 9af4c293c1546769c4ce878962d52b84baef971f..967e9c1c1bafd03174ae35c8a797525967fe9aab 100644 |
| --- a/chrome/test/data/webui/settings/chrome_cleanup_page_test.js |
| +++ b/chrome/test/data/webui/settings/chrome_cleanup_page_test.js |
| @@ -12,6 +12,7 @@ var TestChromeCleanupProxy = function() { |
| 'dismissCleanupPage', |
| 'registerChromeCleanerObserver', |
| 'restartComputer', |
| + 'setLogsUploadPermission', |
| 'startCleanup', |
| ]); |
| }; |
| @@ -35,9 +36,14 @@ TestChromeCleanupProxy.prototype = { |
| }, |
| /** @override */ |
| - startCleanup: function() { |
| - this.methodCalled('startCleanup'); |
| + setLogsUploadPermission: function(enabled) { |
| + this.methodCalled('setLogsUploadPermission', enabled); |
| }, |
| + |
| + /** @override */ |
| + startCleanup: function(logs_upload_enabled) { |
| + this.methodCalled('startCleanup', logs_upload_enabled); |
| + } |
| }; |
| var chromeCleanupPage = null; |
| @@ -61,6 +67,7 @@ suite('ChromeCleanupHandler', function() { |
| }); |
| test('startCleanupFromInfected', function() { |
| + cr.webUIListenerCallback('chrome-cleanup-upload-permission-change', false); |
| cr.webUIListenerCallback( |
| 'chrome-cleanup-on-infected', ['file 1', 'file 2', 'file 3']); |
| Polymer.dom.flush(); |
| @@ -75,13 +82,15 @@ suite('ChromeCleanupHandler', function() { |
| var actionButton = chromeCleanupPage.$$('#action-button'); |
| assertTrue(!!actionButton); |
| MockInteractions.tap(actionButton); |
| - ChromeCleanupProxy.whenCalled('startCleanup').then(function() { |
| - cr.webUIListenerCallback('chrome-cleanup-on-cleaning', false); |
| - Polymer.dom.flush(); |
| - |
| - var spinner = chromeCleanupPage.$$('#cleaning-spinner'); |
| - assertTrue(spinner.active); |
| - }) |
| + ChromeCleanupProxy.whenCalled('startCleanup').then( |
| + function(logs_upload_enabled) { |
|
ftirelo
2017/07/05 19:02:26
logsUploadEnabled?
proberge
2017/07/05 20:14:21
Done.
|
| + assertFalse(logs_upload_enabled); |
| + cr.webUIListenerCallback('chrome-cleanup-on-cleaning', false); |
| + Polymer.dom.flush(); |
| + |
| + var spinner = chromeCleanupPage.$$('#cleaning-spinner'); |
| + assertTrue(spinner.active); |
| + }) |
| }); |
| test('rebootFromRebootRequired', function() { |
| @@ -119,4 +128,32 @@ suite('ChromeCleanupHandler', function() { |
| MockInteractions.tap(actionButton); |
| return ChromeCleanupProxy.whenCalled('dismissCleanupPage'); |
| }); |
| + |
| + test('setLogsUploadPermission', function() { |
| + cr.webUIListenerCallback( |
| + 'chrome-cleanup-on-infected', ['file 1', 'file 2', 'file 3']); |
| + Polymer.dom.flush(); |
| + |
| + var control = chromeCleanupPage.$$('#logsUploadControl'); |
| + assertTrue(!!control); |
| + |
| + cr.webUIListenerCallback('chrome-cleanup-upload-permission-change', true); |
| + Polymer.dom.flush(); |
| + assertTrue(control.checked); |
| + |
| + cr.webUIListenerCallback('chrome-cleanup-upload-permission-change', false); |
| + Polymer.dom.flush(); |
| + assertFalse(control.checked); |
| + |
| + // TODO(proberge): This tap doesn't seem to do anything and the test hangs |
| + // on the whenCalled below. |
| + // Manually clicking on the control if pixel-output is enabled resolves the |
| + // whenCalled and successfully completes the test. |
| + MockInteractions.tap(control); |
| + |
| + return ChromeCleanupProxy.whenCalled('setLogsUploadPermission').then( |
| + function(enabled) { |
| + assertTrue(enabled); |
| + }); |
| + }); |
| }); |