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

Unified Diff: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc

Issue 170193002: Adding talk_base::PacketOptions to P2P IPC Send message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.cc ('k') | content/common/p2p_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
index 3ccacfc288985413d4b40a34bdc569a3fd426886..42eb3e5ce30f8b46f1adb45dafb9606519419e3e 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
@@ -217,17 +217,18 @@ TEST_F(P2PSocketHostUdpTest, SendStunNoAuth) {
.Times(3)
.WillRepeatedly(DoAll(DeleteArg<0>(), Return(true)));
+ talk_base::PacketOptions options;
std::vector<char> packet1;
CreateStunRequest(&packet1);
- socket_host_->Send(dest1_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet1, options, 0);
std::vector<char> packet2;
CreateStunResponse(&packet2);
- socket_host_->Send(dest1_, packet2, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet2, options, 0);
std::vector<char> packet3;
CreateStunError(&packet3);
- socket_host_->Send(dest1_, packet3, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet3, options, 0);
ASSERT_EQ(sent_packets_.size(), 3U);
ASSERT_EQ(sent_packets_[0].second, packet1);
@@ -242,9 +243,10 @@ TEST_F(P2PSocketHostUdpTest, SendDataNoAuth) {
MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID))))
.WillOnce(DoAll(DeleteArg<0>(), Return(true)));
+ talk_base::PacketOptions options;
std::vector<char> packet;
CreateRandomPacket(&packet);
- socket_host_->Send(dest1_, packet, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet, options, 0);
ASSERT_EQ(sent_packets_.size(), 0U);
}
@@ -264,9 +266,11 @@ TEST_F(P2PSocketHostUdpTest, SendAfterStunRequest) {
EXPECT_CALL(sender_, Send(
MatchMessage(static_cast<uint32>(P2PMsg_OnSendComplete::ID))))
.WillOnce(DoAll(DeleteArg<0>(), Return(true)));
+
+ talk_base::PacketOptions options;
std::vector<char> packet;
CreateRandomPacket(&packet);
- socket_host_->Send(dest1_, packet, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet, options, 0);
ASSERT_EQ(1U, sent_packets_.size());
ASSERT_EQ(dest1_, sent_packets_[0].first);
@@ -287,9 +291,11 @@ TEST_F(P2PSocketHostUdpTest, SendAfterStunResponse) {
EXPECT_CALL(sender_, Send(
MatchMessage(static_cast<uint32>(P2PMsg_OnSendComplete::ID))))
.WillOnce(DoAll(DeleteArg<0>(), Return(true)));
+
+ talk_base::PacketOptions options;
std::vector<char> packet;
CreateRandomPacket(&packet);
- socket_host_->Send(dest1_, packet, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet, options, 0);
ASSERT_EQ(1U, sent_packets_.size());
ASSERT_EQ(dest1_, sent_packets_[0].first);
@@ -307,12 +313,13 @@ TEST_F(P2PSocketHostUdpTest, SendAfterStunResponseDifferentHost) {
socket_->ReceivePacket(dest1_, request_packet);
// Should fail when trying to send the same packet to |dest2_|.
+ talk_base::PacketOptions options;
std::vector<char> packet;
CreateRandomPacket(&packet);
EXPECT_CALL(sender_, Send(
MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID))))
.WillOnce(DoAll(DeleteArg<0>(), Return(true)));
- socket_host_->Send(dest2_, packet, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest2_, packet, options, 0);
}
// Verify throttler not allowing unlimited sending of ICE messages to
@@ -323,15 +330,16 @@ TEST_F(P2PSocketHostUdpTest, ThrottleAfterLimit) {
.Times(2)
.WillRepeatedly(DoAll(DeleteArg<0>(), Return(true)));
+ talk_base::PacketOptions options;
std::vector<char> packet1;
CreateStunRequest(&packet1);
throttler_.SetSendIceBandwidth(packet1.size() * 2);
- socket_host_->Send(dest1_, packet1, net::DSCP_NO_CHANGE, 0);
- socket_host_->Send(dest2_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet1, options, 0);
+ socket_host_->Send(dest2_, packet1, options, 0);
net::IPEndPoint dest3 = ParseAddress(kTestIpAddress1, 2222);
// This packet must be dropped by the throttler.
- socket_host_->Send(dest3, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest3, packet1, options, 0);
ASSERT_EQ(sent_packets_.size(), 2U);
}
@@ -351,25 +359,26 @@ TEST_F(P2PSocketHostUdpTest, ThrottleAfterLimitAfterReceive) {
.Times(4)
.WillRepeatedly(DoAll(DeleteArg<0>(), Return(true)));
+ talk_base::PacketOptions options;
std::vector<char> packet1;
CreateStunRequest(&packet1);
throttler_.SetSendIceBandwidth(packet1.size());
// |dest1_| is known address, throttling will not be applied.
- socket_host_->Send(dest1_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet1, options, 0);
// Trying to send the packet to dest1_ in the same window. It should go.
- socket_host_->Send(dest1_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet1, options, 0);
// Throttler should allow this packet to go through.
- socket_host_->Send(dest2_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest2_, packet1, options, 0);
net::IPEndPoint dest3 = ParseAddress(kTestIpAddress1, 2223);
// This packet will be dropped, as limit only for a single packet.
- socket_host_->Send(dest3, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest3, packet1, options, 0);
net::IPEndPoint dest4 = ParseAddress(kTestIpAddress1, 2224);
// This packet should also be dropped.
- socket_host_->Send(dest4, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest4, packet1, options, 0);
// |dest1| is known, we can send as many packets to it.
- socket_host_->Send(dest1_, packet1, net::DSCP_NO_CHANGE, 0);
+ socket_host_->Send(dest1_, packet1, options, 0);
ASSERT_EQ(sent_packets_.size(), 4U);
}
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.cc ('k') | content/common/p2p_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698