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 /** | 5 /** |
6 * The mock signin.ProfileBrowserProxy. | 6 * The mock signin.ProfileBrowserProxy. |
7 * | 7 * |
8 * @constructor | 8 * @constructor |
9 * @implements {signin.ProfileBrowserProxy} | 9 * @implements {signin.ProfileBrowserProxy} |
10 * @extends {settings.TestBrowserProxy} | 10 * @extends {settings.TestBrowserProxy} |
11 */ | 11 */ |
12 var TestProfileBrowserProxy = function() { | 12 var TestProfileBrowserProxy = function() { |
13 settings.TestBrowserProxy.call(this, [ | 13 settings.TestBrowserProxy.call(this, [ |
14 'getAvailableIcons', | 14 'getAvailableIcons', |
15 'getSignedInUsers', | 15 'getSignedInUsers', |
16 'launchGuestUser', | 16 'launchGuestUser', |
17 'createProfile', | 17 'createProfile', |
18 'cancelCreateProfile', | 18 'cancelCreateProfile', |
19 'initializeUserManager', | 19 'initializeUserManager', |
20 'launchUser', | 20 'launchUser', |
21 'getExistingSupervisedUsers', | 21 'getExistingSupervisedUsers', |
22 'isAtLeastOneProfileUnlocked', | |
dpapad
2016/05/31 22:07:41
After latest changes to the previous CL this shoul
Moe
2016/05/31 22:47:39
Done.
| |
22 ]); | 23 ]); |
23 | 24 |
24 /** @private {!Array<string>} */ | 25 /** @private {!Array<string>} */ |
25 this.iconUrls_ = []; | 26 this.iconUrls_ = []; |
26 | 27 |
27 /** @private {!Array<SignedInUser>} */ | 28 /** @private {!Array<SignedInUser>} */ |
28 this.signedInUsers_ = []; | 29 this.signedInUsers_ = []; |
29 | 30 |
30 /** @private {!ProfileInfo} */ | 31 /** @private {!ProfileInfo} */ |
31 this.defaultProfileInfo_ = {}; | 32 this.defaultProfileInfo_ = {}; |
32 | 33 |
33 /** @private {!Array<SupervisedUser>} */ | 34 /** @private {!Array<SupervisedUser>} */ |
34 this.existingSupervisedUsers_ = []; | 35 this.existingSupervisedUsers_ = []; |
36 | |
37 /** @private {boolean} */ | |
38 this.atLeastOneProfileUnlocked_ = true; | |
35 }; | 39 }; |
36 | 40 |
37 TestProfileBrowserProxy.prototype = { | 41 TestProfileBrowserProxy.prototype = { |
38 __proto__: settings.TestBrowserProxy.prototype, | 42 __proto__: settings.TestBrowserProxy.prototype, |
39 | 43 |
40 /** | 44 /** |
41 * @param {!Array<string>} iconUrls | 45 * @param {!Array<string>} iconUrls |
42 */ | 46 */ |
43 setIconUrls: function(iconUrls) { | 47 setIconUrls: function(iconUrls) { |
44 this.iconUrls_ = iconUrls; | 48 this.iconUrls_ = iconUrls; |
(...skipping 13 matching lines...) Expand all Loading... | |
58 this.defaultProfileInfo_ = profileInfo; | 62 this.defaultProfileInfo_ = profileInfo; |
59 }, | 63 }, |
60 | 64 |
61 /** | 65 /** |
62 * @param {!Array<SupervisedUser>} supervisedUsers | 66 * @param {!Array<SupervisedUser>} supervisedUsers |
63 */ | 67 */ |
64 setExistingSupervisedUsers: function(supervisedUsers) { | 68 setExistingSupervisedUsers: function(supervisedUsers) { |
65 this.existingSupervisedUsers_ = supervisedUsers; | 69 this.existingSupervisedUsers_ = supervisedUsers; |
66 }, | 70 }, |
67 | 71 |
72 setAtLeastOneProfileUnlocked_: function(atLeastOneProfileUnlocked) { | |
dpapad
2016/05/31 22:07:41
This is called by other classes, should be made pu
Moe
2016/05/31 22:47:39
Done.
| |
73 this.atLeastOneProfileUnlocked_ = atLeastOneProfileUnlocked; | |
74 }, | |
75 | |
68 /** @override */ | 76 /** @override */ |
69 getAvailableIcons: function() { | 77 getAvailableIcons: function() { |
70 this.methodCalled('getAvailableIcons'); | 78 this.methodCalled('getAvailableIcons'); |
71 cr.webUIListenerCallback('profile-icons-received', this.iconUrls_); | 79 cr.webUIListenerCallback('profile-icons-received', this.iconUrls_); |
72 cr.webUIListenerCallback('profile-defaults-received', | 80 cr.webUIListenerCallback('profile-defaults-received', |
73 this.defaultProfileInfo_); | 81 this.defaultProfileInfo_); |
74 }, | 82 }, |
75 | 83 |
76 /** @override */ | 84 /** @override */ |
77 getSignedInUsers: function() { | 85 getSignedInUsers: function() { |
(...skipping 25 matching lines...) Expand all Loading... | |
103 /** @override */ | 111 /** @override */ |
104 launchGuestUser: function() { | 112 launchGuestUser: function() { |
105 this.methodCalled('launchGuestUser'); | 113 this.methodCalled('launchGuestUser'); |
106 }, | 114 }, |
107 | 115 |
108 /** @override */ | 116 /** @override */ |
109 getExistingSupervisedUsers: function() { | 117 getExistingSupervisedUsers: function() { |
110 this.methodCalled('getExistingSupervisedUsers'); | 118 this.methodCalled('getExistingSupervisedUsers'); |
111 return Promise.resolve(this.existingSupervisedUsers_); | 119 return Promise.resolve(this.existingSupervisedUsers_); |
112 }, | 120 }, |
121 | |
122 /** @override */ | |
123 isAtLeastOneProfileUnlocked: function() { | |
124 this.methodCalled('isAtLeastOneProfileUnlocked'); | |
125 return this.atLeastOneProfileUnlocked_ ? Promise.resolve() : | |
126 Promise.reject(); | |
dpapad
2016/05/31 22:07:41
After your latest changes to the other CL, this sh
Moe
2016/05/31 22:47:39
Done.
| |
127 }, | |
113 }; | 128 }; |
OLD | NEW |