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

Side by Side Diff: net/socket/tcp_server_socket_unittest.cc

Issue 395303003: Fix a few stray net::'s in net/socket/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "net/socket/tcp_server_socket.h" 5 #include "net/socket/tcp_server_socket.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 EXPECT_EQ(GetPeerAddress(accepted_socket.get()).address(), 208 EXPECT_EQ(GetPeerAddress(accepted_socket.get()).address(),
209 local_address_.address()); 209 local_address_.address());
210 210
211 EXPECT_EQ(OK, connect_callback.WaitForResult()); 211 EXPECT_EQ(OK, connect_callback.WaitForResult());
212 212
213 const std::string message("test message"); 213 const std::string message("test message");
214 std::vector<char> buffer(message.size()); 214 std::vector<char> buffer(message.size());
215 215
216 size_t bytes_written = 0; 216 size_t bytes_written = 0;
217 while (bytes_written < message.size()) { 217 while (bytes_written < message.size()) {
218 scoped_refptr<net::IOBufferWithSize> write_buffer( 218 scoped_refptr<IOBufferWithSize> write_buffer(
219 new net::IOBufferWithSize(message.size() - bytes_written)); 219 new IOBufferWithSize(message.size() - bytes_written));
220 memmove(write_buffer->data(), message.data(), message.size()); 220 memmove(write_buffer->data(), message.data(), message.size());
221 221
222 TestCompletionCallback write_callback; 222 TestCompletionCallback write_callback;
223 int write_result = accepted_socket->Write( 223 int write_result = accepted_socket->Write(
224 write_buffer.get(), write_buffer->size(), write_callback.callback()); 224 write_buffer.get(), write_buffer->size(), write_callback.callback());
225 write_result = write_callback.GetResult(write_result); 225 write_result = write_callback.GetResult(write_result);
226 ASSERT_TRUE(write_result >= 0); 226 ASSERT_TRUE(write_result >= 0);
227 ASSERT_TRUE(bytes_written + write_result <= message.size()); 227 ASSERT_TRUE(bytes_written + write_result <= message.size());
228 bytes_written += write_result; 228 bytes_written += write_result;
229 } 229 }
230 230
231 size_t bytes_read = 0; 231 size_t bytes_read = 0;
232 while (bytes_read < message.size()) { 232 while (bytes_read < message.size()) {
233 scoped_refptr<net::IOBufferWithSize> read_buffer( 233 scoped_refptr<IOBufferWithSize> read_buffer(
234 new net::IOBufferWithSize(message.size() - bytes_read)); 234 new IOBufferWithSize(message.size() - bytes_read));
235 TestCompletionCallback read_callback; 235 TestCompletionCallback read_callback;
236 int read_result = connecting_socket.Read( 236 int read_result = connecting_socket.Read(
237 read_buffer.get(), read_buffer->size(), read_callback.callback()); 237 read_buffer.get(), read_buffer->size(), read_callback.callback());
238 read_result = read_callback.GetResult(read_result); 238 read_result = read_callback.GetResult(read_result);
239 ASSERT_TRUE(read_result >= 0); 239 ASSERT_TRUE(read_result >= 0);
240 ASSERT_TRUE(bytes_read + read_result <= message.size()); 240 ASSERT_TRUE(bytes_read + read_result <= message.size());
241 memmove(&buffer[bytes_read], read_buffer->data(), read_result); 241 memmove(&buffer[bytes_read], read_buffer->data(), read_result);
242 bytes_read += read_result; 242 bytes_read += read_result;
243 } 243 }
244 244
245 std::string received_message(buffer.begin(), buffer.end()); 245 std::string received_message(buffer.begin(), buffer.end());
246 ASSERT_EQ(message, received_message); 246 ASSERT_EQ(message, received_message);
247 } 247 }
248 248
249 } // namespace 249 } // namespace
250 250
251 } // namespace net 251 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_server_socket_unittest.cc ('k') | net/socket/transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698