Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / glue / sync_backend_host_mock.h
1 // Copyright 2013 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.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/sync/glue/sync_backend_host.h"
13 #include "sync/internal_api/public/util/weak_handle.h"
14
15 namespace browser_sync {
16
17 // A mock of the SyncBackendHost.
18 //
19 // This class implements the bare minimum required for the ProfileSyncService to
20 // get through initialization.  It often returns NULL pointers or nonesense
21 // values; it is not intended to be used in tests that depend on SyncBackendHost
22 // behavior.
23 class SyncBackendHostMock : public SyncBackendHost {
24  public:
25   SyncBackendHostMock();
26   virtual ~SyncBackendHostMock();
27
28   virtual void Initialize(
29       sync_driver::SyncFrontend* frontend,
30       scoped_ptr<base::Thread> sync_thread,
31       const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
32       const GURL& service_url,
33       const syncer::SyncCredentials& credentials,
34       bool delete_sync_data_folder,
35       scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
36       scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler,
37       syncer::ReportUnrecoverableErrorFunction
38           report_unrecoverable_error_function,
39       syncer::NetworkResources* network_resources) OVERRIDE;
40
41   virtual void UpdateCredentials(
42       const syncer::SyncCredentials& credentials) OVERRIDE;
43
44   virtual void StartSyncingWithServer() OVERRIDE;
45
46   virtual void SetEncryptionPassphrase(
47       const std::string& passphrase,
48       bool is_explicit) OVERRIDE;
49
50   virtual bool SetDecryptionPassphrase(
51       const std::string& passphrase) OVERRIDE;
52
53   virtual void StopSyncingForShutdown() OVERRIDE;
54
55   virtual scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason)
56       OVERRIDE;
57
58   virtual void UnregisterInvalidationIds() OVERRIDE;
59
60   virtual void ConfigureDataTypes(
61       syncer::ConfigureReason reason,
62       const DataTypeConfigStateMap& config_state_map,
63       const base::Callback<void(syncer::ModelTypeSet,
64                                 syncer::ModelTypeSet)>& ready_task,
65       const base::Callback<void()>& retry_callback) OVERRIDE;
66
67   virtual void EnableEncryptEverything() OVERRIDE;
68
69   virtual void ActivateDataType(
70       syncer::ModelType type, syncer::ModelSafeGroup group,
71       sync_driver::ChangeProcessor* change_processor) OVERRIDE;
72   virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE;
73
74   virtual syncer::UserShare* GetUserShare() const OVERRIDE;
75
76   virtual scoped_ptr<syncer::SyncContextProxy> GetSyncContextProxy() OVERRIDE;
77
78   virtual Status GetDetailedStatus() OVERRIDE;
79
80   virtual syncer::sessions::SyncSessionSnapshot
81       GetLastSessionSnapshot() const OVERRIDE;
82
83   virtual bool HasUnsyncedItems() const OVERRIDE;
84
85   virtual bool IsNigoriEnabled() const OVERRIDE;
86
87   virtual syncer::PassphraseType GetPassphraseType() const OVERRIDE;
88
89   virtual base::Time GetExplicitPassphraseTime() const OVERRIDE;
90
91   virtual bool IsCryptographerReady(
92       const syncer::BaseTransaction* trans) const OVERRIDE;
93
94   virtual void GetModelSafeRoutingInfo(
95       syncer::ModelSafeRoutingInfo* out) const OVERRIDE;
96
97   virtual SyncedDeviceTracker* GetSyncedDeviceTracker() const OVERRIDE;
98
99   virtual void RequestBufferedProtocolEventsAndEnableForwarding() OVERRIDE;
100   virtual void DisableProtocolEventForwarding() OVERRIDE;
101
102   virtual void EnableDirectoryTypeDebugInfoForwarding() OVERRIDE;
103   virtual void DisableDirectoryTypeDebugInfoForwarding() OVERRIDE;
104
105   virtual void GetAllNodesForTypes(
106       syncer::ModelTypeSet types,
107       base::Callback<void(const std::vector<syncer::ModelType>& type,
108                           ScopedVector<base::ListValue>) > callback) OVERRIDE;
109
110   virtual base::MessageLoop* GetSyncLoopForTesting() OVERRIDE;
111
112   void set_fail_initial_download(bool should_fail);
113
114  private:
115   bool fail_initial_download_;
116 };
117
118 }  // namespace browser_sync
119
120 #endif  // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_MOCK_H_