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

Side by Side Diff: remoting/protocol/fake_connection_to_client.h

Issue 1472873005: Add VideoStream interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_video_pump
Patch Set: Created 5 years 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_ 5 #ifndef REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_
6 #define REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_ 6 #define REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_
7 7
8 #include "base/callback.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
9 #include "remoting/protocol/connection_to_client.h" 11 #include "remoting/protocol/connection_to_client.h"
12 #include "remoting/protocol/video_stream.h"
10 13
11 namespace remoting { 14 namespace remoting {
12 namespace protocol { 15 namespace protocol {
13 16
17 class FakeVideoStream : public protocol::VideoStream {
18 public:
19 FakeVideoStream();
20 ~FakeVideoStream() override;
21
22 // protocol::VideoStream interface.
23 void Pause(bool pause) override;
24 void OnInputEventReceived(int64_t event_timestamp) override;
25 void SetLosslessEncode(bool want_lossless) override;
26 void SetLosslessColor(bool want_lossless) override;
27 void SetSizeCallback(const SizeCallback& size_callback) override;
28
29 const SizeCallback& size_callback() { return size_callback_; }
30
31 base::WeakPtr<FakeVideoStream> GetWeakPtr();
32
33 private:
34 SizeCallback size_callback_;
35
36 base::WeakPtrFactory<FakeVideoStream> weak_factory_;
37
38 DISALLOW_COPY_AND_ASSIGN(FakeVideoStream);
39 };
40
14 class FakeConnectionToClient : public ConnectionToClient { 41 class FakeConnectionToClient : public ConnectionToClient {
15 public: 42 public:
16 FakeConnectionToClient(scoped_ptr<Session> session); 43 FakeConnectionToClient(scoped_ptr<Session> session);
17 ~FakeConnectionToClient() override; 44 ~FakeConnectionToClient() override;
18 45
19 void SetEventHandler(EventHandler* event_handler) override; 46 void SetEventHandler(EventHandler* event_handler) override;
20 47
21 VideoStub* video_stub() override; 48 scoped_ptr<VideoStream> StartVideoStream(
49 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
50
22 AudioStub* audio_stub() override; 51 AudioStub* audio_stub() override;
23 ClientStub* client_stub() override; 52 ClientStub* client_stub() override;
24 void Disconnect(ErrorCode disconnect_error) override; 53 void Disconnect(ErrorCode disconnect_error) override;
25 54
26 Session* session() override; 55 Session* session() override;
27 void OnInputEventReceived(int64_t timestamp) override; 56 void OnInputEventReceived(int64_t timestamp) override;
28 57
29 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; 58 void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
30 void set_host_stub(HostStub* host_stub) override; 59 void set_host_stub(HostStub* host_stub) override;
31 void set_input_stub(InputStub* input_stub) override; 60 void set_input_stub(InputStub* input_stub) override;
32 61
33 void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub) override; 62 base::WeakPtr<FakeVideoStream> last_video_stream() {
63 return last_video_stream_;
64 }
34 65
35 void set_video_stub(VideoStub* video_stub) { video_stub_ = video_stub; }
36 void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; } 66 void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; }
37 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } 67 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; }
38 68
39 EventHandler* event_handler() { return event_handler_; } 69 EventHandler* event_handler() { return event_handler_; }
40 ClipboardStub* clipboard_stub() { return clipboard_stub_; } 70 ClipboardStub* clipboard_stub() { return clipboard_stub_; }
41 HostStub* host_stub() { return host_stub_; } 71 HostStub* host_stub() { return host_stub_; }
42 InputStub* input_stub() { return input_stub_; } 72 InputStub* input_stub() { return input_stub_; }
43 73
44 VideoFeedbackStub* video_feedback_stub() { return video_feedback_stub_; }
45
46 bool is_connected() { return is_connected_; } 74 bool is_connected() { return is_connected_; }
47 ErrorCode disconnect_error() { return disconnect_error_; } 75 ErrorCode disconnect_error() { return disconnect_error_; }
48 76
49 private: 77 private:
50 scoped_ptr<Session> session_; 78 scoped_ptr<Session> session_;
51 EventHandler* event_handler_ = nullptr; 79 EventHandler* event_handler_ = nullptr;
52 80
53 VideoStub* video_stub_ = nullptr; 81 base::WeakPtr<FakeVideoStream> last_video_stream_;
82
54 AudioStub* audio_stub_ = nullptr; 83 AudioStub* audio_stub_ = nullptr;
55 ClientStub* client_stub_ = nullptr; 84 ClientStub* client_stub_ = nullptr;
56 85
57 ClipboardStub* clipboard_stub_ = nullptr; 86 ClipboardStub* clipboard_stub_ = nullptr;
58 HostStub* host_stub_ = nullptr; 87 HostStub* host_stub_ = nullptr;
59 InputStub* input_stub_ = nullptr; 88 InputStub* input_stub_ = nullptr;
60 VideoFeedbackStub* video_feedback_stub_ = nullptr;
61 89
62 bool is_connected_ = true; 90 bool is_connected_ = true;
63 ErrorCode disconnect_error_ = OK; 91 ErrorCode disconnect_error_ = OK;
64 92
65 DISALLOW_COPY_AND_ASSIGN(FakeConnectionToClient); 93 DISALLOW_COPY_AND_ASSIGN(FakeConnectionToClient);
66 }; 94 };
67 95
68 } // namespace protocol 96 } // namespace protocol
69 } // namespace remoting 97 } // namespace remoting
70 98
71 #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_ 99 #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_client.h ('k') | remoting/protocol/fake_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698