OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ | 4 #ifndef CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ |
5 #define CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ | 5 #define CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ |
6 | 6 |
7 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 7 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
8 | 8 |
9 #include "net/url_request/test_url_fetcher_factory.h" | 9 #include "net/url_request/test_url_fetcher_factory.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class BrowserContext; | 12 class BrowserContext; |
13 } | 13 } |
14 | 14 |
15 class FakeGaiaCookieManagerService : public GaiaCookieManagerService { | 15 class FakeGaiaCookieManagerService : public GaiaCookieManagerService { |
16 public: | 16 public: |
17 FakeGaiaCookieManagerService(OAuth2TokenService* token_service, | 17 FakeGaiaCookieManagerService(OAuth2TokenService* token_service, |
18 const std::string& source, | 18 const std::string& source, |
19 SigninClient* client); | 19 SigninClient* client); |
20 | 20 |
21 void Init(net::FakeURLFetcherFactory* url_fetcher_factory); | 21 void Init(net::FakeURLFetcherFactory* url_fetcher_factory); |
22 | 22 |
23 void SetListAccountsResponseHttpNotFound(); | 23 void SetListAccountsResponseHttpNotFound(); |
| 24 void SetListAccountsResponseWebLoginRequired(); |
24 void SetListAccountsResponseNoAccounts(); | 25 void SetListAccountsResponseNoAccounts(); |
25 void SetListAccountsResponseOneAccount(const char* account); | 26 void SetListAccountsResponseOneAccount(const char* account); |
26 void SetListAccountsResponseOneAccountWithExpiry( | 27 void SetListAccountsResponseOneAccountWithExpiry( |
27 const char* account, bool expired); | 28 const char* account, bool expired); |
28 void SetListAccountsResponseTwoAccounts(const char* account1, | 29 void SetListAccountsResponseTwoAccounts(const char* account1, |
29 const char* account2); | 30 const char* account2); |
30 void SetListAccountsResponseTwoAccountsWithExpiry( | 31 void SetListAccountsResponseTwoAccountsWithExpiry( |
31 const char* account1, bool account1_expired, | 32 const char* account1, bool account1_expired, |
32 const char* account2, bool account2_expired); | 33 const char* account2, bool account2_expired); |
33 | 34 |
34 // Helper function to be used with KeyedService::SetTestingFactory(). | 35 // Helper function to be used with KeyedService::SetTestingFactory(). |
35 static KeyedService* Build(content::BrowserContext* context); | 36 static KeyedService* Build(content::BrowserContext* context); |
36 | 37 |
37 private: | 38 private: |
38 // Provide a fake response for calls to /ListAccounts. | 39 // Provide a fake response for calls to /ListAccounts. |
39 net::FakeURLFetcherFactory* url_fetcher_factory_; | 40 net::FakeURLFetcherFactory* url_fetcher_factory_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(FakeGaiaCookieManagerService); | 42 DISALLOW_COPY_AND_ASSIGN(FakeGaiaCookieManagerService); |
42 }; | 43 }; |
43 | 44 |
44 #endif // CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ | 45 #endif // CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_ |
OLD | NEW |