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 // Inherited from MediaAnalyticsClient. | |
25 void GetState(const StateCallback& callback) override; | |
26 void SetState(const mri::State& state, | |
27 const StateCallback& callback) override; | |
28 | |
tbarzic
2017/05/11 16:55:55
nit: remove new lines between overrides of the sam
Luke Sorenson
2017/05/11 18:16:48
Done.
| |
29 void SetMediaPerceptionSignalHandler( | |
30 const MediaPerceptionSignalHandler& handler) override; | |
31 void ClearMediaPerceptionSignalHandler() override; | |
32 | |
33 void GetDiagnostics(const DiagnosticsCallback& callback) override; | |
34 | |
35 // Inherited from DBusClient. | |
36 void Init(dbus::Bus* bus) override; | |
37 | |
38 // Fires a fake media perception event so that we can verify the signal is | |
39 // recieved by the app. | |
tbarzic
2017/05/11 16:55:55
Just: Fires a fake media perception event.
Luke Sorenson
2017/05/11 18:16:47
Done.
| |
40 void FireMediaPerceptionEvent(mri::MediaPerception media_perception); | |
41 | |
42 // Sets the object to be returned from GetDiagnostics. Allows the apitest | |
43 // to set the value being returned. | |
tbarzic
2017/05/11 16:55:55
nit: remove the second sentence.
Maybe append For
Luke Sorenson
2017/05/11 18:16:48
Done.
| |
44 void SetDiagnostics(mri::Diagnostics diagnostics); | |
45 | |
46 // Make the media analytics process as launched or not running. | |
tbarzic
2017/05/11 16:55:55
I'm fine without this comment - process_running_ c
Luke Sorenson
2017/05/11 18:16:48
Done.
| |
47 void set_process_running(bool running) { process_running_ = running; } | |
48 | |
49 bool process_running() const { return process_running_; } | |
50 | |
51 private: | |
52 // Simply echoes back the previously set state. | |
tbarzic
2017/05/11 16:55:55
nit: no "Simply"
Luke Sorenson
2017/05/11 18:16:47
Done.
| |
53 void OnState(const StateCallback& callback); | |
54 | |
55 // Returns a fake, nearly empty serialized Diagnostic proto. | |
tbarzic
2017/05/11 16:55:55
nit: Update comment in respect to SetDiagnostics c
Luke Sorenson
2017/05/11 18:16:47
Done.
| |
56 void OnGetDiagnostics(const DiagnosticsCallback& callback); | |
57 | |
58 // Returns a fake, nearly empty serialized MediaPerception proto. | |
tbarzic
2017/05/11 16:55:55
nit: Update the comment.
Luke Sorenson
2017/05/11 18:16:47
Done.
| |
59 void OnMediaPerception(mri::MediaPerception media_perception); | |
60 | |
61 // Stores a handler for receiving MediaPerception proto messages. | |
62 MediaPerceptionSignalHandler media_perception_signal_handler_; | |
63 | |
64 // Stores a fake current state for the media analytics process. | |
65 mri::State current_state_; | |
66 | |
67 // Stores a fake diagnostics object to be returned by the GetDiagnostics. | |
68 mri::Diagnostics diagnostics_; | |
69 | |
70 // Stores the launch state of the fake media analytics process. | |
tbarzic
2017/05/11 16:55:55
Whether the fake media analytics was started (for
Luke Sorenson
2017/05/11 18:16:47
Done.
| |
71 bool process_running_; | |
72 | |
73 base::WeakPtrFactory<FakeMediaAnalyticsClient> weak_ptr_factory_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(FakeMediaAnalyticsClient); | |
76 }; | |
77 | |
78 } // namespace chromeos | |
79 | |
80 #endif // CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ | |
OLD | NEW |