OLD | NEW |
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 #include "remoting/protocol/client_video_dispatcher.h" | 5 #include "remoting/protocol/client_video_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "remoting/base/buffered_socket_writer.h" |
11 #include "remoting/base/constants.h" | 12 #include "remoting/base/constants.h" |
12 #include "remoting/proto/video.pb.h" | 13 #include "remoting/proto/video.pb.h" |
13 #include "remoting/protocol/fake_session.h" | 14 #include "remoting/protocol/fake_session.h" |
14 #include "remoting/protocol/fake_stream_socket.h" | 15 #include "remoting/protocol/fake_stream_socket.h" |
15 #include "remoting/protocol/message_serialization.h" | 16 #include "remoting/protocol/message_serialization.h" |
16 #include "remoting/protocol/video_stub.h" | 17 #include "remoting/protocol/video_stub.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace remoting { | 20 namespace remoting { |
20 namespace protocol { | 21 namespace protocol { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 kDefaultStreamVersion, | 70 kDefaultStreamVersion, |
70 ChannelConfig::CODEC_UNDEFINED), | 71 ChannelConfig::CODEC_UNDEFINED), |
71 this); | 72 this); |
72 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
73 DCHECK(initialized_); | 74 DCHECK(initialized_); |
74 host_socket_.PairWith( | 75 host_socket_.PairWith( |
75 session_.fake_channel_factory().GetFakeChannel(kVideoChannelName)); | 76 session_.fake_channel_factory().GetFakeChannel(kVideoChannelName)); |
76 reader_.StartReading(&host_socket_, | 77 reader_.StartReading(&host_socket_, |
77 base::Bind(&ClientVideoDispatcherTest::OnReadError, | 78 base::Bind(&ClientVideoDispatcherTest::OnReadError, |
78 base::Unretained(this))); | 79 base::Unretained(this))); |
79 writer_.Init(&host_socket_, BufferedSocketWriter::WriteFailedCallback()); | 80 writer_.Init( |
| 81 base::Bind(&P2PStreamSocket::Write, base::Unretained(&host_socket_)), |
| 82 BufferedSocketWriter::WriteFailedCallback()); |
80 } | 83 } |
81 | 84 |
82 void ClientVideoDispatcherTest::ProcessVideoPacket( | 85 void ClientVideoDispatcherTest::ProcessVideoPacket( |
83 scoped_ptr<VideoPacket> video_packet, | 86 scoped_ptr<VideoPacket> video_packet, |
84 const base::Closure& done) { | 87 const base::Closure& done) { |
85 video_packets_.push_back(video_packet.release()); | 88 video_packets_.push_back(video_packet.release()); |
86 packet_done_callbacks_.push_back(done); | 89 packet_done_callbacks_.push_back(done); |
87 } | 90 } |
88 | 91 |
89 void ClientVideoDispatcherTest::OnChannelInitialized( | 92 void ClientVideoDispatcherTest::OnChannelInitialized( |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 base::RunLoop().RunUntilIdle(); | 181 base::RunLoop().RunUntilIdle(); |
179 | 182 |
180 // Verify order of Ack messages. | 183 // Verify order of Ack messages. |
181 ASSERT_EQ(2U, ack_messages_.size()); | 184 ASSERT_EQ(2U, ack_messages_.size()); |
182 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id()); | 185 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id()); |
183 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id()); | 186 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id()); |
184 } | 187 } |
185 | 188 |
186 } // namespace protocol | 189 } // namespace protocol |
187 } // namespace remoting | 190 } // namespace remoting |
OLD | NEW |