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

Side by Side Diff: remoting/protocol/client_video_dispatcher_unittest.cc

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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
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
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
OLDNEW
« no previous file with comments | « remoting/protocol/channel_socket_adapter_unittest.cc ('k') | remoting/protocol/connection_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698