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

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

Issue 10739002: Added broadcasting feature to UDP server sockets. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added MacOS specific code. Created 8 years, 5 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
« no previous file with comments | « no previous file | net/udp/datagram_server_socket.h » ('j') | net/udp/udp_socket_libevent.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sys_byteorder.h" 10 #include "base/sys_byteorder.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 cb.Run(size); 100 cb.Run(size);
101 } else { 101 } else {
102 incoming_packets_.push_back(UDPPacket(address, data)); 102 incoming_packets_.push_back(UDPPacket(address, data));
103 } 103 }
104 } 104 }
105 105
106 virtual const net::BoundNetLog& NetLog() const { 106 virtual const net::BoundNetLog& NetLog() const {
107 return net_log_; 107 return net_log_;
108 } 108 }
109 109
110 virtual void AllowBroadcast() OVERRIDE {
111 }
112
110 private: 113 private:
111 net::IPEndPoint address_; 114 net::IPEndPoint address_;
112 std::deque<UDPPacket>* sent_packets_; 115 std::deque<UDPPacket>* sent_packets_;
113 std::deque<UDPPacket> incoming_packets_; 116 std::deque<UDPPacket> incoming_packets_;
114 net::BoundNetLog net_log_; 117 net::BoundNetLog net_log_;
115 118
116 scoped_refptr<net::IOBuffer> recv_buffer_; 119 scoped_refptr<net::IOBuffer> recv_buffer_;
117 net::IPEndPoint* recv_address_; 120 net::IPEndPoint* recv_address_;
118 int recv_size_; 121 int recv_size_;
119 net::CompletionCallback recv_callback_; 122 net::CompletionCallback recv_callback_;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Should fail when trying to send the same packet to |dest2_|. 244 // Should fail when trying to send the same packet to |dest2_|.
242 std::vector<char> packet; 245 std::vector<char> packet;
243 CreateRandomPacket(&packet); 246 CreateRandomPacket(&packet);
244 EXPECT_CALL(sender_, Send( 247 EXPECT_CALL(sender_, Send(
245 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID)))) 248 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID))))
246 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); 249 .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
247 socket_host_->Send(dest2_, packet); 250 socket_host_->Send(dest2_, packet);
248 } 251 }
249 252
250 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/udp/datagram_server_socket.h » ('j') | net/udp/udp_socket_libevent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698