1 // Copyright 2014 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 "base/logging.h"
6 #include "components/signin/core/browser/test_signin_client.h"
7 #include "components/signin/core/browser/webdata/token_service_table.h"
8 #include "components/webdata/common/web_data_service_base.h"
9 #include "components/webdata/common/web_database_service.h"
10 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h"
16 TestSigninClient::TestSigninClient()
17 : request_context_(new net::TestURLRequestContextGetter(
18 base::MessageLoopProxy::current())) {
22 TestSigninClient::~TestSigninClient() {}
24 PrefService* TestSigninClient::GetPrefs() { return NULL; }
26 scoped_refptr<TokenWebData> TestSigninClient::GetDatabase() {
30 bool TestSigninClient::CanRevokeCredentials() { return true; }
32 net::URLRequestContextGetter* TestSigninClient::GetURLRequestContext() {
33 return request_context_;
36 std::string TestSigninClient::GetProductVersion() { return ""; }
38 void TestSigninClient::LoadDatabase() {
39 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
40 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB");
41 scoped_refptr<WebDatabaseService> web_database =
42 new WebDatabaseService(path,
43 base::MessageLoopProxy::current(),
44 base::MessageLoopProxy::current());
45 web_database->AddTable(scoped_ptr<WebDatabaseTable>(new TokenServiceTable()));
46 web_database->LoadDatabase();
47 database_ = new TokenWebData(web_database,
48 base::MessageLoopProxy::current(),
49 base::MessageLoopProxy::current(),
50 WebDataServiceBase::ProfileErrorCallback());
54 bool TestSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() {
58 void TestSigninClient::SetCookieChangedCallback(
59 const CookieChangedCallback& callback) {}
62 ios::ProfileOAuth2TokenServiceIOSProvider* TestSigninClient::GetIOSProvider() {
63 return GetIOSProviderAsFake();
66 ios::FakeProfileOAuth2TokenServiceIOSProvider*
67 TestSigninClient::GetIOSProviderAsFake() {
69 iosProvider_.reset(new ios::FakeProfileOAuth2TokenServiceIOSProvider());
71 return iosProvider_.get();