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

Side by Side Diff: chromeos/dbus/fake_media_analytics_client.h

Issue 2791983004: DBus MediaAnalyticsClient and media_perception pb. (Closed)
Patch Set: Addressing more comments. Created 3 years, 7 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 CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/media_analytics_client.h"
13 #include "chromeos/media_perception/media_perception.pb.h"
14
15 namespace chromeos {
16
17 // MediaAnalyticsClient is used to communicate with a media analytics process
18 // running outside of Chrome. The FakeMediaAnalyticsClient is used for
19 // integration testing the MediaPerceptionPrivate API without any requirement on
20 // D-Bus communications to an external process.
tbarzic 2017/05/09 20:28:41 Drop the part about testing - this is used more wi
Luke Sorenson 2017/05/09 22:21:25 Done.
21 class CHROMEOS_EXPORT FakeMediaAnalyticsClient : public MediaAnalyticsClient {
22 public:
23 FakeMediaAnalyticsClient();
24 ~FakeMediaAnalyticsClient() override;
25
26 // Inherited from MediaAnalyticsClient.
27 void GetState(const StateCallback& callback) override;
28 void SetState(const mri::State& state,
29 const StateCallback& callback) override;
30
31 void SetMediaPerceptionSignalHandler(
32 const MediaPerceptionSignalHandler& handler) override;
33 void ClearMediaPerceptionSignalHandler() override;
34
35 void GetDiagnostics(const DiagnosticsCallback& callback) override;
36
37 // Inherited from DBusClient.
38 void Init(dbus::Bus* bus) override;
39
40 private:
41 // Simply echoes back the previously set state.
42 void OnState(const StateCallback& callback);
43
44 // Returns a fake, nearly empty serialized Diagnostic proto.
45 void OnGetDiagnostics(const DiagnosticsCallback& callback);
46
47 // Returns a fake, nearly empty serialized MediaPerception proto.
48 void OnMediaPerception();
49
50 // Stores a handler for receiving MediaPerception proto messages.
51 MediaPerceptionSignalHandler media_perception_signal_handler_;
52
53 // Stores a fake current state for the media analytics process.
54 mri::State current_state_;
55
56 base::WeakPtrFactory<FakeMediaAnalyticsClient> weak_ptr_factory_;
57
58 DISALLOW_COPY_AND_ASSIGN(FakeMediaAnalyticsClient);
59 };
60
61 } // namespace chromeos
62
63 #endif // CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698