Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / mock_remote_file_sync_service.h
blob456c6f7b143653418a300ebed954bd93e43fcdf4
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
3 // found in the LICENSE file.
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "base/values.h"
13 #include "chrome/browser/sync_file_system/file_status_observer.h"
14 #include "chrome/browser/sync_file_system/mock_local_change_processor.h"
15 #include "chrome/browser/sync_file_system/remote_change_processor.h"
16 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
17 #include "chrome/browser/sync_file_system/sync_callbacks.h"
18 #include "chrome/browser/sync_file_system/sync_direction.h"
19 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "url/gurl.h"
23 namespace sync_file_system {
25 class MockRemoteFileSyncService : public RemoteFileSyncService {
26 public:
27 MockRemoteFileSyncService();
28 virtual ~MockRemoteFileSyncService();
30 // RemoteFileSyncService overrides.
31 MOCK_METHOD1(AddServiceObserver,
32 void(RemoteFileSyncService::Observer* observer));
33 MOCK_METHOD1(AddFileStatusObserver,
34 void(FileStatusObserver* observer));
35 MOCK_METHOD2(RegisterOrigin,
36 void(const GURL& origin, const SyncStatusCallback& callback));
37 MOCK_METHOD2(EnableOrigin,
38 void(const GURL& origin, const SyncStatusCallback& callback));
39 MOCK_METHOD2(DisableOrigin,
40 void(const GURL& origin, const SyncStatusCallback& callback));
41 MOCK_METHOD3(UninstallOrigin,
42 void(const GURL& origin,
43 UninstallFlag flag,
44 const SyncStatusCallback& callback));
45 MOCK_METHOD1(ProcessRemoteChange,
46 void(const SyncFileCallback& callback));
47 MOCK_METHOD1(SetRemoteChangeProcessor,
48 void(RemoteChangeProcessor* processor));
49 MOCK_METHOD0(GetLocalChangeProcessor, LocalChangeProcessor*());
50 MOCK_CONST_METHOD0(GetCurrentState,
51 RemoteServiceState());
52 MOCK_METHOD1(GetOriginStatusMap,
53 void(const StatusMapCallback& callback));
54 MOCK_METHOD1(SetSyncEnabled, void(bool enabled));
55 MOCK_METHOD1(PromoteDemotedChanges, void(const base::Closure& callback));
57 void DumpFiles(const GURL& origin, const ListCallback& callback) override;
58 void DumpDatabase(const ListCallback& callback) override;
60 void SetServiceState(RemoteServiceState state);
62 // Send notifications to the observers.
63 // Can be used in the mock implementation.
64 void NotifyRemoteChangeQueueUpdated(int64 pending_changes);
65 void NotifyRemoteServiceStateUpdated(
66 RemoteServiceState state,
67 const std::string& description);
68 void NotifyFileStatusChanged(const storage::FileSystemURL& url,
69 SyncFileType file_type,
70 SyncFileStatus sync_status,
71 SyncAction action_taken,
72 SyncDirection direction);
74 private:
75 void AddServiceObserverStub(Observer* observer);
76 void AddFileStatusObserverStub(FileStatusObserver* observer);
77 void RegisterOriginStub(
78 const GURL& origin, const SyncStatusCallback& callback);
79 void DeleteOriginDirectoryStub(
80 const GURL& origin, UninstallFlag flag,
81 const SyncStatusCallback& callback);
82 void ProcessRemoteChangeStub(const SyncFileCallback& callback);
83 RemoteServiceState GetCurrentStateStub() const;
85 // For default implementation.
86 ::testing::NiceMock<MockLocalChangeProcessor> mock_local_change_processor_;
88 base::ObserverList<Observer> service_observers_;
89 base::ObserverList<FileStatusObserver> file_status_observers_;
91 RemoteServiceState state_;
93 DISALLOW_COPY_AND_ASSIGN(MockRemoteFileSyncService);
96 } // namespace sync_file_system
98 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_