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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "components/signin/core/browser/test_signin_client.h" | 6 #include "components/signin/core/browser/test_signin_client.h" |
7 #include "components/signin/core/browser/webdata/token_service_table.h" | 7 #include "components/signin/core/browser/webdata/token_service_table.h" |
8 #include "components/webdata/common/web_data_service_base.h" | 8 #include "components/webdata/common/web_data_service_base.h" |
9 #include "components/webdata/common/web_database_service.h" | 9 #include "components/webdata/common/web_database_service.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 #if defined(OS_IOS) | 12 #if defined(OS_IOS) |
13 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" | 13 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" |
14 #endif | 14 #endif |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Helper for testing. | 18 // Helper for testing. |
19 const int kInvalidProcessId = -1; | 19 const int kInvalidProcessId = -1; |
20 } | 20 } |
21 | 21 |
22 TestSigninClient::TestSigninClient() | 22 TestSigninClient::TestSigninClient() |
23 : request_context_(new net::TestURLRequestContextGetter( | 23 : request_context_(new net::TestURLRequestContextGetter( |
24 base::MessageLoopProxy::current())) { | 24 base::MessageLoopProxy::current())), |
| 25 pref_service_(NULL) { |
25 LoadDatabase(); | 26 LoadDatabase(); |
26 } | 27 } |
27 | 28 |
| 29 TestSigninClient::TestSigninClient(PrefService* pref_service) |
| 30 : pref_service_(pref_service) {} |
| 31 |
28 TestSigninClient::~TestSigninClient() {} | 32 TestSigninClient::~TestSigninClient() {} |
29 | 33 |
30 PrefService* TestSigninClient::GetPrefs() { return NULL; } | 34 PrefService* TestSigninClient::GetPrefs() { |
| 35 return pref_service_; |
| 36 } |
31 | 37 |
32 scoped_refptr<TokenWebData> TestSigninClient::GetDatabase() { | 38 scoped_refptr<TokenWebData> TestSigninClient::GetDatabase() { |
33 return database_; | 39 return database_; |
34 } | 40 } |
35 | 41 |
36 bool TestSigninClient::CanRevokeCredentials() { return true; } | 42 bool TestSigninClient::CanRevokeCredentials() { return true; } |
37 | 43 |
38 net::URLRequestContextGetter* TestSigninClient::GetURLRequestContext() { | 44 net::URLRequestContextGetter* TestSigninClient::GetURLRequestContext() { |
39 return request_context_; | 45 return request_context_; |
40 } | 46 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 signin_host_id_ = kInvalidProcessId; | 96 signin_host_id_ = kInvalidProcessId; |
91 } | 97 } |
92 | 98 |
93 bool TestSigninClient::IsSigninProcess(int process_id) const { | 99 bool TestSigninClient::IsSigninProcess(int process_id) const { |
94 return process_id == signin_host_id_; | 100 return process_id == signin_host_id_; |
95 } | 101 } |
96 | 102 |
97 bool TestSigninClient::HasSigninProcess() const { | 103 bool TestSigninClient::HasSigninProcess() const { |
98 return signin_host_id_ != kInvalidProcessId; | 104 return signin_host_id_ != kInvalidProcessId; |
99 } | 105 } |
OLD | NEW |