| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('settings_reset_page', function() { | 5 cr.define('settings_reset_page', function() { |
| 6 /** @enum {string} */ | 6 /** @enum {string} */ |
| 7 var TestNames = { | 7 var TestNames = { |
| 8 PowerwashDialogAction: 'PowerwashDialogAction', | 8 PowerwashDialogAction: 'PowerwashDialogAction', |
| 9 PowerwashDialogOpenClose: 'PowerwashDialogOpenClose', | 9 PowerwashDialogOpenClose: 'PowerwashDialogOpenClose', |
| 10 ResetBannerClose: 'ResetBannerClose', | 10 ResetBannerClose: 'ResetBannerClose', |
| 11 ResetBannerReset: 'ResetBannerReset', | 11 ResetBannerReset: 'ResetBannerReset', |
| 12 ResetProfileDialogAction: 'ResetProfileDialogAction', | 12 ResetProfileDialogAction: 'ResetProfileDialogAction', |
| 13 ResetProfileDialogOpenClose: 'ResetProfileDialogOpenClose', | 13 ResetProfileDialogOpenClose: 'ResetProfileDialogOpenClose', |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * @constructor | 17 * @constructor |
| 18 * @implements {settings.ResetBrowserProxy} | 18 * @implements {settings.ResetBrowserProxy} |
| 19 * @extends {settings.TestBrowserProxy} | 19 * @extends {settings.TestBrowserProxy} |
| 20 */ | 20 */ |
| 21 var TestResetBrowserProxy = function() { | 21 var TestResetBrowserProxy = function() { |
| 22 settings.TestBrowserProxy.call(this, [ | 22 settings.TestBrowserProxy.call(this, [ |
| 23 'performResetProfileSettings', | 23 'performResetProfileSettings', |
| 24 'onHideResetProfileDialog', | 24 'onHideResetProfileDialog', |
| 25 'onHideResetProfileBanner', | 25 'onHideResetProfileBanner', |
| 26 'onShowResetProfileDialog', | 26 'onShowResetProfileDialog', |
| 27 'getReportedSettings', |
| 27 'onPowerwashDialogShow', | 28 'onPowerwashDialogShow', |
| 28 'requestFactoryResetRestart', | 29 'requestFactoryResetRestart', |
| 29 ]); | 30 ]); |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 TestResetBrowserProxy.prototype = { | 33 TestResetBrowserProxy.prototype = { |
| 33 __proto__: settings.TestBrowserProxy.prototype, | 34 __proto__: settings.TestBrowserProxy.prototype, |
| 34 | 35 |
| 35 /** @override */ | 36 /** @override */ |
| 36 performResetProfileSettings: function(sendSettings) { | 37 performResetProfileSettings: function(sendSettings) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 onHideResetProfileBanner: function() { | 48 onHideResetProfileBanner: function() { |
| 48 this.methodCalled('onHideResetProfileBanner'); | 49 this.methodCalled('onHideResetProfileBanner'); |
| 49 }, | 50 }, |
| 50 | 51 |
| 51 /** @override */ | 52 /** @override */ |
| 52 onShowResetProfileDialog: function() { | 53 onShowResetProfileDialog: function() { |
| 53 this.methodCalled('onShowResetProfileDialog'); | 54 this.methodCalled('onShowResetProfileDialog'); |
| 54 }, | 55 }, |
| 55 | 56 |
| 56 /** @override */ | 57 /** @override */ |
| 58 getReportedSettings: function() { |
| 59 this.methodCalled('getReportedSettings'); |
| 60 return Promise.resolve([]); |
| 61 }, |
| 62 |
| 63 /** @override */ |
| 57 onPowerwashDialogShow: function() { | 64 onPowerwashDialogShow: function() { |
| 58 this.methodCalled('onPowerwashDialogShow'); | 65 this.methodCalled('onPowerwashDialogShow'); |
| 59 }, | 66 }, |
| 60 | 67 |
| 61 /** @override */ | 68 /** @override */ |
| 62 requestFactoryResetRestart: function() { | 69 requestFactoryResetRestart: function() { |
| 63 this.methodCalled('requestFactoryResetRestart'); | 70 this.methodCalled('requestFactoryResetRestart'); |
| 64 }, | 71 }, |
| 65 }; | 72 }; |
| 66 | 73 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 ]); | 184 ]); |
| 178 }); | 185 }); |
| 179 | 186 |
| 180 // Tests that when user request to reset the profile the appropriate | 187 // Tests that when user request to reset the profile the appropriate |
| 181 // message is sent to the browser. | 188 // message is sent to the browser. |
| 182 test(TestNames.ResetProfileDialogAction, function() { | 189 test(TestNames.ResetProfileDialogAction, function() { |
| 183 // Open reset profile dialog. | 190 // Open reset profile dialog. |
| 184 MockInteractions.tap(resetPage.$.resetProfile); | 191 MockInteractions.tap(resetPage.$.resetProfile); |
| 185 var dialog = resetPage.$$('settings-reset-profile-dialog'); | 192 var dialog = resetPage.$$('settings-reset-profile-dialog'); |
| 186 assertTrue(!!dialog); | 193 assertTrue(!!dialog); |
| 187 MockInteractions.tap(dialog.$.reset); | 194 |
| 188 return browserProxy.whenCalled('performResetProfileSettings'); | 195 var showReportedSettingsButton = dialog.$$('iron-icon'); |
| 196 assertTrue(!!showReportedSettingsButton); |
| 197 MockInteractions.tap(showReportedSettingsButton); |
| 198 |
| 199 return browserProxy.whenCalled('getReportedSettings').then(function() { |
| 200 MockInteractions.tap(dialog.$.reset); |
| 201 return browserProxy.whenCalled('performResetProfileSettings'); |
| 202 }); |
| 189 }); | 203 }); |
| 190 | 204 |
| 191 if (cr.isChromeOS) { | 205 if (cr.isChromeOS) { |
| 192 /** | 206 /** |
| 193 * @param {function(SettingsPowerwashDialogElemeent):!Element} | 207 * @param {function(SettingsPowerwashDialogElemeent):!Element} |
| 194 * closeButtonFn A function that returns the button to be used for | 208 * closeButtonFn A function that returns the button to be used for |
| 195 * closing the dialog. | 209 * closing the dialog. |
| 196 * @return {!Promise} | 210 * @return {!Promise} |
| 197 */ | 211 */ |
| 198 function testOpenClosePowerwashDialog(closeButtonFn) { | 212 function testOpenClosePowerwashDialog(closeButtonFn) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 }); | 253 }); |
| 240 } | 254 } |
| 241 | 255 |
| 242 return { | 256 return { |
| 243 registerTests: function() { | 257 registerTests: function() { |
| 244 registerBannerTests(); | 258 registerBannerTests(); |
| 245 registerDialogTests(); | 259 registerDialogTests(); |
| 246 }, | 260 }, |
| 247 }; | 261 }; |
| 248 }); | 262 }); |
| OLD | NEW |