Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/browser/signin/fake_gaia_cookie_manager_service.cc

Issue 1166373006: Prefer to use the AccountID to the Email from ListAccounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/signin/fake_gaia_cookie_manager_service.h" 5 #include "chrome/browser/signin/fake_gaia_cookie_manager_service.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/chrome_signin_client_factory.h" 9 #include "chrome/browser/signin/chrome_signin_client_factory.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DCHECK(url_fetcher_factory_); 48 DCHECK(url_fetcher_factory_);
49 url_fetcher_factory_->SetFakeResponse( 49 url_fetcher_factory_->SetFakeResponse(
50 GaiaUrls::GetInstance()->ListAccountsURLWithSource( 50 GaiaUrls::GetInstance()->ListAccountsURLWithSource(
51 GaiaConstants::kChromeSource), 51 GaiaConstants::kChromeSource),
52 "[\"f\", []]", 52 "[\"f\", []]",
53 net::HTTP_OK, 53 net::HTTP_OK,
54 net::URLRequestStatus::SUCCESS); 54 net::URLRequestStatus::SUCCESS);
55 } 55 }
56 56
57 void FakeGaiaCookieManagerService::SetListAccountsResponseOneAccount( 57 void FakeGaiaCookieManagerService::SetListAccountsResponseOneAccount(
58 const char* account) { 58 const char* email, const char* gaia_id) {
59 DCHECK(url_fetcher_factory_); 59 DCHECK(url_fetcher_factory_);
60 url_fetcher_factory_->SetFakeResponse( 60 url_fetcher_factory_->SetFakeResponse(
61 GaiaUrls::GetInstance()->ListAccountsURLWithSource( 61 GaiaUrls::GetInstance()->ListAccountsURLWithSource(
62 GaiaConstants::kChromeSource), 62 GaiaConstants::kChromeSource),
63 base::StringPrintf( 63 base::StringPrintf(
64 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"22\"]]]", 64 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"%s\"]]]",
65 account), 65 email, gaia_id),
66 net::HTTP_OK, 66 net::HTTP_OK,
67 net::URLRequestStatus::SUCCESS); 67 net::URLRequestStatus::SUCCESS);
68 } 68 }
69 69
70 void FakeGaiaCookieManagerService::SetListAccountsResponseOneAccountWithExpiry( 70 void FakeGaiaCookieManagerService::SetListAccountsResponseOneAccountWithExpiry(
71 const char* account, bool expired) { 71 const char* email, const char* gaia_id, bool expired) {
72 DCHECK(url_fetcher_factory_); 72 DCHECK(url_fetcher_factory_);
73 url_fetcher_factory_->SetFakeResponse( 73 url_fetcher_factory_->SetFakeResponse(
74 GaiaUrls::GetInstance()->ListAccountsURLWithSource( 74 GaiaUrls::GetInstance()->ListAccountsURLWithSource(
75 GaiaConstants::kChromeSource), 75 GaiaConstants::kChromeSource),
76 base::StringPrintf( 76 base::StringPrintf(
77 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, %d, \"22\"]]]", 77 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, %d, \"%s\"]]]",
78 account, expired ? 0 : 1), 78 email, expired ? 0 : 1, gaia_id),
79 net::HTTP_OK, 79 net::HTTP_OK,
80 net::URLRequestStatus::SUCCESS); 80 net::URLRequestStatus::SUCCESS);
81 } 81 }
82 82
83 void FakeGaiaCookieManagerService::SetListAccountsResponseTwoAccounts( 83 void FakeGaiaCookieManagerService::SetListAccountsResponseTwoAccounts(
84 const char* account1, const char* account2) { 84 const char* email1, const char* gaia_id1,
85 const char* email2, const char* gaia_id2) {
85 DCHECK(url_fetcher_factory_); 86 DCHECK(url_fetcher_factory_);
86 url_fetcher_factory_->SetFakeResponse( 87 url_fetcher_factory_->SetFakeResponse(
87 GaiaUrls::GetInstance()->ListAccountsURLWithSource( 88 GaiaUrls::GetInstance()->ListAccountsURLWithSource(
88 GaiaConstants::kChromeSource), 89 GaiaConstants::kChromeSource),
89 base::StringPrintf( 90 base::StringPrintf(
90 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"22\"], " 91 "[\"f\", [[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"%s\"], "
91 "[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"24\"]]]", 92 "[\"b\", 0, \"n\", \"%s\", \"p\", 0, 0, 0, 0, 1, \"%s\"]]]",
92 account1, account2), 93 email1, gaia_id1, email2, gaia_id2),
93 net::HTTP_OK, 94 net::HTTP_OK,
94 net::URLRequestStatus::SUCCESS); 95 net::URLRequestStatus::SUCCESS);
95 } 96 }
96 97
97 void FakeGaiaCookieManagerService::SetListAccountsResponseTwoAccountsWithExpiry( 98 void FakeGaiaCookieManagerService::SetListAccountsResponseTwoAccountsWithExpiry(
98 const char* account1, bool account1_expired, 99 const char* account1, bool account1_expired,
99 const char* account2, bool account2_expired) { 100 const char* account2, bool account2_expired) {
100 DCHECK(url_fetcher_factory_); 101 DCHECK(url_fetcher_factory_);
101 url_fetcher_factory_->SetFakeResponse( 102 url_fetcher_factory_->SetFakeResponse(
102 GaiaUrls::GetInstance()->ListAccountsURLWithSource( 103 GaiaUrls::GetInstance()->ListAccountsURLWithSource(
(...skipping 10 matching lines...) Expand all
113 // static 114 // static
114 KeyedService* FakeGaiaCookieManagerService::Build( 115 KeyedService* FakeGaiaCookieManagerService::Build(
115 content::BrowserContext* context) { 116 content::BrowserContext* context) {
116 Profile* profile = Profile::FromBrowserContext(context); 117 Profile* profile = Profile::FromBrowserContext(context);
117 FakeGaiaCookieManagerService* service = new FakeGaiaCookieManagerService( 118 FakeGaiaCookieManagerService* service = new FakeGaiaCookieManagerService(
118 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 119 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
119 GaiaConstants::kChromeSource, 120 GaiaConstants::kChromeSource,
120 ChromeSigninClientFactory::GetForProfile(profile)); 121 ChromeSigninClientFactory::GetForProfile(profile));
121 return service; 122 return service;
122 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698