OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_default_browser', function() { | 5 cr.define('settings_default_browser', function() { |
6 /** | 6 /** |
7 * A test version of DefaultBrowserBrowserProxy. Provides helper methods | 7 * A test version of DefaultBrowserBrowserProxy. Provides helper methods |
8 * for allowing tests to know when a method was called, as well as | 8 * for allowing tests to know when a method was called, as well as |
9 * specifying mock responses. | 9 * specifying mock responses. |
10 * | 10 * |
11 * @constructor | 11 * @constructor |
12 * @implements {settings.DefaultBrowserBrowserProxy} | 12 * @implements {settings.DefaultBrowserBrowserProxy} |
13 * @extends {settings.TestBrowserProxy} | 13 * @extends {TestBrowserProxy} |
14 */ | 14 */ |
15 var TestDefaultBrowserBrowserProxy = function() { | 15 var TestDefaultBrowserBrowserProxy = function() { |
16 settings.TestBrowserProxy.call(this, [ | 16 TestBrowserProxy.call(this, [ |
17 'requestDefaultBrowserState', | 17 'requestDefaultBrowserState', |
18 'setAsDefaultBrowser', | 18 'setAsDefaultBrowser', |
19 ]); | 19 ]); |
20 | 20 |
21 /** @private {!DefaultBrowserInfo} */ | 21 /** @private {!DefaultBrowserInfo} */ |
22 this.defaultBrowserInfo_ = { | 22 this.defaultBrowserInfo_ = { |
23 canBeDefault: true, | 23 canBeDefault: true, |
24 isDefault: false, | 24 isDefault: false, |
25 isDisabledByPolicy: false, | 25 isDisabledByPolicy: false, |
26 isUnknownError: false | 26 isUnknownError: false |
27 }; | 27 }; |
28 }; | 28 }; |
29 | 29 |
30 TestDefaultBrowserBrowserProxy.prototype = { | 30 TestDefaultBrowserBrowserProxy.prototype = { |
31 __proto__: settings.TestBrowserProxy.prototype, | 31 __proto__: TestBrowserProxy.prototype, |
32 | 32 |
33 /** @override */ | 33 /** @override */ |
34 requestDefaultBrowserState: function() { | 34 requestDefaultBrowserState: function() { |
35 this.methodCalled('requestDefaultBrowserState'); | 35 this.methodCalled('requestDefaultBrowserState'); |
36 return Promise.resolve(this.defaultBrowserInfo_); | 36 return Promise.resolve(this.defaultBrowserInfo_); |
37 }, | 37 }, |
38 | 38 |
39 /** @override */ | 39 /** @override */ |
40 setAsDefaultBrowser: function() { | 40 setAsDefaultBrowser: function() { |
41 this.methodCalled('setAsDefaultBrowser'); | 41 this.methodCalled('setAsDefaultBrowser'); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 }); | 164 }); |
165 }); | 165 }); |
166 } | 166 } |
167 | 167 |
168 return { | 168 return { |
169 registerTests: function() { | 169 registerTests: function() { |
170 registerDefaultBrowserPageTests(); | 170 registerDefaultBrowserPageTests(); |
171 }, | 171 }, |
172 }; | 172 }; |
173 }); | 173 }); |
OLD | NEW |