OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 void FakeGaiaCookieManagerService::SetListAccountsResponseHttpNotFound() { | 27 void FakeGaiaCookieManagerService::SetListAccountsResponseHttpNotFound() { |
28 DCHECK(url_fetcher_factory_); | 28 DCHECK(url_fetcher_factory_); |
29 url_fetcher_factory_->SetFakeResponse( | 29 url_fetcher_factory_->SetFakeResponse( |
30 GaiaUrls::GetInstance()->ListAccountsURLWithSource( | 30 GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
31 GaiaConstants::kChromeSource), | 31 GaiaConstants::kChromeSource), |
32 "", | 32 "", |
33 net::HTTP_NOT_FOUND, | 33 net::HTTP_NOT_FOUND, |
34 net::URLRequestStatus::SUCCESS); | 34 net::URLRequestStatus::SUCCESS); |
35 } | 35 } |
36 | 36 |
| 37 void FakeGaiaCookieManagerService::SetListAccountsResponseWebLoginRequired() { |
| 38 DCHECK(url_fetcher_factory_); |
| 39 url_fetcher_factory_->SetFakeResponse( |
| 40 GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
| 41 GaiaConstants::kChromeSource), |
| 42 "Info=WebLoginRequired", |
| 43 net::HTTP_OK, |
| 44 net::URLRequestStatus::SUCCESS); |
| 45 } |
| 46 |
37 void FakeGaiaCookieManagerService::SetListAccountsResponseNoAccounts() { | 47 void FakeGaiaCookieManagerService::SetListAccountsResponseNoAccounts() { |
38 DCHECK(url_fetcher_factory_); | 48 DCHECK(url_fetcher_factory_); |
39 url_fetcher_factory_->SetFakeResponse( | 49 url_fetcher_factory_->SetFakeResponse( |
40 GaiaUrls::GetInstance()->ListAccountsURLWithSource( | 50 GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
41 GaiaConstants::kChromeSource), | 51 GaiaConstants::kChromeSource), |
42 "[\"f\", []]", | 52 "[\"f\", []]", |
43 net::HTTP_OK, | 53 net::HTTP_OK, |
44 net::URLRequestStatus::SUCCESS); | 54 net::URLRequestStatus::SUCCESS); |
45 } | 55 } |
46 | 56 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // static | 113 // static |
104 KeyedService* FakeGaiaCookieManagerService::Build( | 114 KeyedService* FakeGaiaCookieManagerService::Build( |
105 content::BrowserContext* context) { | 115 content::BrowserContext* context) { |
106 Profile* profile = Profile::FromBrowserContext(context); | 116 Profile* profile = Profile::FromBrowserContext(context); |
107 FakeGaiaCookieManagerService* service = new FakeGaiaCookieManagerService( | 117 FakeGaiaCookieManagerService* service = new FakeGaiaCookieManagerService( |
108 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 118 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
109 GaiaConstants::kChromeSource, | 119 GaiaConstants::kChromeSource, |
110 ChromeSigninClientFactory::GetForProfile(profile)); | 120 ChromeSigninClientFactory::GetForProfile(profile)); |
111 return service; | 121 return service; |
112 } | 122 } |
OLD | NEW |