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

Side by Side Diff: components/sync/user_events/fake_user_event_service.h

Issue 2909283003: [Sync] Split UserEventService into interface and impl, add fake impl, add unit tests. (Closed)
Patch Set: Self review. 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 #ifndef COMPONENTS_SYNC_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_
6 #define COMPONENTS_SYNC_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_
7
8 #include <map>
9 #include <memory>
10 #include <set>
11 #include <string>
12 #include <vector>
13
14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h"
16 #include "components/sync/protocol/user_event_specifics.pb.h"
17 #include "components/sync/user_events/user_event_service.h"
18
19 namespace syncer {
20
21 class ModelTypeSyncBridge;
22
23 class FakeUserEventService : public UserEventService {
Patrick Noland 2017/05/30 23:06:41 Can you add a short comment explaining why/how one
skym 2017/05/30 23:21:39 Done.
24 public:
25 FakeUserEventService();
26 ~FakeUserEventService() override;
27
28 // FakeUserEventService implementation.
Patrick Noland 2017/05/30 23:06:41 I think you mean UserEventService implementation?
skym 2017/05/30 23:21:39 Yeah, search/replace fail, done.
29 void RecordUserEvent(
30 std::unique_ptr<sync_pb::UserEventSpecifics> specifics) override;
31 void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics) override;
32 void RegisterDependentFieldTrial(
33 const std::string& trial_name,
34 sync_pb::UserEventSpecifics::EventCase event_case) override;
35 base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge() override;
36
37 const std::vector<sync_pb::UserEventSpecifics>& GetRecordedUserEvents() const;
38 const std::map<std::string, std::set<sync_pb::UserEventSpecifics::EventCase>>&
39 GetRegisteredDependentFieldTrials() const;
40
41 private:
42 std::vector<sync_pb::UserEventSpecifics> recorded_user_events_;
43 std::map<std::string, std::set<sync_pb::UserEventSpecifics::EventCase>>
44 registered_dependent_field_trials_;
45
46 DISALLOW_COPY_AND_ASSIGN(FakeUserEventService);
47 };
48
49 } // namespace syncer
50
51 #endif // COMPONENTS_SYNC_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698