Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h

Issue 2287383002: Add setup for integration tests in FakeChromeIdentityService. (Closed)
Patch Set: Fix callback in FakeGetAccessToken Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H _ 5 #ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H _
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H _ 6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H _
7 7
8 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" 8 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h"
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 12
13 @class NSMutableArray; 13 @class NSMutableArray;
14 14
15 namespace ios { 15 namespace ios {
16 16
17 // A fake ChromeIdentityService used for testing. 17 // A fake ChromeIdentityService used for testing.
18 class FakeChromeIdentityService : public ChromeIdentityService { 18 class FakeChromeIdentityService : public ChromeIdentityService {
19 public: 19 public:
20 FakeChromeIdentityService(); 20 FakeChromeIdentityService();
21 ~FakeChromeIdentityService(); 21 virtual ~FakeChromeIdentityService();
22 22
23 // Convenience method that returns the instance of 23 // Convenience method that returns the instance of
24 // |FakeChromeIdentityService| from the ChromeBrowserProvider. 24 // |FakeChromeIdentityService| from the ChromeBrowserProvider.
25 static FakeChromeIdentityService* GetInstanceFromChromeProvider(); 25 static FakeChromeIdentityService* GetInstanceFromChromeProvider();
26 26
27 // ChromeIdentityService implementation. 27 // ChromeIdentityService implementation.
28 bool IsValidIdentity(ChromeIdentity* identity) const override; 28 bool IsValidIdentity(ChromeIdentity* identity) const override;
29 ChromeIdentity* GetIdentityWithGaiaID( 29 ChromeIdentity* GetIdentityWithGaiaID(
30 const std::string& gaia_id) const override; 30 const std::string& gaia_id) const override;
31 bool HasIdentities() const override; 31 bool HasIdentities() const override;
32 NSArray* GetAllIdentities() const override; 32 NSArray* GetAllIdentities() const override;
33 NSArray* GetAllIdentitiesSortedForDisplay() const override; 33 NSArray* GetAllIdentitiesSortedForDisplay() const override;
34 void ForgetIdentity(ChromeIdentity* identity, 34 void ForgetIdentity(ChromeIdentity* identity,
35 ForgetIdentityCallback callback) override; 35 ForgetIdentityCallback callback) override;
36 36
37 MOCK_METHOD5(GetAccessToken, 37 MOCK_METHOD5(GetAccessToken,
38 void(ChromeIdentity* identity, 38 void(ChromeIdentity* identity,
39 const std::string& client_id, 39 const std::string& client_id,
40 const std::string& client_secret, 40 const std::string& client_secret,
41 const std::set<std::string>& scopes, 41 const std::set<std::string>& scopes,
42 const ios::AccessTokenCallback& callback)); 42 const ios::AccessTokenCallback& callback));
43 43
44 MOCK_METHOD2(GetAvatarForIdentity,
45 void(ChromeIdentity* identity, GetAvatarCallback callback));
46
47 MOCK_METHOD1(GetCachedAvatarForIdentity, UIImage*(ChromeIdentity* identity));
48
49 MOCK_METHOD2(GetHostedDomainForIdentity,
50 void(ChromeIdentity* identity,
51 GetHostedDomainCallback callback));
52
44 MOCK_METHOD1(GetMDMDeviceStatus, 53 MOCK_METHOD1(GetMDMDeviceStatus,
45 ios::MDMDeviceStatus(NSDictionary* user_info)); 54 ios::MDMDeviceStatus(NSDictionary* user_info));
46 55
47 MOCK_METHOD3(HandleMDMNotification, 56 MOCK_METHOD3(HandleMDMNotification,
48 bool(ChromeIdentity* identity, 57 bool(ChromeIdentity* identity,
49 NSDictionary* user_info, 58 NSDictionary* user_info,
50 ios::MDMStatusCallback callback)); 59 ios::MDMStatusCallback callback));
51 60
61 // Sets up the mock methods for integration tests.
62 void SetUpForIntegrationTests();
63
52 // Adds the identities given their name. 64 // Adds the identities given their name.
53 void AddIdentities(NSArray* identitiesNames); 65 void AddIdentities(NSArray* identitiesNames);
54 66
55 // Adds |identity| to the available identities. 67 // Adds |identity| to the available identities.
56 void AddIdentity(ChromeIdentity* identity); 68 void AddIdentity(ChromeIdentity* identity);
57 69
58 private: 70 private:
59 base::scoped_nsobject<NSMutableArray> identities_; 71 base::scoped_nsobject<NSMutableArray> identities_;
60 }; 72 };
61 73
62 } // namespace ios 74 } // namespace ios
63 75
64 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVIC E_H_ 76 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVIC E_H_
OLDNEW
« no previous file with comments | « ios/public/provider/chrome/browser/DEPS ('k') | ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698