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

Unified Diff: components/sync/user_events/fake_user_event_service.cc

Issue 2909283003: [Sync] Split UserEventService into interface and impl, add fake impl, add unit tests. (Closed)
Patch Set: Added a NoOp service to handle OffTheRecord. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/sync/user_events/fake_user_event_service.cc
diff --git a/components/sync/user_events/fake_user_event_service.cc b/components/sync/user_events/fake_user_event_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..44c842a6e83a763e4ccc4e924faf259f6ed6783d
--- /dev/null
+++ b/components/sync/user_events/fake_user_event_service.cc
@@ -0,0 +1,46 @@
+// 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.
+
+#include "components/sync/user_events/fake_user_event_service.h"
+
+using sync_pb::UserEventSpecifics;
+
+namespace syncer {
+
+FakeUserEventService::FakeUserEventService() {}
+
+FakeUserEventService::~FakeUserEventService() {}
+
+void FakeUserEventService::RecordUserEvent(
+ std::unique_ptr<UserEventSpecifics> specifics) {
+ DCHECK(specifics);
+ RecordUserEvent(*specifics);
+}
+
+void FakeUserEventService::RecordUserEvent(
+ const UserEventSpecifics& specifics) {
+ recorded_user_events_.push_back(specifics);
+}
+
+base::WeakPtr<ModelTypeSyncBridge> FakeUserEventService::GetSyncBridge() {
+ return base::WeakPtr<ModelTypeSyncBridge>();
+}
+
+void FakeUserEventService::RegisterDependentFieldTrial(
+ const std::string& trial_name,
+ UserEventSpecifics::EventCase event_case) {
+ registered_dependent_field_trials_[trial_name].insert(event_case);
+}
+
+const std::vector<UserEventSpecifics>&
+FakeUserEventService::GetRecordedUserEvents() const {
+ return recorded_user_events_;
+}
+
+const std::map<std::string, std::set<sync_pb::UserEventSpecifics::EventCase>>&
+FakeUserEventService::GetRegisteredDependentFieldTrials() const {
+ return registered_dependent_field_trials_;
+}
+
+} // namespace syncer
« no previous file with comments | « components/sync/user_events/fake_user_event_service.h ('k') | components/sync/user_events/no_op_user_event_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698