Give names to all utility processes.
[chromium-blink-merge.git] / ios / public / test / fake_profile_oauth2_token_service_ios_provider.h
blob9eca4323fcfd914874b06a8a2fd184e6f42cb727
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
3 // found in the LICENSE file.
5 #ifndef IOS_TEST_MOCK_PROFILE_OAUTH2_TOKEN_SERVICE_PROVIDER_IOS_H_
6 #define IOS_TEST_MOCK_PROFILE_OAUTH2_TOKEN_SERVICE_PROVIDER_IOS_H_
8 #include <string>
9 #include <utility>
10 #include <vector>
12 #include "base/memory/scoped_ptr.h"
13 #include "ios/public/provider/components/signin/browser/profile_oauth2_token_service_ios_provider.h"
15 namespace ios {
17 // Mock class of ProfileOAuth2TokenServiceIOSProvider for testing.
18 class FakeProfileOAuth2TokenServiceIOSProvider
19 : public ProfileOAuth2TokenServiceIOSProvider {
20 public:
21 FakeProfileOAuth2TokenServiceIOSProvider();
22 ~FakeProfileOAuth2TokenServiceIOSProvider() override;
24 // ProfileOAuth2TokenServiceIOSProvider
25 void InitializeSharedAuthentication() override;
27 void GetAccessToken(const std::string& account_id,
28 const std::string& client_id,
29 const std::string& client_secret,
30 const std::set<std::string>& scopes,
31 const AccessTokenCallback& callback) override;
33 std::vector<std::string> GetAllAccountIds() override;
35 AuthenticationErrorCategory GetAuthenticationErrorCategory(
36 NSError* error) const override;
38 // Methods to configure this fake provider.
39 void AddAccount(const std::string& account_id);
40 void SetAccounts(const std::vector<std::string>& accounts);
41 void ClearAccounts();
43 // Issues access token responses.
44 void IssueAccessTokenForAllRequests();
45 void IssueAccessTokenErrorForAllRequests();
47 private:
48 typedef std::pair<std::string, AccessTokenCallback> AccessTokenRequest;
50 std::vector<std::string> accounts_;
51 std::vector<AccessTokenRequest> requests_;
53 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenServiceIOSProvider);
56 } // namespace ios
58 #endif // IOS_TEST_PROVIDER_CHROME_BROWSER_SIGNIN_MOCK_PROFILE_OAUTH2_TOKEN_SERVICE_PROVIDER_IOS_H_