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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc

Issue 2846243002: Wire up rtc_packet_ids to P2PSocketHostTcp, which is required for correct BWE in WebRTC. (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/p2p/socket_host_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 std::string expected_data; 243 std::string expected_data;
244 expected_data.append(IntToSize(packet1.size())); 244 expected_data.append(IntToSize(packet1.size()));
245 expected_data.append(packet1.begin(), packet1.end()); 245 expected_data.append(packet1.begin(), packet1.end());
246 expected_data.append(IntToSize(packet2.size())); 246 expected_data.append(IntToSize(packet2.size()));
247 expected_data.append(packet2.begin(), packet2.end()); 247 expected_data.append(packet2.begin(), packet2.end());
248 248
249 EXPECT_EQ(expected_data, sent_data_); 249 EXPECT_EQ(expected_data, sent_data_);
250 } 250 }
251 251
252 TEST_F(P2PSocketHostTcpTest, PacketIdIsPropagated) {
253 base::MessageLoop message_loop;
254
255 socket_->set_async_write(true);
256
257 const int32_t kRtcPacketId = 1234;
258
259 base::TimeTicks now = base::TimeTicks::Now();
260
261 EXPECT_CALL(sender_, Send(MatchSendPacketMetrics(kRtcPacketId, now)))
262 .Times(1)
263 .WillRepeatedly(DoAll(DeleteArg<0>(), Return(true)));
264
265 rtc::PacketOptions options;
266 options.packet_id = kRtcPacketId;
267 std::vector<char> packet1;
268 CreateStunRequest(&packet1);
269
270 socket_host_->Send(dest_.ip_address, packet1, options, 0);
271
272 base::RunLoop().RunUntilIdle();
273
274 std::string expected_data;
275 expected_data.append(IntToSize(packet1.size()));
276 expected_data.append(packet1.begin(), packet1.end());
277
278 EXPECT_EQ(expected_data, sent_data_);
279 }
280
252 TEST_F(P2PSocketHostTcpTest, SendDataWithPacketOptions) { 281 TEST_F(P2PSocketHostTcpTest, SendDataWithPacketOptions) {
253 std::vector<char> request_packet; 282 std::vector<char> request_packet;
254 CreateStunRequest(&request_packet); 283 CreateStunRequest(&request_packet);
255 284
256 std::string received_data; 285 std::string received_data;
257 received_data.append(IntToSize(request_packet.size())); 286 received_data.append(IntToSize(request_packet.size()));
258 received_data.append(request_packet.begin(), request_packet.end()); 287 received_data.append(request_packet.begin(), request_packet.end());
259 288
260 EXPECT_CALL( 289 EXPECT_CALL(
261 sender_, 290 sender_,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 base::RunLoop().RunUntilIdle(); 425 base::RunLoop().RunUntilIdle();
397 426
398 std::string expected_data; 427 std::string expected_data;
399 expected_data.append(packet1.begin(), packet1.end()); 428 expected_data.append(packet1.begin(), packet1.end());
400 expected_data.append(packet2.begin(), packet2.end()); 429 expected_data.append(packet2.begin(), packet2.end());
401 430
402 EXPECT_EQ(expected_data, sent_data_); 431 EXPECT_EQ(expected_data, sent_data_);
403 } 432 }
404 433
405 } // namespace content 434 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | content/browser/renderer_host/p2p/socket_host_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698