[email protected] | 99e652f | 2012-01-22 04:05:07 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 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 CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |
| 6 | #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |
| 7 | |
| 8 | #include <string> |
[email protected] | cd1acaf4 | 2013-08-02 22:35:26 | [diff] [blame] | 9 | #include <vector> |
[email protected] | 95f0fe74 | 2010-12-10 01:38:29 | [diff] [blame] | 10 | |
[email protected] | fa13487 | 2011-08-02 18:39:55 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
[email protected] | 5461886 | 2013-06-10 20:37:09 | [diff] [blame] | 12 | #include "base/strings/string16.h" |
blundell | 7282b51 | 2015-11-09 07:21:11 | [diff] [blame] | 13 | #include "components/browser_sync/browser/profile_sync_service.h" |
[email protected] | f472deb | 2014-04-17 19:26:53 | [diff] [blame] | 14 | #include "components/sync_driver/change_processor.h" |
[email protected] | dfe6a9b | 2014-01-31 21:37:55 | [diff] [blame] | 15 | #include "components/sync_driver/data_type_controller.h" |
stanisc | d0df018 | 2014-09-26 06:17:36 | [diff] [blame] | 16 | #include "components/sync_driver/device_info.h" |
[email protected] | 6386cf5 | 2012-09-07 04:26:37 | [diff] [blame] | 17 | #include "google_apis/gaia/google_service_auth_error.h" |
[email protected] | 002d3919 | 2012-07-03 01:30:56 | [diff] [blame] | 18 | #include "sync/internal_api/public/base/model_type.h" |
[email protected] | c1c32c8 | 2012-03-15 09:35:42 | [diff] [blame] | 19 | #include "sync/protocol/sync_protocol_error.h" |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 20 | #include "testing/gmock/include/gmock/gmock.h" |
| 21 | |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 22 | class ProfileSyncServiceMock : public ProfileSyncService { |
| 23 | public: |
vabr | 596777d | 2015-12-09 15:54:04 | [diff] [blame^] | 24 | 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] | 3339229 | 2011-01-05 17:56:39 | [diff] [blame] | 32 | virtual ~ProfileSyncServiceMock(); |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 33 | |
[email protected] | d85f0ac4 | 2014-07-22 00:36:20 | [diff] [blame] | 34 | MOCK_METHOD4(OnBackendInitialized, |
[email protected] | 12a11e2 | 2012-11-08 06:26:30 | [diff] [blame] | 35 | void(const syncer::WeakHandle<syncer::JsBackend>&, |
| 36 | const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, |
[email protected] | d85f0ac4 | 2014-07-22 00:36:20 | [diff] [blame] | 37 | const std::string&, |
[email protected] | 12a11e2 | 2012-11-08 06:26:30 | [diff] [blame] | 38 | bool)); |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 39 | MOCK_METHOD0(OnSyncCycleCompleted, void()); |
[email protected] | c8a61d09 | 2012-03-23 17:22:45 | [diff] [blame] | 40 | MOCK_METHOD2(OnUserChoseDatatypes, |
| 41 | void(bool sync_everything, |
[email protected] | a4a14765 | 2012-07-03 23:41:32 | [diff] [blame] | 42 | syncer::ModelTypeSet chosen_types)); |
[email protected] | c8a61d09 | 2012-03-23 17:22:45 | [diff] [blame] | 43 | |
[email protected] | f6ec8b2 | 2010-06-08 23:40:06 | [diff] [blame] | 44 | MOCK_METHOD2(OnUnrecoverableError, |
| 45 | void(const tracked_objects::Location& location, |
| 46 | const std::string& message)); |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 47 | MOCK_CONST_METHOD0(GetUserShare, syncer::UserShare*()); |
maxbogue | cd3fad6b | 2015-06-09 00:44:53 | [diff] [blame] | 48 | MOCK_METHOD0(RequestStart, void()); |
maxbogue | 699262c9 | 2015-06-19 19:24:58 | [diff] [blame] | 49 | MOCK_METHOD1(RequestStop, void(ProfileSyncService::SyncStopDataFate)); |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 50 | |
droger | 507e7e2f | 2015-04-03 18:56:23 | [diff] [blame] | 51 | MOCK_METHOD1(AddObserver, void(sync_driver::SyncServiceObserver*)); |
| 52 | MOCK_METHOD1(RemoveObserver, void(sync_driver::SyncServiceObserver*)); |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 53 | MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>()); |
[email protected] | 4772b07 | 2010-03-30 17:45:46 | [diff] [blame] | 54 | MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); |
[email protected] | e78d74e | 2010-04-06 22:49:47 | [diff] [blame] | 55 | |
maxbogue | 81abdf2 | 2015-09-10 17:40:19 | [diff] [blame] | 56 | MOCK_CONST_METHOD0(IsEncryptEverythingAllowed, bool()); |
| 57 | MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool()); |
[email protected] | c8a61d09 | 2012-03-23 17:22:45 | [diff] [blame] | 58 | MOCK_METHOD0(EnableEncryptEverything, void()); |
| 59 | |
[email protected] | e78d74e | 2010-04-06 22:49:47 | [diff] [blame] | 60 | MOCK_METHOD1(ChangePreferredDataTypes, |
[email protected] | a4a14765 | 2012-07-03 23:41:32 | [diff] [blame] | 61 | void(syncer::ModelTypeSet preferred_types)); |
[email protected] | 464d74a | 2013-06-04 07:36:46 | [diff] [blame] | 62 | MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet()); |
[email protected] | a4a14765 | 2012-07-03 23:41:32 | [diff] [blame] | 63 | MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet()); |
| 64 | MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncer::ModelTypeSet()); |
[email protected] | dc55625 | 2011-04-20 01:59:35 | [diff] [blame] | 65 | MOCK_CONST_METHOD0(GetLastSessionSnapshot, |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 66 | syncer::sessions::SyncSessionSnapshot()); |
[email protected] | f1e6e021 | 2010-10-15 20:54:24 | [diff] [blame] | 67 | |
[email protected] | dc445ac3 | 2012-07-19 21:23:49 | [diff] [blame] | 68 | MOCK_METHOD1(QueryDetailedSyncStatus, |
| 69 | bool(browser_sync::SyncBackendHost::Status* result)); |
[email protected] | f5fb1750 | 2011-11-30 11:03:23 | [diff] [blame] | 70 | MOCK_CONST_METHOD0(GetAuthError, const GoogleServiceAuthError&()); |
maxbogue | 81abdf2 | 2015-09-10 17:40:19 | [diff] [blame] | 71 | MOCK_CONST_METHOD0(IsFirstSetupInProgress, bool()); |
[email protected] | a04db82 | 2013-12-11 19:14:40 | [diff] [blame] | 72 | MOCK_CONST_METHOD0(GetLastSyncedTimeString, base::string16()); |
[email protected] | e1c6f126 | 2012-06-14 23:40:10 | [diff] [blame] | 73 | MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); |
maxbogue | 192b360 | 2015-06-04 00:33:55 | [diff] [blame] | 74 | MOCK_CONST_METHOD0(IsSyncActive, bool()); |
maxbogue | 81abdf2 | 2015-09-10 17:40:19 | [diff] [blame] | 75 | MOCK_CONST_METHOD0(IsBackendInitialized, bool()); |
maxbogue | cd3fad6b | 2015-06-09 00:44:53 | [diff] [blame] | 76 | MOCK_CONST_METHOD0(IsSyncRequested, bool()); |
[email protected] | a41e100e | 2012-02-23 17:59:24 | [diff] [blame] | 77 | MOCK_CONST_METHOD0(waiting_for_auth, bool()); |
bauerb | f03588b9 | 2014-10-27 13:40:15 | [diff] [blame] | 78 | MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&)); |
[email protected] | 008da42 | 2012-11-30 22:25:51 | [diff] [blame] | 79 | MOCK_METHOD1(SetSetupInProgress, void(bool)); |
stanisc | 3724e60 | 2014-09-22 16:46:49 | [diff] [blame] | 80 | MOCK_CONST_METHOD1(IsDataTypeControllerRunning, bool(syncer::ModelType)); |
[email protected] | cd1acaf4 | 2013-08-02 22:35:26 | [diff] [blame] | 81 | |
[email protected] | 1db7bae | 2012-08-17 22:37:02 | [diff] [blame] | 82 | // DataTypeManagerObserver mocks. |
[email protected] | 1db7bae | 2012-08-17 22:37:02 | [diff] [blame] | 83 | MOCK_METHOD1(OnConfigureDone, |
[email protected] | 49fef794 | 2014-07-22 23:26:47 | [diff] [blame] | 84 | void(const sync_driver::DataTypeManager::ConfigureResult&)); |
[email protected] | 1db7bae | 2012-08-17 22:37:02 | [diff] [blame] | 85 | MOCK_METHOD0(OnConfigureStart, void()); |
| 86 | |
maxbogue | 96b7d27 | 2015-06-16 02:59:58 | [diff] [blame] | 87 | MOCK_CONST_METHOD0(CanSyncStart, bool()); |
[email protected] | 08fafe4 | 2013-02-03 08:10:49 | [diff] [blame] | 88 | MOCK_CONST_METHOD0(IsManaged, bool()); |
[email protected] | b67c18c | 2013-06-13 23:52:03 | [diff] [blame] | 89 | MOCK_METHOD0(IsOAuthRefreshTokenAvailable, bool()); |
[email protected] | a41e100e | 2012-02-23 17:59:24 | [diff] [blame] | 90 | |
[email protected] | 83c130c | 2011-10-12 08:39:16 | [diff] [blame] | 91 | MOCK_CONST_METHOD0(IsPassphraseRequired, bool()); |
| 92 | MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool()); |
[email protected] | c8a61d09 | 2012-03-23 17:22:45 | [diff] [blame] | 93 | MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool()); |
[email protected] | f6661cc | 2012-10-12 02:22:43 | [diff] [blame] | 94 | MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType()); |
[email protected] | a374519 | 2013-04-03 03:55:44 | [diff] [blame] | 95 | MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time()); |
[email protected] | c8a61d09 | 2012-03-23 17:22:45 | [diff] [blame] | 96 | |
| 97 | MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase)); |
| 98 | MOCK_METHOD2(SetEncryptionPassphrase, void(const std::string& passphrase, |
| 99 | PassphraseType type)); |
[email protected] | 13a23988 | 2014-06-10 18:06:26 | [diff] [blame] | 100 | |
| 101 | MOCK_METHOD1(StartUpSlowBackendComponents, void(BackendMode)); |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |