1 // Copyright 2014 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_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h"
14 #include "base/sequence_checker.h"
15 #include "chrome/browser/sync_file_system/drive_backend/sync_worker_interface.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 "net/base/network_change_notifier.h"
28 class DriveServiceInterface
;
29 class DriveUploaderInterface
;
36 namespace sync_file_system
{
39 class SyncFileMetadata
;
41 namespace drive_backend
{
43 class MetadataDatabase
;
44 class RemoteChangeProcessorOnWorker
;
45 class SyncEngineContext
;
46 class SyncTaskManager
;
48 class FakeSyncWorker
: public SyncWorkerInterface
{
51 ~FakeSyncWorker() override
;
53 // SyncWorkerInterface overrides.
54 void Initialize(scoped_ptr
<SyncEngineContext
> sync_engine_context
) override
;
55 void RegisterOrigin(const GURL
& origin
,
56 const SyncStatusCallback
& callback
) override
;
57 void EnableOrigin(const GURL
& origin
,
58 const SyncStatusCallback
& callback
) override
;
59 void DisableOrigin(const GURL
& origin
,
60 const SyncStatusCallback
& callback
) override
;
61 void UninstallOrigin(const GURL
& origin
,
62 RemoteFileSyncService::UninstallFlag flag
,
63 const SyncStatusCallback
& callback
) override
;
64 void ProcessRemoteChange(const SyncFileCallback
& callback
) override
;
65 void SetRemoteChangeProcessor(RemoteChangeProcessorOnWorker
*
66 remote_change_processor_on_worker
) override
;
67 RemoteServiceState
GetCurrentState() const override
;
68 void GetOriginStatusMap(
69 const RemoteFileSyncService::StatusMapCallback
& callback
) override
;
70 scoped_ptr
<base::ListValue
> DumpFiles(const GURL
& origin
) override
;
71 scoped_ptr
<base::ListValue
> DumpDatabase() override
;
72 void SetSyncEnabled(bool enabled
) override
;
73 void PromoteDemotedChanges(const base::Closure
& callback
) override
;
74 void ApplyLocalChange(const FileChange
& local_change
,
75 const base::FilePath
& local_path
,
76 const SyncFileMetadata
& local_metadata
,
77 const storage::FileSystemURL
& url
,
78 const SyncStatusCallback
& callback
) override
;
79 void ActivateService(RemoteServiceState service_state
,
80 const std::string
& description
) override
;
81 void DeactivateService(const std::string
& description
) override
;
82 void DetachFromSequence() override
;
83 void AddObserver(Observer
* observer
) override
;
86 friend class SyncEngineTest
;
94 typedef std::map
<GURL
, AppStatus
> StatusMap
;
96 void UpdateServiceState(RemoteServiceState state
,
97 const std::string
& description
);
100 StatusMap status_map_
;
102 scoped_ptr
<SyncEngineContext
> sync_engine_context_
;
104 base::ObserverList
<Observer
> observers_
;
105 base::SequenceChecker sequence_checker_
;
107 DISALLOW_COPY_AND_ASSIGN(FakeSyncWorker
);
110 } // namespace drive_backend
111 } // namespace sync_file_system
113 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_