Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: components/sync/driver/fake_generic_change_processor.h

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_
6 #define COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_ 6 #define COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/sync/api/sync_error.h" 12 #include "components/sync/api/sync_error.h"
13 #include "components/sync/base/model_type.h" 13 #include "components/sync/base/model_type.h"
14 #include "components/sync/driver/generic_change_processor.h" 14 #include "components/sync/driver/generic_change_processor.h"
15 #include "components/sync/driver/generic_change_processor_factory.h" 15 #include "components/sync/driver/generic_change_processor_factory.h"
16 #include "components/sync/driver/sync_api_component_factory.h" 16 #include "components/sync/driver/sync_api_component_factory.h"
17 17
18 namespace sync_driver { 18 namespace syncer {
19 19
20 // A fake GenericChangeProcessor that can return arbitrary values. 20 // A fake GenericChangeProcessor that can return arbitrary values.
21 class FakeGenericChangeProcessor : public GenericChangeProcessor { 21 class FakeGenericChangeProcessor : public GenericChangeProcessor {
22 public: 22 public:
23 FakeGenericChangeProcessor(syncer::ModelType type, SyncClient* sync_client); 23 FakeGenericChangeProcessor(ModelType type, SyncClient* sync_client);
24 ~FakeGenericChangeProcessor() override; 24 ~FakeGenericChangeProcessor() override;
25 25
26 // Setters for GenericChangeProcessor implementation results. 26 // Setters for GenericChangeProcessor implementation results.
27 void set_sync_model_has_user_created_nodes(bool has_nodes); 27 void set_sync_model_has_user_created_nodes(bool has_nodes);
28 void set_sync_model_has_user_created_nodes_success(bool success); 28 void set_sync_model_has_user_created_nodes_success(bool success);
29 29
30 // GenericChangeProcessor implementations. 30 // GenericChangeProcessor implementations.
31 syncer::SyncError ProcessSyncChanges( 31 SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
32 const tracked_objects::Location& from_here, 32 const SyncChangeList& change_list) override;
33 const syncer::SyncChangeList& change_list) override; 33 SyncError GetAllSyncDataReturnError(SyncDataList* data) const override;
34 syncer::SyncError GetAllSyncDataReturnError(
35 syncer::SyncDataList* data) const override;
36 bool GetDataTypeContext(std::string* context) const override; 34 bool GetDataTypeContext(std::string* context) const override;
37 int GetSyncCount() override; 35 int GetSyncCount() override;
38 bool SyncModelHasUserCreatedNodes(bool* has_nodes) override; 36 bool SyncModelHasUserCreatedNodes(bool* has_nodes) override;
39 bool CryptoReadyIfNecessary() override; 37 bool CryptoReadyIfNecessary() override;
40 38
41 private: 39 private:
42 bool sync_model_has_user_created_nodes_; 40 bool sync_model_has_user_created_nodes_;
43 bool sync_model_has_user_created_nodes_success_; 41 bool sync_model_has_user_created_nodes_success_;
44 }; 42 };
45 43
46 // Define a factory for FakeGenericChangeProcessor for convenience. 44 // Define a factory for FakeGenericChangeProcessor for convenience.
47 class FakeGenericChangeProcessorFactory : public GenericChangeProcessorFactory { 45 class FakeGenericChangeProcessorFactory : public GenericChangeProcessorFactory {
48 public: 46 public:
49 explicit FakeGenericChangeProcessorFactory( 47 explicit FakeGenericChangeProcessorFactory(
50 std::unique_ptr<FakeGenericChangeProcessor> processor); 48 std::unique_ptr<FakeGenericChangeProcessor> processor);
51 ~FakeGenericChangeProcessorFactory() override; 49 ~FakeGenericChangeProcessorFactory() override;
52 std::unique_ptr<GenericChangeProcessor> CreateGenericChangeProcessor( 50 std::unique_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
53 syncer::ModelType type, 51 ModelType type,
54 syncer::UserShare* user_share, 52 UserShare* user_share,
55 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler, 53 std::unique_ptr<DataTypeErrorHandler> error_handler,
56 const base::WeakPtr<syncer::SyncableService>& local_service, 54 const base::WeakPtr<SyncableService>& local_service,
57 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, 55 const base::WeakPtr<SyncMergeResult>& merge_result,
58 SyncClient* sync_client) override; 56 SyncClient* sync_client) override;
59 57
60 private: 58 private:
61 std::unique_ptr<FakeGenericChangeProcessor> processor_; 59 std::unique_ptr<FakeGenericChangeProcessor> processor_;
62 DISALLOW_COPY_AND_ASSIGN(FakeGenericChangeProcessorFactory); 60 DISALLOW_COPY_AND_ASSIGN(FakeGenericChangeProcessorFactory);
63 }; 61 };
64 62
65 } // namespace sync_driver 63 } // namespace syncer
66 64
67 #endif // COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_ 65 #endif // COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « components/sync/driver/fake_data_type_controller.cc ('k') | components/sync/driver/fake_generic_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698