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

Side by Side Diff: net/http/http_stream_parser_unittest.cc

Issue 10690104: DeterministicSocketDataProvider should not be RefCounted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more leak fix 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 | 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/http/http_stream_parser.h" 5 #include "net/http/http_stream_parser.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // MockRead below. 187 // MockRead below.
188 static const int kBodySize = 8; 188 static const int kBodySize = 8;
189 189
190 MockRead reads[] = { 190 MockRead reads[] = {
191 MockRead(ASYNC, 5, "HTTP/1.1 200 OK\r\n"), 191 MockRead(ASYNC, 5, "HTTP/1.1 200 OK\r\n"),
192 MockRead(ASYNC, 6, "Content-Length: 8\r\n\r\n"), 192 MockRead(ASYNC, 6, "Content-Length: 8\r\n\r\n"),
193 MockRead(ASYNC, 7, "one.html"), 193 MockRead(ASYNC, 7, "one.html"),
194 MockRead(SYNCHRONOUS, 8, 0), // EOF 194 MockRead(SYNCHRONOUS, 8, 0), // EOF
195 }; 195 };
196 196
197 scoped_refptr<DeterministicSocketData> data( 197 scoped_ptr<DeterministicSocketData> data(
198 new DeterministicSocketData(reads, arraysize(reads), 198 new DeterministicSocketData(reads, arraysize(reads),
199 writes, arraysize(writes))); 199 writes, arraysize(writes)));
200 data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); 200 data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
201 201
202 scoped_ptr<DeterministicMockTCPClientSocket> transport( 202 scoped_ptr<DeterministicMockTCPClientSocket> transport(
203 new DeterministicMockTCPClientSocket(NULL, data)); 203 new DeterministicMockTCPClientSocket(NULL, data.get()));
204 data->set_socket(transport->AsWeakPtr()); 204 data->set_socket(transport->AsWeakPtr());
205 205
206 TestCompletionCallback callback; 206 TestCompletionCallback callback;
207 int rv = transport->Connect(callback.callback()); 207 int rv = transport->Connect(callback.callback());
208 rv = callback.GetResult(rv); 208 rv = callback.GetResult(rv);
209 ASSERT_EQ(OK, rv); 209 ASSERT_EQ(OK, rv);
210 210
211 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle); 211 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle);
212 socket_handle->set_socket(transport.release()); 212 socket_handle->set_socket(transport.release());
213 213
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 rv = parser.ReadResponseBody(body_buffer, kBodySize, callback.callback()); 297 rv = parser.ReadResponseBody(body_buffer, kBodySize, callback.callback());
298 ASSERT_EQ(ERR_IO_PENDING, rv); 298 ASSERT_EQ(ERR_IO_PENDING, rv);
299 data->RunFor(1); 299 data->RunFor(1);
300 300
301 ASSERT_TRUE(callback.have_result()); 301 ASSERT_TRUE(callback.have_result());
302 rv = callback.WaitForResult(); 302 rv = callback.WaitForResult();
303 ASSERT_EQ(kBodySize, rv); 303 ASSERT_EQ(kBodySize, rv);
304 } 304 }
305 305
306 } // namespace net 306 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool_spdy3_unittest.cc ('k') | net/socket/buffered_write_stream_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698