| 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..c4ed730b7d37fc2f79563ab6d088c24e9a8982c8
|
| --- /dev/null
|
| +++ b/chromeos/dbus/fake_media_analytics_client.h
|
| @@ -0,0 +1,66 @@
|
| +// 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. The FakeMediaAnalyticsClient is used for
|
| +// integration testing the MediaPerceptionPrivate API without any requirement on
|
| +// D-Bus communications to an external process.
|
| +class CHROMEOS_EXPORT FakeMediaAnalyticsClient : public MediaAnalyticsClient {
|
| + public:
|
| + FakeMediaAnalyticsClient();
|
| + ~FakeMediaAnalyticsClient() override;
|
| +
|
| + // Used for Upstart D-Bus command to start the media analytics process.
|
| + // These do nothing in the fake D-Bus client.
|
| + void StartMediaAnalytics(const UpstartCallback& callback) override;
|
| + void RestartMediaAnalytics(const UpstartCallback& callback) override;
|
| +
|
| + // Inherited from MediaAnalyticsClient.
|
| + void State(const mri::State& state, const StateCallback& callback) override;
|
| +
|
| + void SetMediaPerceptionSignalHandler(
|
| + const MediaPerceptionSignalHandler& handler) override;
|
| + void UnsetMediaPerceptionSignalHandler() 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_
|
|
|