Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / signin / fake_account_fetcher_service.cc
blob484fc86f7a805de37d3eb101fff9191cff3d49b8
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
3 // found in the LICENSE file.
5 #include "chrome/browser/signin/fake_account_fetcher_service.h"
7 #include "base/values.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/account_tracker_service_factory.h"
10 #include "chrome/browser/signin/chrome_signin_client_factory.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "components/signin/core/browser/account_tracker_service.h"
13 #include "components/signin/core/browser/profile_oauth2_token_service.h"
15 // static
16 scoped_ptr<KeyedService> FakeAccountFetcherService::BuildForTests(
17 content::BrowserContext* context) {
18 Profile* profile = Profile::FromBrowserContext(context);
19 FakeAccountFetcherService* service = new FakeAccountFetcherService();
20 service->Initialize(ChromeSigninClientFactory::GetForProfile(profile),
21 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
22 AccountTrackerServiceFactory::GetForProfile(profile),
23 nullptr);
24 return scoped_ptr<KeyedService>(service);
27 FakeAccountFetcherService::FakeAccountFetcherService() {}
29 FakeAccountFetcherService::~FakeAccountFetcherService() {}
31 void FakeAccountFetcherService::StartFetchingUserInfo(
32 const std::string& account_id) {
33 // In tests, don't do actual network fetch.
36 void FakeAccountFetcherService::StartFetchingChildInfo(
37 const std::string& account_id) {
38 // In tests, don't do actual network fetch.
41 void FakeAccountFetcherService::FakeUserInfoFetchSuccess(
42 const std::string& email,
43 const std::string& gaia,
44 const std::string& hosted_domain,
45 const std::string& full_name,
46 const std::string& given_name,
47 const std::string& locale,
48 const std::string& picture_url) {
49 base::DictionaryValue user_info;
50 user_info.SetString("id", gaia);
51 user_info.SetString("email", email);
52 user_info.SetString("hd", hosted_domain);
53 user_info.SetString("name", full_name);
54 user_info.SetString("given_name", given_name);
55 user_info.SetString("locale", locale);
56 user_info.SetString("picture", picture_url);
57 account_tracker_service()->SetAccountStateFromUserInfo(
58 account_tracker_service()->PickAccountIdForAccount(gaia, email),
59 &user_info);
62 void FakeAccountFetcherService::SendRefreshTokenAnnotationRequest(
63 const std::string& account_id) {
64 // In tests, don't do actual network fetch.