blob: 4527c6f466bbd25265298dd584f8f6c15317a152 [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
5#ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_
6#define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_
7
8#include <string>
[email protected]cd1acaf42013-08-02 22:35:269#include <vector>
[email protected]95f0fe742010-12-10 01:38:2910
[email protected]fa134872011-08-02 18:39:5511#include "base/memory/weak_ptr.h"
[email protected]54618862013-06-10 20:37:0912#include "base/strings/string16.h"
blundell7282b512015-11-09 07:21:1113#include "components/browser_sync/browser/profile_sync_service.h"
[email protected]f472deb2014-04-17 19:26:5314#include "components/sync_driver/change_processor.h"
[email protected]dfe6a9b2014-01-31 21:37:5515#include "components/sync_driver/data_type_controller.h"
staniscd0df0182014-09-26 06:17:3616#include "components/sync_driver/device_info.h"
[email protected]6386cf52012-09-07 04:26:3717#include "google_apis/gaia/google_service_auth_error.h"
[email protected]002d39192012-07-03 01:30:5618#include "sync/internal_api/public/base/model_type.h"
[email protected]c1c32c82012-03-15 09:35:4219#include "sync/protocol/sync_protocol_error.h"
[email protected]4aea04a2010-02-10 20:13:4320#include "testing/gmock/include/gmock/gmock.h"
21
[email protected]4aea04a2010-02-10 20:13:4322class ProfileSyncServiceMock : public ProfileSyncService {
23 public:
vabr596777d2015-12-09 15:54:0424 explicit ProfileSyncServiceMock(InitParams init_params);
25 // The second constructor defers to the first one. Use it when you need to
26 // create a StrictMock or NiceMock of ProfileSyncServiceMock, because those
27 // template classes cannot handle the input class having constructors with
28 // arguments passed by value. Otherwise use the constructor above for cleaner
29 // code.
30 explicit ProfileSyncServiceMock(InitParams* init_params);
31
[email protected]33392292011-01-05 17:56:3932 virtual ~ProfileSyncServiceMock();
[email protected]4aea04a2010-02-10 20:13:4333
[email protected]d85f0ac42014-07-22 00:36:2034 MOCK_METHOD4(OnBackendInitialized,
[email protected]12a11e22012-11-08 06:26:3035 void(const syncer::WeakHandle<syncer::JsBackend>&,
36 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&,
[email protected]d85f0ac42014-07-22 00:36:2037 const std::string&,
[email protected]12a11e22012-11-08 06:26:3038 bool));
[email protected]4aea04a2010-02-10 20:13:4339 MOCK_METHOD0(OnSyncCycleCompleted, void());
[email protected]c8a61d092012-03-23 17:22:4540 MOCK_METHOD2(OnUserChoseDatatypes,
41 void(bool sync_everything,
[email protected]a4a147652012-07-03 23:41:3242 syncer::ModelTypeSet chosen_types));
[email protected]c8a61d092012-03-23 17:22:4543
[email protected]f6ec8b22010-06-08 23:40:0644 MOCK_METHOD2(OnUnrecoverableError,
45 void(const tracked_objects::Location& location,
46 const std::string& message));
[email protected]65f173552012-06-28 22:43:5847 MOCK_CONST_METHOD0(GetUserShare, syncer::UserShare*());
maxboguecd3fad6b2015-06-09 00:44:5348 MOCK_METHOD0(RequestStart, void());
maxbogue699262c92015-06-19 19:24:5849 MOCK_METHOD1(RequestStop, void(ProfileSyncService::SyncStopDataFate));
[email protected]4aea04a2010-02-10 20:13:4350
droger507e7e2f2015-04-03 18:56:2351 MOCK_METHOD1(AddObserver, void(sync_driver::SyncServiceObserver*));
52 MOCK_METHOD1(RemoveObserver, void(sync_driver::SyncServiceObserver*));
[email protected]65f173552012-06-28 22:43:5853 MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>());
[email protected]4772b072010-03-30 17:45:4654 MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool());
[email protected]e78d74e2010-04-06 22:49:4755
maxbogue81abdf22015-09-10 17:40:1956 MOCK_CONST_METHOD0(IsEncryptEverythingAllowed, bool());
57 MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool());
[email protected]c8a61d092012-03-23 17:22:4558 MOCK_METHOD0(EnableEncryptEverything, void());
59
[email protected]e78d74e2010-04-06 22:49:4760 MOCK_METHOD1(ChangePreferredDataTypes,
[email protected]a4a147652012-07-03 23:41:3261 void(syncer::ModelTypeSet preferred_types));
[email protected]464d74a2013-06-04 07:36:4662 MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet());
[email protected]a4a147652012-07-03 23:41:3263 MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet());
64 MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncer::ModelTypeSet());
[email protected]dc556252011-04-20 01:59:3565 MOCK_CONST_METHOD0(GetLastSessionSnapshot,
[email protected]65f173552012-06-28 22:43:5866 syncer::sessions::SyncSessionSnapshot());
[email protected]f1e6e0212010-10-15 20:54:2467
[email protected]dc445ac32012-07-19 21:23:4968 MOCK_METHOD1(QueryDetailedSyncStatus,
69 bool(browser_sync::SyncBackendHost::Status* result));
[email protected]f5fb17502011-11-30 11:03:2370 MOCK_CONST_METHOD0(GetAuthError, const GoogleServiceAuthError&());
maxbogue81abdf22015-09-10 17:40:1971 MOCK_CONST_METHOD0(IsFirstSetupInProgress, bool());
[email protected]a04db822013-12-11 19:14:4072 MOCK_CONST_METHOD0(GetLastSyncedTimeString, base::string16());
[email protected]e1c6f1262012-06-14 23:40:1073 MOCK_CONST_METHOD0(HasUnrecoverableError, bool());
maxbogue192b3602015-06-04 00:33:5574 MOCK_CONST_METHOD0(IsSyncActive, bool());
maxbogue81abdf22015-09-10 17:40:1975 MOCK_CONST_METHOD0(IsBackendInitialized, bool());
maxboguecd3fad6b2015-06-09 00:44:5376 MOCK_CONST_METHOD0(IsSyncRequested, bool());
[email protected]a41e100e2012-02-23 17:59:2477 MOCK_CONST_METHOD0(waiting_for_auth, bool());
bauerbf03588b92014-10-27 13:40:1578 MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&));
[email protected]008da422012-11-30 22:25:5179 MOCK_METHOD1(SetSetupInProgress, void(bool));
stanisc3724e602014-09-22 16:46:4980 MOCK_CONST_METHOD1(IsDataTypeControllerRunning, bool(syncer::ModelType));
[email protected]cd1acaf42013-08-02 22:35:2681
[email protected]1db7bae2012-08-17 22:37:0282 // DataTypeManagerObserver mocks.
[email protected]1db7bae2012-08-17 22:37:0283 MOCK_METHOD1(OnConfigureDone,
[email protected]49fef7942014-07-22 23:26:4784 void(const sync_driver::DataTypeManager::ConfigureResult&));
[email protected]1db7bae2012-08-17 22:37:0285 MOCK_METHOD0(OnConfigureStart, void());
86
maxbogue96b7d272015-06-16 02:59:5887 MOCK_CONST_METHOD0(CanSyncStart, bool());
[email protected]08fafe42013-02-03 08:10:4988 MOCK_CONST_METHOD0(IsManaged, bool());
[email protected]b67c18c2013-06-13 23:52:0389 MOCK_METHOD0(IsOAuthRefreshTokenAvailable, bool());
[email protected]a41e100e2012-02-23 17:59:2490
[email protected]83c130c2011-10-12 08:39:1691 MOCK_CONST_METHOD0(IsPassphraseRequired, bool());
92 MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool());
[email protected]c8a61d092012-03-23 17:22:4593 MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool());
[email protected]f6661cc2012-10-12 02:22:4394 MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType());
[email protected]a3745192013-04-03 03:55:4495 MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time());
[email protected]c8a61d092012-03-23 17:22:4596
97 MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase));
98 MOCK_METHOD2(SetEncryptionPassphrase, void(const std::string& passphrase,
99 PassphraseType type));
[email protected]13a239882014-06-10 18:06:26100
101 MOCK_METHOD1(StartUpSlowBackendComponents, void(BackendMode));
[email protected]4aea04a2010-02-10 20:13:43102};
103
104#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_