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
3 // found in the LICENSE file.
4 #ifndef CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_
5 #define CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_
7 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "net/url_request/test_url_fetcher_factory.h"
16 class FakeGaiaCookieManagerService
: public GaiaCookieManagerService
{
18 FakeGaiaCookieManagerService(OAuth2TokenService
* token_service
,
19 const std::string
& source
,
20 SigninClient
* client
);
22 void Init(net::FakeURLFetcherFactory
* url_fetcher_factory
);
24 void SetListAccountsResponseHttpNotFound();
25 void SetListAccountsResponseWebLoginRequired();
26 void SetListAccountsResponseNoAccounts();
27 void SetListAccountsResponseOneAccount(
28 const char* email
, const char* gaia_id
);
29 void SetListAccountsResponseOneAccountWithExpiry(
30 const char* account
, const char* gaia_id
, bool expired
);
31 void SetListAccountsResponseTwoAccounts(
32 const char* email1
, const char* gaia_id1
,
33 const char* email2
, const char* gaia_id2
);
34 void SetListAccountsResponseTwoAccountsWithExpiry(const char* email1
,
36 bool account1_expired
,
39 bool account2_expired
);
41 // Helper function to be used with KeyedService::SetTestingFactory().
42 static scoped_ptr
<KeyedService
> Build(content::BrowserContext
* context
);
45 // Provide a fake response for calls to /ListAccounts.
46 net::FakeURLFetcherFactory
* url_fetcher_factory_
;
48 DISALLOW_COPY_AND_ASSIGN(FakeGaiaCookieManagerService
);
51 #endif // CHROME_BROWSER_SIGNIN_FAKE_GAIA_COOKIE_MANAGER_SERVICE_H_