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

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: Fixed license headers. 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) 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/sys_byteorder.h" 11 #include "base/sys_byteorder.h"
11 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" 12 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h"
12 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
13 #include "net/base/ip_endpoint.h" 14 #include "net/base/ip_endpoint.h"
14 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
15 #include "net/udp/datagram_server_socket.h" 16 #include "net/udp/datagram_server_socket.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 using ::testing::_; 20 using ::testing::_;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 cb.Run(size); 101 cb.Run(size);
101 } else { 102 } else {
102 incoming_packets_.push_back(UDPPacket(address, data)); 103 incoming_packets_.push_back(UDPPacket(address, data));
103 } 104 }
104 } 105 }
105 106
106 virtual const net::BoundNetLog& NetLog() const { 107 virtual const net::BoundNetLog& NetLog() const {
107 return net_log_; 108 return net_log_;
108 } 109 }
109 110
111 virtual void AllowAddressReuse() OVERRIDE {
112 NOTIMPLEMENTED();
113 }
114
115 virtual void AllowBroadcast() OVERRIDE {
116 NOTIMPLEMENTED();
117 }
118
110 private: 119 private:
111 net::IPEndPoint address_; 120 net::IPEndPoint address_;
112 std::deque<UDPPacket>* sent_packets_; 121 std::deque<UDPPacket>* sent_packets_;
113 std::deque<UDPPacket> incoming_packets_; 122 std::deque<UDPPacket> incoming_packets_;
114 net::BoundNetLog net_log_; 123 net::BoundNetLog net_log_;
115 124
116 scoped_refptr<net::IOBuffer> recv_buffer_; 125 scoped_refptr<net::IOBuffer> recv_buffer_;
117 net::IPEndPoint* recv_address_; 126 net::IPEndPoint* recv_address_;
118 int recv_size_; 127 int recv_size_;
119 net::CompletionCallback recv_callback_; 128 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_|. 250 // Should fail when trying to send the same packet to |dest2_|.
242 std::vector<char> packet; 251 std::vector<char> packet;
243 CreateRandomPacket(&packet); 252 CreateRandomPacket(&packet);
244 EXPECT_CALL(sender_, Send( 253 EXPECT_CALL(sender_, Send(
245 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID)))) 254 MatchMessage(static_cast<uint32>(P2PMsg_OnError::ID))))
246 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); 255 .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
247 socket_host_->Send(dest2_, packet); 256 socket_host_->Send(dest2_, packet);
248 } 257 }
249 258
250 } // namespace content 259 } // 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