OLD | NEW |
---|---|
(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. | |
19 class CHROMEOS_EXPORT FakeMediaAnalyticsClient : public MediaAnalyticsClient { | |
20 public: | |
21 FakeMediaAnalyticsClient(); | |
22 ~FakeMediaAnalyticsClient() override; | |
23 | |
24 // Fires a fake media perception event so that we can verify the signal is | |
25 // recieved by the app. | |
26 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.
| |
27 | |
28 // Inherited from MediaAnalyticsClient. | |
29 void GetState(const StateCallback& callback) override; | |
30 void SetState(const mri::State& state, | |
31 const StateCallback& callback) override; | |
32 | |
33 void SetMediaPerceptionSignalHandler( | |
34 const MediaPerceptionSignalHandler& handler) override; | |
35 void ClearMediaPerceptionSignalHandler() override; | |
36 | |
37 void GetDiagnostics(const DiagnosticsCallback& callback) override; | |
38 | |
39 // Inherited from DBusClient. | |
40 void Init(dbus::Bus* bus) override; | |
41 | |
42 private: | |
43 // Simply echoes back the previously set state. | |
44 void OnState(const StateCallback& callback); | |
45 | |
46 // Returns a fake, nearly empty serialized Diagnostic proto. | |
47 void OnGetDiagnostics(const DiagnosticsCallback& callback); | |
48 | |
49 // Returns a fake, nearly empty serialized MediaPerception proto. | |
50 void OnMediaPerception(); | |
51 | |
52 // Stores a handler for receiving MediaPerception proto messages. | |
53 MediaPerceptionSignalHandler media_perception_signal_handler_; | |
54 | |
55 // Stores a fake current state for the media analytics process. | |
56 mri::State current_state_; | |
57 | |
58 base::WeakPtrFactory<FakeMediaAnalyticsClient> weak_ptr_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(FakeMediaAnalyticsClient); | |
61 }; | |
62 | |
63 } // namespace chromeos | |
64 | |
65 #endif // CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ | |
OLD | NEW |