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

Unified Diff: sync/internal_api/shared_model_type_processor_unittest.cc

Issue 1486363002: USS: Introduce dependency of SharedModelTypeProcessor on ModelTypeService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/shared_model_type_processor_unittest.cc
diff --git a/sync/internal_api/shared_model_type_processor_unittest.cc b/sync/internal_api/shared_model_type_processor_unittest.cc
index 2cc99981ccb94c5e565be12e1c8baf7c993e3420..6bbed174c5cb49e20c50c29678cd3dc8104ac557 100644
--- a/sync/internal_api/shared_model_type_processor_unittest.cc
+++ b/sync/internal_api/shared_model_type_processor_unittest.cc
@@ -11,6 +11,7 @@
#include "sync/internal_api/public/activation_context.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/non_blocking_sync_common.h"
+#include "sync/internal_api/public/test/fake_model_type_service.h"
#include "sync/protocol/sync.pb.h"
#include "sync/syncable/syncable_util.h"
#include "sync/test/engine/mock_commit_queue.h"
@@ -41,7 +42,8 @@ static const syncer::ModelType kModelType = syncer::PREFERENCES;
// - Writes to permanent storage. (TODO)
// - Callbacks into the model. (TODO)
// - Requests to the sync thread. Tested with MockCommitQueue.
-class SharedModelTypeProcessorTest : public ::testing::Test {
+class SharedModelTypeProcessorTest : public ::testing::Test,
+ public FakeModelTypeService {
public:
SharedModelTypeProcessorTest();
~SharedModelTypeProcessorTest() override;
@@ -129,6 +131,9 @@ class SharedModelTypeProcessorTest : public ::testing::Test {
void StartDone(syncer::SyncError error,
scoped_ptr<ActivationContext> context);
+ // FakeModelTypeService overrides.
+ std::string GetClientTag(const EntityData& entity_data) override;
+
// This sets ThreadTaskRunnerHandle on the current thread, which the type
// processor will pick up as the sync task runner.
base::MessageLoop sync_loop_;
@@ -145,9 +150,7 @@ class SharedModelTypeProcessorTest : public ::testing::Test {
SharedModelTypeProcessorTest::SharedModelTypeProcessorTest()
: mock_queue_(new MockCommitQueue()),
mock_queue_ptr_(mock_queue_),
- type_processor_(
- new SharedModelTypeProcessor(kModelType,
- base::WeakPtr<ModelTypeStore>())) {}
+ type_processor_(new SharedModelTypeProcessor(kModelType, this)) {}
SharedModelTypeProcessorTest::~SharedModelTypeProcessorTest() {}
@@ -338,6 +341,12 @@ SharedModelTypeProcessorTest::GenerateEncryptedSpecifics(
return specifics;
}
+std::string SharedModelTypeProcessorTest::GetClientTag(
+ const EntityData& entity_data) {
+ // The tag is the preference name - see GenerateSpecifics.
+ return entity_data.specifics.preference().name();
+}
+
size_t SharedModelTypeProcessorTest::GetNumCommitRequestLists() {
return mock_queue_->GetNumCommitRequestLists();
}
« no previous file with comments | « sync/internal_api/shared_model_type_processor.cc ('k') | sync/internal_api/sync_context_proxy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698