Chromium Code Reviews| Index: chrome/browser/signin/fake_gaia_cookie_manager_service.cc |
| diff --git a/chrome/browser/signin/fake_gaia_cookie_manager_service.cc b/chrome/browser/signin/fake_gaia_cookie_manager_service.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4741d646c25f79c332825805319a8f924842a3c6 |
| --- /dev/null |
| +++ b/chrome/browser/signin/fake_gaia_cookie_manager_service.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2015 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. |
| + |
| +#include "chrome/browser/signin/fake_gaia_cookie_manager_service.h" |
| + |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/signin/chrome_signin_client_factory.h" |
| +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| +#include "components/signin/core/browser/profile_oauth2_token_service.h" |
| +#include "google_apis/gaia/gaia_constants.h" |
| +#include "google_apis/gaia/gaia_urls.h" |
| + |
| +FakeGaiaCookieManagerService::FakeGaiaCookieManagerService( |
| + OAuth2TokenService* token_service, |
| + const std::string& source, |
| + SigninClient* client) : |
| + GaiaCookieManagerService(token_service, source, client), |
| + url_fetcher_factory_(NULL) { |
| + url_fetcher_factory_.SetFakeResponse( |
| + GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
| + GaiaConstants::kChromeSource), |
| + "[\"f\", []]", |
| + net::HTTP_OK, |
| + net::URLRequestStatus::SUCCESS); |
|
Roger Tawa OOO till Jul 10th
2015/04/15 18:51:05
I think you can wrap lines 20-25 in a static helpe
Mike Lerman
2015/04/16 13:13:46
Discussed offline - adding helper methods to prepa
|
| +} |
| + |
| +// static |
| +KeyedService* FakeGaiaCookieManagerService::Build( |
| + content::BrowserContext* context) { |
| + Profile* profile = Profile::FromBrowserContext(context); |
| + GaiaCookieManagerService* service = new GaiaCookieManagerService( |
| + ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| + GaiaConstants::kChromeSource, |
| + ChromeSigninClientFactory::GetForProfile(profile)); |
| + return service; |
| +} |