// 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_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_ #define COMPONENTS_SYNC_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_ #include #include #include "components/sync/protocol/user_event_specifics.pb.h" #include "components/sync/test/fake_model_type_controller_delegate.h" #include "components/sync_user_events/user_event_service.h" namespace syncer { // This implementation is intended to be used in unit tests, with public // accessors that allow reading all data to verify expectations. class FakeUserEventService : public UserEventService { public: FakeUserEventService(); FakeUserEventService(const FakeUserEventService&) = delete; FakeUserEventService& operator=(const FakeUserEventService&) = delete; ~FakeUserEventService() override; // UserEventService implementation. void RecordUserEvent( std::unique_ptr specifics) override; void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics) override; base::WeakPtr GetControllerDelegate() override; const std::vector& GetRecordedUserEvents() const; private: std::vector recorded_user_events_; FakeModelTypeControllerDelegate fake_controller_delegate_; }; } // namespace syncer #endif // COMPONENTS_SYNC_USER_EVENTS_FAKE_USER_EVENT_SERVICE_H_