Chromium Code Reviews| Index: components/sync/model/recording_model_type_change_processor.h |
| diff --git a/components/sync/model/recording_model_type_change_processor.h b/components/sync/model/recording_model_type_change_processor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5d225bd198ff680f8287fa0f80af9c28da876d79 |
| --- /dev/null |
| +++ b/components/sync/model/recording_model_type_change_processor.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |
| +#define COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |
| + |
| +#include "components/sync/model/fake_model_type_change_processor.h" |
| + |
| +namespace syncer { |
| + |
| +// Augmented FakeModelTypeChangeProcessor that accumulates all instructions in |
| +// members that can then be accessed for verification. |
| +class RecordingModelTypeChangeProcessor : public FakeModelTypeChangeProcessor { |
| + public: |
| + RecordingModelTypeChangeProcessor(); |
| + ~RecordingModelTypeChangeProcessor() override; |
| + |
| + // FakeModelTypeChangeProcessor overrides. |
| + void Put(const std::string& storage_key, |
| + std::unique_ptr<EntityData> entity_data, |
| + MetadataChangeList* metadata_changes) override; |
| + void Delete(const std::string& storage_key, |
| + MetadataChangeList* metadata_changes) override; |
| + void OnMetadataLoaded(std::unique_ptr<MetadataBatch> batch) override; |
| + bool IsTrackingMetadata() override; |
| + |
| + void SetIsTrackingMetadata(bool is_tracking); |
| + |
| + const inline std::multimap<std::string, std::unique_ptr<EntityData>>& |
|
maxbogue
2017/01/14 00:39:02
you don't actually need (or want) the inline keywo
|
| + put_multimap() const { |
| + return put_multimap_; |
| + } |
| + |
| + const inline std::set<std::string>& delete_set() const { return delete_set_; } |
| + |
| + const inline MetadataBatch* metadata() const { return metadata_.get(); } |
| + |
| + private: |
| + std::multimap<std::string, std::unique_ptr<EntityData>> put_multimap_; |
| + std::set<std::string> delete_set_; |
| + std::unique_ptr<MetadataBatch> metadata_; |
| + bool is_tracking_metadata_ = true; |
| +}; |
| + |
| +} // namespace syncer |
| + |
| +#endif // COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |