| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "components/signin/core/browser/test_signin_client.h" | 5 #include "components/signin/core/browser/test_signin_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/thread_task_runner_handle.h" |
| 8 #include "components/signin/core/browser/webdata/token_service_table.h" | 9 #include "components/signin/core/browser/webdata/token_service_table.h" |
| 9 #include "components/webdata/common/web_data_service_base.h" | 10 #include "components/webdata/common/web_data_service_base.h" |
| 10 #include "components/webdata/common/web_database_service.h" | 11 #include "components/webdata/common/web_database_service.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 #if defined(OS_IOS) | 14 #if defined(OS_IOS) |
| 14 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" | 15 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 TestSigninClient::TestSigninClient() | 18 TestSigninClient::TestSigninClient() |
| 18 : request_context_(new net::TestURLRequestContextGetter( | 19 : request_context_(new net::TestURLRequestContextGetter( |
| 19 base::MessageLoopProxy::current())), | 20 base::ThreadTaskRunnerHandle::Get())), |
| 20 pref_service_(NULL), | 21 pref_service_(NULL), |
| 21 are_signin_cookies_allowed_(true) { | 22 are_signin_cookies_allowed_(true) { |
| 22 LoadDatabase(); | 23 LoadDatabase(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 TestSigninClient::TestSigninClient(PrefService* pref_service) | 26 TestSigninClient::TestSigninClient(PrefService* pref_service) |
| 26 : pref_service_(pref_service), | 27 : pref_service_(pref_service), |
| 27 are_signin_cookies_allowed_(true) {} | 28 are_signin_cookies_allowed_(true) {} |
| 28 | 29 |
| 29 TestSigninClient::~TestSigninClient() {} | 30 TestSigninClient::~TestSigninClient() {} |
| (...skipping 28 matching lines...) Expand all Loading... |
| 58 net::URLRequestContextGetter* request_context) { | 59 net::URLRequestContextGetter* request_context) { |
| 59 request_context_ = request_context; | 60 request_context_ = request_context; |
| 60 } | 61 } |
| 61 | 62 |
| 62 std::string TestSigninClient::GetProductVersion() { return ""; } | 63 std::string TestSigninClient::GetProductVersion() { return ""; } |
| 63 | 64 |
| 64 void TestSigninClient::LoadDatabase() { | 65 void TestSigninClient::LoadDatabase() { |
| 65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 66 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 66 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); | 67 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); |
| 67 scoped_refptr<WebDatabaseService> web_database = | 68 scoped_refptr<WebDatabaseService> web_database = |
| 68 new WebDatabaseService(path, | 69 new WebDatabaseService(path, base::ThreadTaskRunnerHandle::Get(), |
| 69 base::MessageLoopProxy::current(), | 70 base::ThreadTaskRunnerHandle::Get()); |
| 70 base::MessageLoopProxy::current()); | |
| 71 web_database->AddTable(scoped_ptr<WebDatabaseTable>(new TokenServiceTable())); | 71 web_database->AddTable(scoped_ptr<WebDatabaseTable>(new TokenServiceTable())); |
| 72 web_database->LoadDatabase(); | 72 web_database->LoadDatabase(); |
| 73 database_ = new TokenWebData(web_database, | 73 database_ = |
| 74 base::MessageLoopProxy::current(), | 74 new TokenWebData(web_database, base::ThreadTaskRunnerHandle::Get(), |
| 75 base::MessageLoopProxy::current(), | 75 base::ThreadTaskRunnerHandle::Get(), |
| 76 WebDataServiceBase::ProfileErrorCallback()); | 76 WebDataServiceBase::ProfileErrorCallback()); |
| 77 database_->Init(); | 77 database_->Init(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool TestSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { | 80 bool TestSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 scoped_ptr<SigninClient::CookieChangedSubscription> | 84 scoped_ptr<SigninClient::CookieChangedSubscription> |
| 85 TestSigninClient::AddCookieChangedCallback( | 85 TestSigninClient::AddCookieChangedCallback( |
| 86 const GURL& url, | 86 const GURL& url, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 content_settings::Observer* observer) { | 125 content_settings::Observer* observer) { |
| 126 } | 126 } |
| 127 | 127 |
| 128 void TestSigninClient::RemoveContentSettingsObserver( | 128 void TestSigninClient::RemoveContentSettingsObserver( |
| 129 content_settings::Observer* observer) { | 129 content_settings::Observer* observer) { |
| 130 } | 130 } |
| 131 | 131 |
| 132 void TestSigninClient::DelayNetworkCall(const base::Closure& callback) { | 132 void TestSigninClient::DelayNetworkCall(const base::Closure& callback) { |
| 133 callback.Run(); | 133 callback.Run(); |
| 134 } | 134 } |
| OLD | NEW |