OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
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 _ | |
7 | |
8 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | |
9 | |
10 #include "base/mac/scoped_nsobject.h" | |
11 #include "testing/gmock/include/gmock/gmock.h" | |
12 | |
13 @class NSMutableArray; | |
14 | |
15 namespace ios { | |
16 | |
17 // A fake ChromeIdentityService used for testing. | |
18 class FakeChromeIdentityService : public ChromeIdentityService { | |
19 public: | |
20 FakeChromeIdentityService(); | |
21 ~FakeChromeIdentityService(); | |
22 | |
23 // Returns the instance of |FakeChromeIdentityService|. | |
24 static FakeChromeIdentityService* GetInstance(); | |
msarda
2016/07/07 11:58:06
When I see a static method name GetInstance, I thi
bzanotti
2016/07/07 12:48:11
Renamed to GetInstanceFromChromeProvider. Instanti
| |
25 | |
26 // ChromeIdentityService implementation. | |
27 bool IsValidIdentity(ChromeIdentity* identity) const override; | |
28 ChromeIdentity* GetIdentityWithEmail(const std::string& email) const override; | |
29 ChromeIdentity* GetIdentityWithGaiaID( | |
30 const std::string& gaia_id) const override; | |
31 bool HasIdentities() const override; | |
32 NSArray* GetAllIdentities() const override; | |
33 NSArray* GetAllIdentitiesSortedForDisplay() const override; | |
34 void ForgetIdentity(ChromeIdentity* identity, | |
35 ForgetIdentityCallback callback) override; | |
36 | |
37 MOCK_METHOD5(GetAccessToken, | |
38 void(ChromeIdentity* identity, | |
39 const std::string& client_id, | |
40 const std::string& client_secret, | |
41 const std::set<std::string>& scopes, | |
42 const ios::AccessTokenCallback& callback)); | |
43 | |
44 MOCK_METHOD1(GetMDMDeviceStatus, | |
45 ios::MDMDeviceStatus(NSDictionary* user_info)); | |
46 | |
47 MOCK_METHOD3(HandleMDMNotification, | |
48 bool(ChromeIdentity* identity, | |
49 NSDictionary* user_info, | |
50 ios::MDMStatusCallback callback)); | |
51 | |
52 // Adds the identities given their name. | |
53 void AddIdentities(NSArray* identitiesNames); | |
54 | |
55 // Adds |identity| to the available identities. | |
56 void AddIdentity(ChromeIdentity* identity); | |
57 | |
58 private: | |
59 base::scoped_nsobject<NSMutableArray> identities_; | |
60 }; | |
61 } | |
62 | |
63 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVIC E_H_ | |
OLD | NEW |