| 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_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/sync_file_system/file_status_observer.h" | 12 #include "chrome/browser/sync_file_system/file_status_observer.h" |
| 13 #include "chrome/browser/sync_file_system/mock_local_change_processor.h" | 13 #include "chrome/browser/sync_file_system/mock_local_change_processor.h" |
| 14 #include "chrome/browser/sync_file_system/remote_change_processor.h" | 14 #include "chrome/browser/sync_file_system/remote_change_processor.h" |
| 15 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" | 15 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "webkit/browser/fileapi/syncable/sync_callbacks.h" | 18 #include "webkit/browser/fileapi/syncable/sync_callbacks.h" |
| 19 #include "webkit/browser/fileapi/syncable/sync_direction.h" | 19 #include "webkit/browser/fileapi/syncable/sync_direction.h" |
| 20 #include "webkit/browser/fileapi/syncable/sync_file_metadata.h" | 20 #include "webkit/browser/fileapi/syncable/sync_file_metadata.h" |
| 21 | 21 |
| 22 namespace sync_file_system { | 22 namespace sync_file_system { |
| 23 | 23 |
| 24 class MockRemoteFileSyncService : public RemoteFileSyncService { | 24 class MockRemoteFileSyncService : public RemoteFileSyncService { |
| 25 public: | 25 public: |
| 26 static const char kServiceName[]; | |
| 27 | |
| 28 MockRemoteFileSyncService(); | 26 MockRemoteFileSyncService(); |
| 29 virtual ~MockRemoteFileSyncService(); | 27 virtual ~MockRemoteFileSyncService(); |
| 30 | 28 |
| 31 // RemoteFileSyncService overrides. | 29 // RemoteFileSyncService overrides. |
| 32 MOCK_METHOD1(AddServiceObserver, | 30 MOCK_METHOD1(AddServiceObserver, |
| 33 void(RemoteFileSyncService::Observer* observer)); | 31 void(RemoteFileSyncService::Observer* observer)); |
| 34 MOCK_METHOD1(AddFileStatusObserver, | 32 MOCK_METHOD1(AddFileStatusObserver, |
| 35 void(FileStatusObserver* observer)); | 33 void(FileStatusObserver* observer)); |
| 36 MOCK_METHOD2(RegisterOriginForTrackingChanges, | 34 MOCK_METHOD2(RegisterOriginForTrackingChanges, |
| 37 void(const GURL& origin, const SyncStatusCallback& callback)); | 35 void(const GURL& origin, const SyncStatusCallback& callback)); |
| 38 MOCK_METHOD2(UnregisterOriginForTrackingChanges, | 36 MOCK_METHOD2(UnregisterOriginForTrackingChanges, |
| 39 void(const GURL& origin, const SyncStatusCallback& callback)); | 37 void(const GURL& origin, const SyncStatusCallback& callback)); |
| 40 MOCK_METHOD2(EnableOriginForTrackingChanges, | 38 MOCK_METHOD2(EnableOriginForTrackingChanges, |
| 41 void(const GURL& origin, const SyncStatusCallback& callback)); | 39 void(const GURL& origin, const SyncStatusCallback& callback)); |
| 42 MOCK_METHOD2(DisableOriginForTrackingChanges, | 40 MOCK_METHOD2(DisableOriginForTrackingChanges, |
| 43 void(const GURL& origin, const SyncStatusCallback& callback)); | 41 void(const GURL& origin, const SyncStatusCallback& callback)); |
| 44 MOCK_METHOD2(UninstallOrigin, | 42 MOCK_METHOD2(UninstallOrigin, |
| 45 void(const GURL& origin, const SyncStatusCallback& callback)); | 43 void(const GURL& origin, const SyncStatusCallback& callback)); |
| 46 MOCK_METHOD1(ProcessRemoteChange, | 44 MOCK_METHOD1(ProcessRemoteChange, |
| 47 void(const SyncFileCallback& callback)); | 45 void(const SyncFileCallback& callback)); |
| 48 MOCK_METHOD1(SetRemoteChangeProcessor, | 46 MOCK_METHOD1(SetRemoteChangeProcessor, |
| 49 void(RemoteChangeProcessor* processor)); | 47 void(RemoteChangeProcessor* processor)); |
| 50 MOCK_METHOD0(GetLocalChangeProcessor, LocalChangeProcessor*()); | 48 MOCK_METHOD0(GetLocalChangeProcessor, LocalChangeProcessor*()); |
| 51 MOCK_METHOD1(IsConflicting, bool(const fileapi::FileSystemURL& url)); | 49 MOCK_METHOD1(IsConflicting, bool(const fileapi::FileSystemURL& url)); |
| 52 MOCK_CONST_METHOD0(GetCurrentState, | 50 MOCK_CONST_METHOD0(GetCurrentState, |
| 53 RemoteServiceState()); | 51 RemoteServiceState()); |
| 54 MOCK_CONST_METHOD0(GetServiceName, const char*()); | |
| 55 MOCK_METHOD1(SetSyncEnabled, void(bool)); | 52 MOCK_METHOD1(SetSyncEnabled, void(bool)); |
| 56 MOCK_METHOD1(SetConflictResolutionPolicy, | 53 MOCK_METHOD1(SetConflictResolutionPolicy, |
| 57 SyncStatusCode(ConflictResolutionPolicy)); | 54 SyncStatusCode(ConflictResolutionPolicy)); |
| 58 MOCK_CONST_METHOD0(GetConflictResolutionPolicy, | 55 MOCK_CONST_METHOD0(GetConflictResolutionPolicy, |
| 59 ConflictResolutionPolicy()); | 56 ConflictResolutionPolicy()); |
| 60 | 57 |
| 61 // Send notifications to the observers. | 58 // Send notifications to the observers. |
| 62 // Can be used in the mock implementation. | 59 // Can be used in the mock implementation. |
| 63 void NotifyRemoteChangeQueueUpdated(int64 pending_changes); | 60 void NotifyRemoteChangeQueueUpdated(int64 pending_changes); |
| 64 void NotifyRemoteServiceStateUpdated( | 61 void NotifyRemoteServiceStateUpdated( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 ObserverList<FileStatusObserver> file_status_observers_; | 88 ObserverList<FileStatusObserver> file_status_observers_; |
| 92 | 89 |
| 93 ConflictResolutionPolicy conflict_resolution_policy_; | 90 ConflictResolutionPolicy conflict_resolution_policy_; |
| 94 | 91 |
| 95 DISALLOW_COPY_AND_ASSIGN(MockRemoteFileSyncService); | 92 DISALLOW_COPY_AND_ASSIGN(MockRemoteFileSyncService); |
| 96 }; | 93 }; |
| 97 | 94 |
| 98 } // namespace sync_file_system | 95 } // namespace sync_file_system |
| 99 | 96 |
| 100 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ | 97 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |