OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
6 #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 6 #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "components/signin/core/browser/signin_manager.h" | 12 #include "components/signin/core/browser/signin_manager.h" |
12 #include "components/signin/core/browser/signin_metrics.h" | 13 #include "components/signin/core/browser/signin_metrics.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class BrowserContext; | 16 class BrowserContext; |
16 } | 17 } |
17 | 18 |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 // SigninManager to use for testing. Tests should use the type | 21 // SigninManager to use for testing. Tests should use the type |
21 // SigninManagerForTesting to ensure that the right type for their platform is | 22 // SigninManagerForTesting to ensure that the right type for their platform is |
22 // used. | 23 // used. |
23 | 24 |
24 // Overrides InitTokenService to do-nothing in tests. | 25 // Overrides InitTokenService to do-nothing in tests. |
25 class FakeSigninManagerBase : public SigninManagerBase { | 26 class FakeSigninManagerBase : public SigninManagerBase { |
26 public: | 27 public: |
27 explicit FakeSigninManagerBase(Profile* profile); | 28 explicit FakeSigninManagerBase(Profile* profile); |
28 ~FakeSigninManagerBase() override; | 29 ~FakeSigninManagerBase() override; |
29 | 30 |
30 // Helper function to be used with | 31 // Helper function to be used with |
31 // KeyedService::SetTestingFactory(). In order to match | 32 // KeyedService::SetTestingFactory(). In order to match |
32 // the API of SigninManagerFactory::GetForProfile(), returns a | 33 // the API of SigninManagerFactory::GetForProfile(), returns a |
33 // FakeSigninManagerBase* on ChromeOS, and a FakeSigninManager* on all other | 34 // FakeSigninManagerBase* on ChromeOS, and a FakeSigninManager* on all other |
34 // platforms. The returned instance is initialized. | 35 // platforms. The returned instance is initialized. |
35 static KeyedService* Build(content::BrowserContext* context); | 36 static scoped_ptr<KeyedService> Build(content::BrowserContext* context); |
36 }; | 37 }; |
37 | 38 |
38 #if !defined(OS_CHROMEOS) | 39 #if !defined(OS_CHROMEOS) |
39 | 40 |
40 // A signin manager that bypasses actual authentication routines with servers | 41 // A signin manager that bypasses actual authentication routines with servers |
41 // and accepts the credentials provided to StartSignIn. | 42 // and accepts the credentials provided to StartSignIn. |
42 class FakeSigninManager : public SigninManager { | 43 class FakeSigninManager : public SigninManager { |
43 public: | 44 public: |
44 explicit FakeSigninManager(Profile* profile); | 45 explicit FakeSigninManager(Profile* profile); |
45 ~FakeSigninManager() override; | 46 ~FakeSigninManager() override; |
(...skipping 27 matching lines...) Expand all Loading... |
73 | 74 |
74 #endif // !defined (OS_CHROMEOS) | 75 #endif // !defined (OS_CHROMEOS) |
75 | 76 |
76 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
77 typedef FakeSigninManagerBase FakeSigninManagerForTesting; | 78 typedef FakeSigninManagerBase FakeSigninManagerForTesting; |
78 #else | 79 #else |
79 typedef FakeSigninManager FakeSigninManagerForTesting; | 80 typedef FakeSigninManager FakeSigninManagerForTesting; |
80 #endif | 81 #endif |
81 | 82 |
82 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ | 83 #endif // CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_H_ |
OLD | NEW |