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 "components/signin/core/browser/webdata/token_service_table.h" | 8 #include "components/signin/core/browser/webdata/token_service_table.h" |
9 #include "components/webdata/common/web_data_service_base.h" | 9 #include "components/webdata/common/web_data_service_base.h" |
10 #include "components/webdata/common/web_database_service.h" | 10 #include "components/webdata/common/web_database_service.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 #if defined(OS_IOS) | 13 #if defined(OS_IOS) |
14 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" | 14 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace { | |
18 | |
19 // Helper for testing. | |
20 const int kInvalidProcessId = -1; | |
21 } | |
22 | |
23 TestSigninClient::TestSigninClient() | 17 TestSigninClient::TestSigninClient() |
24 : request_context_(new net::TestURLRequestContextGetter( | 18 : request_context_(new net::TestURLRequestContextGetter( |
25 base::MessageLoopProxy::current())), | 19 base::MessageLoopProxy::current())), |
26 pref_service_(NULL), | 20 pref_service_(NULL), |
27 are_signin_cookies_allowed_(true) { | 21 are_signin_cookies_allowed_(true) { |
28 LoadDatabase(); | 22 LoadDatabase(); |
29 } | 23 } |
30 | 24 |
31 TestSigninClient::TestSigninClient(PrefService* pref_service) | 25 TestSigninClient::TestSigninClient(PrefService* pref_service) |
32 : pref_service_(pref_service), | 26 : pref_service_(pref_service), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 97 |
104 ios::FakeProfileOAuth2TokenServiceIOSProvider* | 98 ios::FakeProfileOAuth2TokenServiceIOSProvider* |
105 TestSigninClient::GetIOSProviderAsFake() { | 99 TestSigninClient::GetIOSProviderAsFake() { |
106 if (!iosProvider_) { | 100 if (!iosProvider_) { |
107 iosProvider_.reset(new ios::FakeProfileOAuth2TokenServiceIOSProvider()); | 101 iosProvider_.reset(new ios::FakeProfileOAuth2TokenServiceIOSProvider()); |
108 } | 102 } |
109 return iosProvider_.get(); | 103 return iosProvider_.get(); |
110 } | 104 } |
111 #endif | 105 #endif |
112 | 106 |
113 void TestSigninClient::SetSigninProcess(int process_id) { | |
114 if (process_id == signin_host_id_) | |
115 return; | |
116 DLOG_IF(WARNING, signin_host_id_ != kInvalidProcessId) | |
117 << "Replacing in-use signin process."; | |
118 signin_host_id_ = process_id; | |
119 } | |
120 | |
121 void TestSigninClient::ClearSigninProcess() { | |
122 signin_host_id_ = kInvalidProcessId; | |
123 } | |
124 | |
125 bool TestSigninClient::IsSigninProcess(int process_id) const { | |
126 return process_id == signin_host_id_; | |
127 } | |
128 | |
129 bool TestSigninClient::HasSigninProcess() const { | |
130 return signin_host_id_ != kInvalidProcessId; | |
131 } | |
132 | |
133 bool TestSigninClient::IsFirstRun() const { | 107 bool TestSigninClient::IsFirstRun() const { |
134 return false; | 108 return false; |
135 } | 109 } |
136 | 110 |
137 base::Time TestSigninClient::GetInstallDate() { | 111 base::Time TestSigninClient::GetInstallDate() { |
138 return base::Time::Now(); | 112 return base::Time::Now(); |
139 } | 113 } |
140 | 114 |
141 bool TestSigninClient::AreSigninCookiesAllowed() { | 115 bool TestSigninClient::AreSigninCookiesAllowed() { |
142 return are_signin_cookies_allowed_; | 116 return are_signin_cookies_allowed_; |
143 } | 117 } |
144 | 118 |
145 void TestSigninClient::AddContentSettingsObserver( | 119 void TestSigninClient::AddContentSettingsObserver( |
146 content_settings::Observer* observer) { | 120 content_settings::Observer* observer) { |
147 } | 121 } |
148 | 122 |
149 void TestSigninClient::RemoveContentSettingsObserver( | 123 void TestSigninClient::RemoveContentSettingsObserver( |
150 content_settings::Observer* observer) { | 124 content_settings::Observer* observer) { |
151 } | 125 } |
OLD | NEW |