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..7827e47cfe30793391ae6e5e9f419d4ac236926b 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(logsUploadEnabled) { |
+ this.methodCalled('startCleanup', logsUploadEnabled); |
+ } |
}; |
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(logsUploadEnabled) { |
+ assertFalse(logsUploadEnabled); |
+ 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); |
proberge
2017/07/05 20:16:29
Does not work here, but works for a similar case:
tommycli
2017/07/06 19:00:13
Hmm nothing immediately stands out to me as wrong
proberge
2017/07/06 21:12:56
That didn't work either. Going to leave a TODO for
tommycli
2017/07/06 21:23:12
Err hmm I'm not super satisfied that we're committ
proberge
2017/07/06 21:25:52
Yeah, it's not great :(
I spent several hours yes
|
+ |
+ return ChromeCleanupProxy.whenCalled('setLogsUploadPermission').then( |
+ function(enabled) { |
+ assertTrue(enabled); |
+ }); |
+ }); |
}); |