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

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

Issue 2123273003: Introduce FakeChromeIdentity and FakeChromeIdentityService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing dependency on gmock Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h
diff --git a/ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h b/ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..dbec6dc7185ff4b35734c2e165941fbb367b6fa7
--- /dev/null
+++ b/ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H_
+#define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H_
+
+#include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h"
+
+#include "base/mac/scoped_nsobject.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+@class NSMutableArray;
+
+namespace ios {
+
+// A fake ChromeIdentityService used for testing.
+class FakeChromeIdentityService : public ChromeIdentityService {
+ public:
+ FakeChromeIdentityService();
+ ~FakeChromeIdentityService();
+
+ // Convenience method that returns the instance of
+ // |FakeChromeIdentityService| from the ChromeBrowserProvider.
+ static FakeChromeIdentityService* GetInstanceFromChromeProvider();
+
+ // ChromeIdentityService implementation.
+ bool IsValidIdentity(ChromeIdentity* identity) const override;
+ ChromeIdentity* GetIdentityWithGaiaID(
+ const std::string& gaia_id) const override;
+ bool HasIdentities() const override;
+ NSArray* GetAllIdentities() const override;
+ NSArray* GetAllIdentitiesSortedForDisplay() const override;
+ void ForgetIdentity(ChromeIdentity* identity,
+ ForgetIdentityCallback callback) override;
+
+ MOCK_METHOD5(GetAccessToken,
+ void(ChromeIdentity* identity,
+ const std::string& client_id,
+ const std::string& client_secret,
+ const std::set<std::string>& scopes,
+ const ios::AccessTokenCallback& callback));
+
+ MOCK_METHOD1(GetMDMDeviceStatus,
+ ios::MDMDeviceStatus(NSDictionary* user_info));
+
+ MOCK_METHOD3(HandleMDMNotification,
+ bool(ChromeIdentity* identity,
+ NSDictionary* user_info,
+ ios::MDMStatusCallback callback));
+
+ // Adds the identities given their name.
+ void AddIdentities(NSArray* identitiesNames);
+
+ // Adds |identity| to the available identities.
+ void AddIdentity(ChromeIdentity* identity);
+
+ private:
+ base::scoped_nsobject<NSMutableArray> identities_;
+};
+
+} // namespace ios
+
+#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_FAKE_CHROME_IDENTITY_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698