| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 namespace content { | 133 namespace content { |
| 134 | 134 |
| 135 class P2PSocketHostUdpTest : public testing::Test { | 135 class P2PSocketHostUdpTest : public testing::Test { |
| 136 protected: | 136 protected: |
| 137 virtual void SetUp() OVERRIDE { | 137 virtual void SetUp() OVERRIDE { |
| 138 EXPECT_CALL(sender_, Send( | 138 EXPECT_CALL(sender_, Send( |
| 139 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) | 139 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) |
| 140 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); | 140 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); |
| 141 | 141 |
| 142 socket_host_.reset(new P2PSocketHostUdp(&sender_, 0, 0)); | 142 socket_host_.reset(new P2PSocketHostUdp(&sender_, 0)); |
| 143 socket_ = new FakeDatagramServerSocket(&sent_packets_); | 143 socket_ = new FakeDatagramServerSocket(&sent_packets_); |
| 144 socket_host_->socket_.reset(socket_); | 144 socket_host_->socket_.reset(socket_); |
| 145 | 145 |
| 146 local_address_ = ParseAddress(kTestLocalIpAddress, kTestPort1); | 146 local_address_ = ParseAddress(kTestLocalIpAddress, kTestPort1); |
| 147 socket_host_->Init(local_address_, net::IPEndPoint()); | 147 socket_host_->Init(local_address_, net::IPEndPoint()); |
| 148 | 148 |
| 149 dest1_ = ParseAddress(kTestIpAddress1, kTestPort1); | 149 dest1_ = ParseAddress(kTestIpAddress1, kTestPort1); |
| 150 dest2_ = ParseAddress(kTestIpAddress2, kTestPort2); | 150 dest2_ = ParseAddress(kTestIpAddress2, kTestPort2); |
| 151 } | 151 } |
| 152 | 152 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Should fail when trying to send the same packet to |dest2_|. | 250 // Should fail when trying to send the same packet to |dest2_|. |
| 251 std::vector<char> packet; | 251 std::vector<char> packet; |
| 252 CreateRandomPacket(&packet); | 252 CreateRandomPacket(&packet); |
| 253 EXPECT_CALL(sender_, Send( | 253 EXPECT_CALL(sender_, Send( |
| 254 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID)))) | 254 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID)))) |
| 255 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); | 255 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); |
| 256 socket_host_->Send(dest2_, packet); | 256 socket_host_->Send(dest2_, packet); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace content | 259 } // namespace content |
| OLD | NEW |