| 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 ]); | 22 ]); |
| 22 | 23 |
| 23 /** @private {!Array<string>} */ | 24 /** @private {!Array<string>} */ |
| 24 this.iconUrls_ = []; | 25 this.iconUrls_ = []; |
| 25 | 26 |
| 26 /** @private {!Array<SignedInUser>} */ | 27 /** @private {!Array<SignedInUser>} */ |
| 27 this.signedInUsers_ = []; | 28 this.signedInUsers_ = []; |
| 29 |
| 30 /** @private {!ProfileInfo} */ |
| 31 this.defaultProfileInfo_ = {}; |
| 32 |
| 33 /** @private {!Array<SupervisedUser>} */ |
| 34 this.existingSupervisedUsers_ = []; |
| 28 }; | 35 }; |
| 29 | 36 |
| 30 TestProfileBrowserProxy.prototype = { | 37 TestProfileBrowserProxy.prototype = { |
| 31 __proto__: settings.TestBrowserProxy.prototype, | 38 __proto__: settings.TestBrowserProxy.prototype, |
| 32 | 39 |
| 33 /** | 40 /** |
| 34 * @param {!Array<string>} iconUrls | 41 * @param {!Array<string>} iconUrls |
| 35 */ | 42 */ |
| 36 setIconUrls: function(iconUrls) { | 43 setIconUrls: function(iconUrls) { |
| 37 this.iconUrls_ = iconUrls; | 44 this.iconUrls_ = iconUrls; |
| 38 }, | 45 }, |
| 39 | 46 |
| 40 /** | 47 /** |
| 41 * @param {!Array<SignedInUser>} signedInUsers | 48 * @param {!Array<SignedInUser>} signedInUsers |
| 42 */ | 49 */ |
| 43 setSignedInUsers: function(signedInUsers) { | 50 setSignedInUsers: function(signedInUsers) { |
| 44 this.signedInUsers_ = signedInUsers; | 51 this.signedInUsers_ = signedInUsers; |
| 45 }, | 52 }, |
| 46 | 53 |
| 54 /** |
| 55 * @param {!ProfileInfo} profileInfo |
| 56 */ |
| 57 setDefaultProfileInfo: function(profileInfo) { |
| 58 this.defaultProfileInfo_ = profileInfo; |
| 59 }, |
| 60 |
| 61 /** |
| 62 * @param {!Array<SupervisedUser>} supervisedUsers |
| 63 */ |
| 64 setExistingSupervisedUsers: function(supervisedUsers) { |
| 65 this.existingSupervisedUsers_ = supervisedUsers; |
| 66 }, |
| 67 |
| 47 /** @override */ | 68 /** @override */ |
| 48 getAvailableIcons: function() { | 69 getAvailableIcons: function() { |
| 49 this.methodCalled('getAvailableIcons'); | 70 this.methodCalled('getAvailableIcons'); |
| 50 cr.webUIListenerCallback('profile-icons-received', this.iconUrls_); | 71 cr.webUIListenerCallback('profile-icons-received', this.iconUrls_); |
| 72 cr.webUIListenerCallback('profile-defaults-received', |
| 73 this.defaultProfileInfo_); |
| 51 }, | 74 }, |
| 52 | 75 |
| 53 /** @override */ | 76 /** @override */ |
| 54 getSignedInUsers: function() { | 77 getSignedInUsers: function() { |
| 55 this.methodCalled('getSignedInUsers'); | 78 this.methodCalled('getSignedInUsers'); |
| 56 cr.webUIListenerCallback('signedin-users-received', this.signedInUsers_); | 79 cr.webUIListenerCallback('signedin-users-received', this.signedInUsers_); |
| 57 }, | 80 }, |
| 58 | 81 |
| 59 /** @override */ | 82 /** @override */ |
| 60 cancelCreateProfile: function() { | 83 cancelCreateProfile: function() { |
| 61 /** | 84 /** |
| 62 * Flag used to test whether this method was not called. | 85 * Flag used to test whether this method was not called. |
| 63 * @type {boolean} | 86 * @type {boolean} |
| 64 */ | 87 */ |
| 65 this.cancelCreateProfileCalled = true; | 88 this.cancelCreateProfileCalled = true; |
| 66 this.methodCalled('cancelCreateProfile'); | 89 this.methodCalled('cancelCreateProfile'); |
| 67 }, | 90 }, |
| 68 | 91 |
| 69 /** @override */ | 92 /** @override */ |
| 70 createProfile: function(profileName, profileIconUrl, isSupervised, | 93 createProfile: function(profileName, profileIconUrl, isSupervised, |
| 71 supervisorProfilePath) { | 94 custodianProfilePath) { |
| 72 this.methodCalled('createProfile', | 95 this.methodCalled('createProfile', |
| 73 {profileName: profileName, | 96 {profileName: profileName, |
| 74 profileIconUrl: profileIconUrl, | 97 profileIconUrl: profileIconUrl, |
| 75 isSupervised: isSupervised, | 98 isSupervised: isSupervised, |
| 76 supervisorProfilePath: supervisorProfilePath}); | 99 custodianProfilePath: custodianProfilePath}); |
| 77 }, | 100 }, |
| 78 | 101 |
| 79 /** @override */ | 102 /** @override */ |
| 80 launchGuestUser: function() { | 103 launchGuestUser: function() { |
| 81 this.methodCalled('launchGuestUser'); | 104 this.methodCalled('launchGuestUser'); |
| 82 } | 105 }, |
| 106 |
| 107 /** @override */ |
| 108 getExistingSupervisedUsers: function() { |
| 109 this.methodCalled('getExistingSupervisedUsers'); |
| 110 return Promise.resolve(this.existingSupervisedUsers_); |
| 111 }, |
| 83 }; | 112 }; |
| OLD | NEW |