Chromium Code Reviews| Index: chromeos/dbus/fake_media_analytics_client.h |
| diff --git a/chromeos/dbus/fake_media_analytics_client.h b/chromeos/dbus/fake_media_analytics_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b2a9f3b047257c9906e3aace3723e634a3d73650 |
| --- /dev/null |
| +++ b/chromeos/dbus/fake_media_analytics_client.h |
| @@ -0,0 +1,65 @@ |
| +// 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 CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ |
| +#define CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "chromeos/chromeos_export.h" |
| +#include "chromeos/dbus/media_analytics_client.h" |
| +#include "chromeos/media_perception/media_perception.pb.h" |
| + |
| +namespace chromeos { |
| + |
| +// MediaAnalyticsClient is used to communicate with a media analytics process |
| +// running outside of Chrome. |
| +class CHROMEOS_EXPORT FakeMediaAnalyticsClient : public MediaAnalyticsClient { |
| + public: |
| + FakeMediaAnalyticsClient(); |
| + ~FakeMediaAnalyticsClient() override; |
| + |
| + // Fires a fake media perception event so that we can verify the signal is |
| + // recieved by the app. |
| + void FireMediaPerceptionEvent(); |
|
tbarzic
2017/05/10 03:26:25
I'd move this after overrides, also I'd pass it th
Luke Sorenson
2017/05/10 16:38:22
Moved below overrides. I also don't understand wha
tbarzic
2017/05/10 23:59:29
I mean make this do something like:
void FireMedia
Luke Sorenson
2017/05/11 15:50:29
Done.
|
| + |
| + // Inherited from MediaAnalyticsClient. |
| + void GetState(const StateCallback& callback) override; |
| + void SetState(const mri::State& state, |
| + const StateCallback& callback) override; |
| + |
| + void SetMediaPerceptionSignalHandler( |
| + const MediaPerceptionSignalHandler& handler) override; |
| + void ClearMediaPerceptionSignalHandler() override; |
| + |
| + void GetDiagnostics(const DiagnosticsCallback& callback) override; |
| + |
| + // Inherited from DBusClient. |
| + void Init(dbus::Bus* bus) override; |
| + |
| + private: |
| + // Simply echoes back the previously set state. |
| + void OnState(const StateCallback& callback); |
| + |
| + // Returns a fake, nearly empty serialized Diagnostic proto. |
| + void OnGetDiagnostics(const DiagnosticsCallback& callback); |
| + |
| + // Returns a fake, nearly empty serialized MediaPerception proto. |
| + void OnMediaPerception(); |
| + |
| + // Stores a handler for receiving MediaPerception proto messages. |
| + MediaPerceptionSignalHandler media_perception_signal_handler_; |
| + |
| + // Stores a fake current state for the media analytics process. |
| + mri::State current_state_; |
| + |
| + base::WeakPtrFactory<FakeMediaAnalyticsClient> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FakeMediaAnalyticsClient); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ |