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

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

Issue 193663003: Push remote hostname to P2P socket host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, &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_, net::IPEndPoint()); 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());
201 throttler_.SetTiming(timing.Pass()); 201 throttler_.SetTiming(timing.Pass());
202 } 202 }
203 203
204 P2PMessageThrottler throttler_; 204 P2PMessageThrottler throttler_;
205 std::deque<FakeDatagramServerSocket::UDPPacket> sent_packets_; 205 std::deque<FakeDatagramServerSocket::UDPPacket> sent_packets_;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« 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