| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import {AutogeneratedThemeColorInfo, ManageProfilesBrowserProxy, ProfileState} from 'chrome://profile-picker/profile_picker.js'; |
| |
| import {TestBrowserProxy} from '../test_browser_proxy.m.js'; |
| |
| /** @implements {ManageProfilesBrowserProxy} */ |
| export class TestManageProfilesBrowserProxy extends TestBrowserProxy { |
| constructor() { |
| super([ |
| 'initializeMainView', |
| 'launchGuestProfile', |
| 'openManageProfileSettingsSubPage', |
| 'launchSelectedProfile', |
| 'askOnStartupChanged', |
| 'getNewProfileSuggestedThemeInfo', |
| 'getProfileThemeInfo', |
| 'removeProfile', |
| 'getProfileStatistics', |
| 'loadSignInProfileCreationFlow', |
| 'createProfile', |
| 'setProfileName', |
| 'recordSignInPromoImpression', |
| 'getAvailableIcons', |
| ]); |
| |
| /** @type {!AutogeneratedThemeColorInfo} */ |
| this.profileThemeInfo = { |
| colorId: 22, |
| color: -10799479, |
| themeFrameColor: 'rgb(70, 42, 104)', |
| themeShapeColor: 'rgb(109, 65, 161)', |
| themeFrameTextColor: 'rgb(255, 255, 255)', |
| themeGenericAvatar: 'AvatarUrl-22' |
| }; |
| |
| /** @type {!ProfileState} */ |
| this.profileSample = { |
| profilePath: 'profile1', |
| localProfileName: 'Work', |
| needsSignin: false, |
| isSyncing: true, |
| gaiaName: 'Alice', |
| userName: 'Alice@gmail.com', |
| isManaged: false, |
| avatarIcon: 'url', |
| }; |
| } |
| |
| /** @param {!AutogeneratedThemeColorInfo} profileThemeInfo */ |
| setProfileThemeInfo(profileThemeInfo) { |
| this.profileThemeInfo = profileThemeInfo; |
| } |
| |
| /** @override */ |
| initializeMainView() { |
| this.methodCalled('initializeMainView'); |
| } |
| |
| /** @override */ |
| launchGuestProfile() { |
| this.methodCalled('launchGuestProfile'); |
| } |
| |
| /** @override */ |
| openManageProfileSettingsSubPage(profilePath) { |
| this.methodCalled('openManageProfileSettingsSubPage', profilePath); |
| } |
| |
| /** @override */ |
| launchSelectedProfile(profilePath) { |
| this.methodCalled('launchSelectedProfile', profilePath); |
| } |
| |
| /** @override */ |
| askOnStartupChanged(shouldShow) { |
| this.methodCalled('askOnStartupChanged', shouldShow); |
| } |
| |
| /** @override */ |
| getNewProfileSuggestedThemeInfo() { |
| this.methodCalled('getNewProfileSuggestedThemeInfo'); |
| return Promise.resolve(this.profileThemeInfo); |
| } |
| |
| /** @override */ |
| getProfileThemeInfo(theme) { |
| this.methodCalled('getProfileThemeInfo'); |
| return Promise.resolve(this.profileThemeInfo); |
| } |
| |
| /** @override */ |
| removeProfile(profilePath) { |
| this.methodCalled('removeProfile', profilePath); |
| } |
| |
| /** @override */ |
| getProfileStatistics(profilePath) { |
| this.methodCalled('getProfileStatistics', profilePath); |
| } |
| |
| /** @override */ |
| loadSignInProfileCreationFlow(profileColor) { |
| this.methodCalled('loadSignInProfileCreationFlow', profileColor); |
| } |
| |
| /** @override */ |
| createProfile(profileName, profileColor, avatarIndex, createShortcut) { |
| this.methodCalled( |
| 'createProfile', |
| [profileName, profileColor, avatarIndex, createShortcut]); |
| } |
| |
| /** @override */ |
| setProfileName(profilePath, profileName) { |
| this.methodCalled('setProfileName', [profilePath, profileName]); |
| } |
| |
| /** @override */ |
| recordSignInPromoImpression() { |
| this.methodCalled('recordSignInPromoImpression'); |
| } |
| |
| /** @override */ |
| getAvailableIcons() { |
| this.methodCalled('getAvailableIcons'); |
| return Promise.resolve([ |
| {url: 'fake-icon-1.png', label: 'fake-icon-1', index: 1, selected: false}, |
| {url: 'fake-icon-2.png', label: 'fake-icon-2', index: 2, selected: false}, |
| {url: 'fake-icon-3.png', label: 'fake-icon-3', index: 3, selected: false}, |
| ]); |
| } |
| } |