| OLD | NEW |
| 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_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 namespace content { | 181 namespace content { |
| 182 | 182 |
| 183 class P2PSocketHostUdpTest : public testing::Test { | 183 class P2PSocketHostUdpTest : public testing::Test { |
| 184 protected: | 184 protected: |
| 185 virtual void SetUp() OVERRIDE { | 185 virtual void SetUp() OVERRIDE { |
| 186 EXPECT_CALL(sender_, Send( | 186 EXPECT_CALL(sender_, Send( |
| 187 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) | 187 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) |
| 188 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); | 188 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); |
| 189 | 189 |
| 190 socket_host_.reset(new P2PSocketHostUdp(&sender_, 0, &throttler_)); | 190 socket_host_.reset(new P2PSocketHostUdp(&sender_, 0, 0, &throttler_)); |
| 191 socket_ = new FakeDatagramServerSocket(&sent_packets_); | 191 socket_ = new FakeDatagramServerSocket(&sent_packets_); |
| 192 socket_host_->socket_.reset(socket_); | 192 socket_host_->socket_.reset(socket_); |
| 193 | 193 |
| 194 local_address_ = ParseAddress(kTestLocalIpAddress, kTestPort1); | 194 local_address_ = ParseAddress(kTestLocalIpAddress, kTestPort1); |
| 195 socket_host_->Init(local_address_, P2PHostAndIPEndPoint()); | 195 socket_host_->Init(local_address_, P2PHostAndIPEndPoint()); |
| 196 | 196 |
| 197 dest1_ = ParseAddress(kTestIpAddress1, kTestPort1); | 197 dest1_ = ParseAddress(kTestIpAddress1, kTestPort1); |
| 198 dest2_ = ParseAddress(kTestIpAddress2, kTestPort2); | 198 dest2_ = ParseAddress(kTestIpAddress2, kTestPort2); |
| 199 | 199 |
| 200 scoped_ptr<talk_base::Timing> timing(new FakeTiming()); | 200 scoped_ptr<talk_base::Timing> timing(new FakeTiming()); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 socket_host_->Send(dest3, packet1, options, 0); | 380 socket_host_->Send(dest3, packet1, options, 0); |
| 381 net::IPEndPoint dest4 = ParseAddress(kTestIpAddress1, 2224); | 381 net::IPEndPoint dest4 = ParseAddress(kTestIpAddress1, 2224); |
| 382 // This packet should also be dropped. | 382 // This packet should also be dropped. |
| 383 socket_host_->Send(dest4, packet1, options, 0); | 383 socket_host_->Send(dest4, packet1, options, 0); |
| 384 // |dest1| is known, we can send as many packets to it. | 384 // |dest1| is known, we can send as many packets to it. |
| 385 socket_host_->Send(dest1_, packet1, options, 0); | 385 socket_host_->Send(dest1_, packet1, options, 0); |
| 386 ASSERT_EQ(sent_packets_.size(), 4U); | 386 ASSERT_EQ(sent_packets_.size(), 4U); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace content | 389 } // namespace content |
| OLD | NEW |