blob: 627e4c6cbd9d79ef69bb3eb6de46bd8302d2bde7 [file] [log] [blame]
[email protected]99e652f2012-01-22 04:05:071// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]4aea04a2010-02-10 20:13:432// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
maxbogue26f40222016-09-16 20:22:185#ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_
6#define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_
[email protected]4aea04a2010-02-10 20:13:437
David Rogerf61bb392018-02-13 09:00:278#include <memory>
[email protected]4aea04a2010-02-10 20:13:439#include <string>
[email protected]cd1acaf42013-08-02 22:35:2610#include <vector>
[email protected]95f0fe742010-12-10 01:38:2911
[email protected]fa134872011-08-02 18:39:5512#include "base/memory/weak_ptr.h"
[email protected]54618862013-06-10 20:37:0913#include "base/strings/string16.h"
maxbogue26f40222016-09-16 20:22:1814#include "components/browser_sync/profile_sync_service.h"
Max Boguefef332d2016-07-28 22:09:0915#include "components/sync/base/model_type.h"
maxboguef1885f7d2016-08-16 19:13:2016#include "components/sync/device_info/device_info.h"
maxbogue455a57e32016-08-14 00:08:3217#include "components/sync/driver/data_type_controller.h"
maxbogue6c9a8fb02016-11-17 20:08:3618#include "components/sync/model/change_processor.h"
Max Boguefef332d2016-07-28 22:09:0919#include "components/sync/protocol/sync_protocol_error.h"
[email protected]6386cf52012-09-07 04:26:3720#include "google_apis/gaia/google_service_auth_error.h"
[email protected]4aea04a2010-02-10 20:13:4321#include "testing/gmock/include/gmock/gmock.h"
22
maxbogue0a379452016-09-22 21:35:0523namespace browser_sync {
24
[email protected]4aea04a2010-02-10 20:13:4325class ProfileSyncServiceMock : public ProfileSyncService {
26 public:
vabr596777d2015-12-09 15:54:0427 explicit ProfileSyncServiceMock(InitParams init_params);
28 // The second constructor defers to the first one. Use it when you need to
29 // create a StrictMock or NiceMock of ProfileSyncServiceMock, because those
30 // template classes cannot handle the input class having constructors with
31 // arguments passed by value. Otherwise use the constructor above for cleaner
32 // code.
33 explicit ProfileSyncServiceMock(InitParams* init_params);
34
Daniel Cheng67848522018-04-27 22:04:4135 ~ProfileSyncServiceMock() override;
[email protected]4aea04a2010-02-10 20:13:4336
maxbogue27ff55902016-12-08 01:38:1437 MOCK_METHOD5(
maxbogue6b6f9f432016-12-05 23:59:1438 OnEngineInitialized,
maxbogue27ff55902016-12-08 01:38:1439 void(syncer::ModelTypeSet initial_types,
40 const syncer::WeakHandle<syncer::JsBackend>&,
[email protected]12a11e22012-11-08 06:26:3041 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&,
[email protected]d85f0ac42014-07-22 00:36:2042 const std::string&,
[email protected]12a11e22012-11-08 06:26:3043 bool));
maxboguecbd47622017-01-13 04:24:1744 MOCK_METHOD1(OnSyncCycleCompleted, void(const syncer::SyncCycleSnapshot&));
[email protected]c8a61d092012-03-23 17:22:4545 MOCK_METHOD2(OnUserChoseDatatypes,
maxbogue26f40222016-09-16 20:22:1846 void(bool sync_everything, syncer::ModelTypeSet chosen_types));
David Rogerf61bb392018-02-13 09:00:2747 MOCK_METHOD0(SetFirstSetupComplete, void());
48 MOCK_METHOD0(GetSetupInProgressHandle,
49 std::unique_ptr<syncer::SyncSetupInProgressHandle>());
[email protected]c8a61d092012-03-23 17:22:4550
[email protected]f6ec8b22010-06-08 23:40:0651 MOCK_METHOD2(OnUnrecoverableError,
Brett Wilson190fd2ac2017-09-12 05:04:3052 void(const base::Location& location,
maxbogue26f40222016-09-16 20:22:1853 const std::string& message));
[email protected]65f173552012-06-28 22:43:5854 MOCK_CONST_METHOD0(GetUserShare, syncer::UserShare*());
maxboguecd3fad6b2015-06-09 00:44:5355 MOCK_METHOD0(RequestStart, void());
maxbogue699262c92015-06-19 19:24:5856 MOCK_METHOD1(RequestStop, void(ProfileSyncService::SyncStopDataFate));
[email protected]4aea04a2010-02-10 20:13:4357
maxbogue7e006db2016-10-03 19:48:2858 MOCK_METHOD1(AddObserver, void(syncer::SyncServiceObserver*));
59 MOCK_METHOD1(RemoveObserver, void(syncer::SyncServiceObserver*));
[email protected]65f173552012-06-28 22:43:5860 MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>());
maxboguefe00952a2016-01-19 19:02:0161 MOCK_CONST_METHOD0(IsFirstSetupComplete, bool());
[email protected]e78d74e2010-04-06 22:49:4762
maxbogue81abdf22015-09-10 17:40:1963 MOCK_CONST_METHOD0(IsEncryptEverythingAllowed, bool());
64 MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool());
[email protected]c8a61d092012-03-23 17:22:4565 MOCK_METHOD0(EnableEncryptEverything, void());
66
[email protected]e78d74e2010-04-06 22:49:4767 MOCK_METHOD1(ChangePreferredDataTypes,
[email protected]a4a147652012-07-03 23:41:3268 void(syncer::ModelTypeSet preferred_types));
[email protected]464d74a2013-06-04 07:36:4669 MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet());
[email protected]a4a147652012-07-03 23:41:3270 MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet());
71 MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncer::ModelTypeSet());
maxbogue3067278a2016-08-19 23:16:1872 MOCK_CONST_METHOD0(GetLastCycleSnapshot, syncer::SyncCycleSnapshot());
[email protected]f1e6e0212010-10-15 20:54:2473
maxbogue7e006db2016-10-03 19:48:2874 MOCK_METHOD1(QueryDetailedSyncStatus,
maxbogue6dcda762016-12-05 20:45:5675 bool(syncer::SyncEngine::Status* result));
[email protected]f5fb17502011-11-30 11:03:2376 MOCK_CONST_METHOD0(GetAuthError, const GoogleServiceAuthError&());
maxbogue81abdf22015-09-10 17:40:1977 MOCK_CONST_METHOD0(IsFirstSetupInProgress, bool());
Steven Holte30dd3b62017-10-11 06:58:5678 MOCK_CONST_METHOD0(GetLastSyncedTime, base::Time());
[email protected]e1c6f1262012-06-14 23:40:1079 MOCK_CONST_METHOD0(HasUnrecoverableError, bool());
maxbogue192b3602015-06-04 00:33:5580 MOCK_CONST_METHOD0(IsSyncActive, bool());
maxbogue6b6f9f432016-12-05 23:59:1481 MOCK_CONST_METHOD0(IsEngineInitialized, bool());
maxboguecd3fad6b2015-06-09 00:44:5382 MOCK_CONST_METHOD0(IsSyncRequested, bool());
pnoland0c1d2662017-06-12 20:49:2983 MOCK_CONST_METHOD0(IsSyncConfirmationNeeded, bool());
[email protected]a41e100e2012-02-23 17:59:2484 MOCK_CONST_METHOD0(waiting_for_auth, bool());
bauerbf03588b92014-10-27 13:40:1585 MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&));
stanisc3724e602014-09-22 16:46:4986 MOCK_CONST_METHOD1(IsDataTypeControllerRunning, bool(syncer::ModelType));
[email protected]cd1acaf42013-08-02 22:35:2687
sath0f513242017-03-29 19:57:0988 MOCK_METHOD0(GetOpenTabsUIDelegateMock, sync_sessions::OpenTabsUIDelegate*());
89 sync_sessions::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
90
[email protected]1db7bae2012-08-17 22:37:0291 // DataTypeManagerObserver mocks.
[email protected]1db7bae2012-08-17 22:37:0292 MOCK_METHOD1(OnConfigureDone,
maxbogue7e006db2016-10-03 19:48:2893 void(const syncer::DataTypeManager::ConfigureResult&));
[email protected]1db7bae2012-08-17 22:37:0294 MOCK_METHOD0(OnConfigureStart, void());
95
maxbogue96b7d272015-06-16 02:59:5896 MOCK_CONST_METHOD0(CanSyncStart, bool());
[email protected]08fafe42013-02-03 08:10:4997 MOCK_CONST_METHOD0(IsManaged, bool());
[email protected]a41e100e2012-02-23 17:59:2498
[email protected]83c130c2011-10-12 08:39:1699 MOCK_CONST_METHOD0(IsPassphraseRequired, bool());
100 MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool());
[email protected]c8a61d092012-03-23 17:22:45101 MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool());
[email protected]f6661cc2012-10-12 02:22:43102 MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType());
[email protected]a3745192013-04-03 03:55:44103 MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time());
[email protected]c8a61d092012-03-23 17:22:45104
105 MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase));
maxbogue26f40222016-09-16 20:22:18106 MOCK_METHOD2(SetEncryptionPassphrase,
107 void(const std::string& passphrase, PassphraseType type));
tommyclif3a1551e2016-06-21 18:11:23108
109 MOCK_METHOD0(OnSetupInProgressHandleDestroyed, void());
David Rogerf61bb392018-02-13 09:00:27110
111 // Gives access to the real implementation of ProfileSyncService methods:
112 std::unique_ptr<syncer::SyncSetupInProgressHandle>
113 GetSetupInProgressHandleConcrete();
[email protected]4aea04a2010-02-10 20:13:43114};
115
maxbogue0a379452016-09-22 21:35:05116} // namespace browser_sync
117
maxbogue26f40222016-09-16 20:22:18118#endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_