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

Side by Side 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, 6 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
(Empty)
1 // Copyright 2017 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.
4
5 #include "components/sync/user_events/fake_user_event_service.h"
6
7 using sync_pb::UserEventSpecifics;
8
9 namespace syncer {
10
11 FakeUserEventService::FakeUserEventService() {}
12
13 FakeUserEventService::~FakeUserEventService() {}
14
15 void FakeUserEventService::RecordUserEvent(
16 std::unique_ptr<UserEventSpecifics> specifics) {
17 DCHECK(specifics);
18 RecordUserEvent(*specifics);
19 }
20
21 void FakeUserEventService::RecordUserEvent(
22 const UserEventSpecifics& specifics) {
23 recorded_user_events_.push_back(specifics);
24 }
25
26 base::WeakPtr<ModelTypeSyncBridge> FakeUserEventService::GetSyncBridge() {
27 return base::WeakPtr<ModelTypeSyncBridge>();
28 }
29
30 void FakeUserEventService::RegisterDependentFieldTrial(
31 const std::string& trial_name,
32 UserEventSpecifics::EventCase event_case) {
33 registered_dependent_field_trials_[trial_name].insert(event_case);
34 }
35
36 const std::vector<UserEventSpecifics>&
37 FakeUserEventService::GetRecordedUserEvents() const {
38 return recorded_user_events_;
39 }
40
41 const std::map<std::string, std::set<sync_pb::UserEventSpecifics::EventCase>>&
42 FakeUserEventService::GetRegisteredDependentFieldTrials() const {
43 return registered_dependent_field_trials_;
44 }
45
46 } // namespace syncer
OLDNEW
« 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