OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "chrome/browser/sync/glue/change_processor.h" | 13 #include "chrome/browser/sync/glue/change_processor.h" |
14 #include "chrome/browser/sync/glue/data_type_controller.h" | 14 #include "chrome/browser/sync/glue/data_type_controller.h" |
15 #include "chrome/browser/sync/glue/device_info.h" | 15 #include "chrome/browser/sync/glue/device_info.h" |
16 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "google_apis/gaia/google_service_auth_error.h" | 18 #include "google_apis/gaia/google_service_auth_error.h" |
19 #include "sync/internal_api/public/base/model_type.h" | 19 #include "sync/internal_api/public/base/model_type.h" |
20 #include "sync/protocol/sync_protocol_error.h" | 20 #include "sync/protocol/sync_protocol_error.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 | 22 |
| 23 using ::testing::Invoke; |
| 24 |
23 class ProfileSyncServiceMock : public ProfileSyncService { | 25 class ProfileSyncServiceMock : public ProfileSyncService { |
24 public: | 26 public: |
25 // no-arg constructor provided so TestingProfile can use NiceMock. | 27 // no-arg constructor provided so TestingProfile can use NiceMock. |
26 ProfileSyncServiceMock(); | 28 ProfileSyncServiceMock(); |
27 explicit ProfileSyncServiceMock(Profile* profile); | 29 explicit ProfileSyncServiceMock(Profile* profile); |
28 virtual ~ProfileSyncServiceMock(); | 30 virtual ~ProfileSyncServiceMock(); |
29 | 31 |
30 // A utility used by sync tests to create a TestingProfile with a Google | 32 // A utility used by sync tests to create a TestingProfile with a Google |
31 // Services username stored in a (Testing)PrefService. | 33 // Services username stored in a (Testing)PrefService. |
32 static TestingProfile* MakeSignedInTestingProfile(); | 34 static TestingProfile* MakeSignedInTestingProfile(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 MOCK_CONST_METHOD0(FirstSetupInProgress, bool()); | 91 MOCK_CONST_METHOD0(FirstSetupInProgress, bool()); |
90 MOCK_CONST_METHOD0(GetLastSyncedTimeString, string16()); | 92 MOCK_CONST_METHOD0(GetLastSyncedTimeString, string16()); |
91 MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); | 93 MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); |
92 MOCK_CONST_METHOD0(sync_initialized, bool()); | 94 MOCK_CONST_METHOD0(sync_initialized, bool()); |
93 MOCK_CONST_METHOD0(IsStartSuppressed, bool()); | 95 MOCK_CONST_METHOD0(IsStartSuppressed, bool()); |
94 MOCK_CONST_METHOD0(waiting_for_auth, bool()); | 96 MOCK_CONST_METHOD0(waiting_for_auth, bool()); |
95 MOCK_METHOD1(OnActionableError, void( | 97 MOCK_METHOD1(OnActionableError, void( |
96 const syncer::SyncProtocolError&)); | 98 const syncer::SyncProtocolError&)); |
97 MOCK_METHOD1(SetSetupInProgress, void(bool)); | 99 MOCK_METHOD1(SetSetupInProgress, void(bool)); |
98 | 100 |
99 MOCK_CONST_METHOD0(GetAllSignedInDevicesMock, | 101 MOCK_CONST_METHOD0(GetAllSignedinDevicesMock, |
100 std::vector<browser_sync::DeviceInfo*>* ()); | 102 std::vector<browser_sync::DeviceInfo*>* ()); |
101 // This is to get around the fact that GMOCK does not handle Scoped*. | 103 // This is to get around the fact that GMOCK does not handle Scoped*. |
102 virtual ScopedVector<browser_sync::DeviceInfo> | 104 virtual ScopedVector<browser_sync::DeviceInfo> |
103 GetAllSignedInDevices() const OVERRIDE; | 105 GetAllSignedinDevices() const OVERRIDE; |
104 | 106 |
105 // DataTypeManagerObserver mocks. | 107 // DataTypeManagerObserver mocks. |
106 MOCK_METHOD0(OnConfigureBlocked, void()); | 108 MOCK_METHOD0(OnConfigureBlocked, void()); |
107 MOCK_METHOD1(OnConfigureDone, | 109 MOCK_METHOD1(OnConfigureDone, |
108 void(const browser_sync::DataTypeManager::ConfigureResult&)); | 110 void(const browser_sync::DataTypeManager::ConfigureResult&)); |
109 MOCK_METHOD0(OnConfigureRetry, void()); | 111 MOCK_METHOD0(OnConfigureRetry, void()); |
110 MOCK_METHOD0(OnConfigureStart, void()); | 112 MOCK_METHOD0(OnConfigureStart, void()); |
111 | 113 |
112 MOCK_METHOD0(IsSyncEnabledAndLoggedIn, bool()); | 114 MOCK_METHOD0(IsSyncEnabledAndLoggedIn, bool()); |
113 MOCK_CONST_METHOD0(IsManaged, bool()); | 115 MOCK_CONST_METHOD0(IsManaged, bool()); |
114 MOCK_METHOD0(IsOAuthRefreshTokenAvailable, bool()); | 116 MOCK_METHOD0(IsOAuthRefreshTokenAvailable, bool()); |
115 | 117 |
116 MOCK_CONST_METHOD0(IsPassphraseRequired, bool()); | 118 MOCK_CONST_METHOD0(IsPassphraseRequired, bool()); |
117 MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool()); | 119 MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool()); |
118 MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool()); | 120 MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool()); |
119 MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType()); | 121 MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType()); |
120 MOCK_CONST_METHOD0(GetPassphraseTime, base::Time()); | 122 MOCK_CONST_METHOD0(GetPassphraseTime, base::Time()); |
121 MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time()); | 123 MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time()); |
122 | 124 |
123 MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase)); | 125 MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase)); |
124 MOCK_METHOD2(SetEncryptionPassphrase, void(const std::string& passphrase, | 126 MOCK_METHOD2(SetEncryptionPassphrase, void(const std::string& passphrase, |
125 PassphraseType type)); | 127 PassphraseType type)); |
126 }; | 128 }; |
127 | 129 |
128 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ | 130 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_MOCK_H_ |
OLD | NEW |