Disable firewall check. It takes signifficant time, need to be on FILE thread.
[chromium-blink-merge.git] / components / sync_driver / fake_generic_change_processor.h
blobbe9201b5e495026cc96c431514b5648b029a12e6
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 COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_
6 #define COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_
8 #include "components/sync_driver/generic_change_processor.h"
10 #include "components/sync_driver/generic_change_processor_factory.h"
11 #include "sync/api/sync_error.h"
13 namespace browser_sync {
15 // A fake GenericChangeProcessor that can return arbitrary values.
16 class FakeGenericChangeProcessor : public GenericChangeProcessor {
17 public:
18 FakeGenericChangeProcessor();
19 virtual ~FakeGenericChangeProcessor();
21 // Setters for GenericChangeProcessor implementation results.
22 void set_sync_model_has_user_created_nodes(bool has_nodes);
23 void set_sync_model_has_user_created_nodes_success(bool success);
25 // GenericChangeProcessor implementations.
26 virtual syncer::SyncError ProcessSyncChanges(
27 const tracked_objects::Location& from_here,
28 const syncer::SyncChangeList& change_list) OVERRIDE;
29 virtual syncer::SyncError GetAllSyncDataReturnError(
30 syncer::ModelType type,
31 syncer::SyncDataList* data) const OVERRIDE;
32 virtual bool GetDataTypeContext(syncer::ModelType type,
33 std::string* context) const OVERRIDE;
34 virtual int GetSyncCountForType(syncer::ModelType type) OVERRIDE;
35 virtual bool SyncModelHasUserCreatedNodes(syncer::ModelType type,
36 bool* has_nodes) OVERRIDE;
37 virtual bool CryptoReadyIfNecessary(syncer::ModelType type) OVERRIDE;
39 private:
40 bool sync_model_has_user_created_nodes_;
41 bool sync_model_has_user_created_nodes_success_;
44 // Define a factory for FakeGenericChangeProcessor for convenience.
45 class FakeGenericChangeProcessorFactory : public GenericChangeProcessorFactory {
46 public:
47 explicit FakeGenericChangeProcessorFactory(
48 scoped_ptr<FakeGenericChangeProcessor> processor);
49 virtual ~FakeGenericChangeProcessorFactory();
50 virtual scoped_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
51 syncer::UserShare* user_share,
52 browser_sync::DataTypeErrorHandler* error_handler,
53 const base::WeakPtr<syncer::SyncableService>& local_service,
54 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
55 scoped_ptr<syncer::AttachmentService> attachment_service) OVERRIDE;
56 private:
57 scoped_ptr<FakeGenericChangeProcessor> processor_;
58 DISALLOW_COPY_AND_ASSIGN(FakeGenericChangeProcessorFactory);
61 } // namespace browser_sync
63 #endif // COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_