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

Side by Side Diff: net/spdy/spdy_http_stream_spdy2_unittest.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_proxy_client_socket.cc » ('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 "net/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include "crypto/ec_private_key.h" 7 #include "crypto/ec_private_key.h"
8 #include "crypto/ec_signature_creator.h" 8 #include "crypto/ec_signature_creator.h"
9 #include "crypto/signature_creator.h" 9 #include "crypto/signature_creator.h"
10 #include "net/base/asn1_util.h" 10 #include "net/base/asn1_util.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 TestCompletionCallback callback; 157 TestCompletionCallback callback;
158 HttpResponseInfo response; 158 HttpResponseInfo response;
159 HttpRequestHeaders headers; 159 HttpRequestHeaders headers;
160 BoundNetLog net_log; 160 BoundNetLog net_log;
161 SpdyHttpStream http_stream(session_.get(), true); 161 SpdyHttpStream http_stream(session_.get(), true);
162 ASSERT_EQ( 162 ASSERT_EQ(
163 OK, 163 OK,
164 http_stream.InitializeStream(&request, net_log, CompletionCallback())); 164 http_stream.InitializeStream(&request, net_log, CompletionCallback()));
165 165
166 scoped_ptr<UploadDataStream> upload_stream( 166 scoped_ptr<UploadDataStream> upload_stream(
167 new UploadDataStream(request.upload_data)); 167 new UploadDataStream(request.upload_data.get()));
168 ASSERT_EQ(OK, upload_stream->InitSync()); 168 ASSERT_EQ(OK, upload_stream->InitSync());
169 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( 169 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest(
170 headers, upload_stream.Pass(), &response, callback.callback())); 170 headers, upload_stream.Pass(), &response, callback.callback()));
171 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); 171 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair));
172 172
173 // This triggers the MockWrite and read 2 173 // This triggers the MockWrite and read 2
174 callback.WaitForResult(); 174 callback.WaitForResult();
175 175
176 // This triggers read 3. The empty read causes the session to shut down. 176 // This triggers read 3. The empty read causes the session to shut down.
177 data()->CompleteRead(); 177 data()->CompleteRead();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 BoundNetLog net_log; 253 BoundNetLog net_log;
254 scoped_ptr<SpdyHttpStream> http_stream( 254 scoped_ptr<SpdyHttpStream> http_stream(
255 new SpdyHttpStream(session_.get(), true)); 255 new SpdyHttpStream(session_.get(), true));
256 ASSERT_EQ(OK, 256 ASSERT_EQ(OK,
257 http_stream->InitializeStream(&request, 257 http_stream->InitializeStream(&request,
258 net_log, 258 net_log,
259 CompletionCallback())); 259 CompletionCallback()));
260 260
261 scoped_ptr<UploadDataStream> upload_stream( 261 scoped_ptr<UploadDataStream> upload_stream(
262 new UploadDataStream(request.upload_data)); 262 new UploadDataStream(request.upload_data.get()));
263 ASSERT_EQ(OK, upload_stream->InitSync()); 263 ASSERT_EQ(OK, upload_stream->InitSync());
264 264
265 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false); 265 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false);
266 266
267 HttpRequestHeaders headers; 267 HttpRequestHeaders headers;
268 HttpResponseInfo response; 268 HttpResponseInfo response;
269 // This will attempt to Write() the initial request and headers, which will 269 // This will attempt to Write() the initial request and headers, which will
270 // complete asynchronously. 270 // complete asynchronously.
271 EXPECT_EQ(ERR_IO_PENDING, 271 EXPECT_EQ(ERR_IO_PENDING,
272 http_stream->SendRequest(headers, 272 http_stream->SendRequest(headers,
(...skipping 15 matching lines...) Expand all
288 data.RunFor(2); 288 data.RunFor(2);
289 289
290 // Read response headers. 290 // Read response headers.
291 data.RunFor(1); 291 data.RunFor(1);
292 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); 292 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback()));
293 293
294 // Read and check |chunk1| response. 294 // Read and check |chunk1| response.
295 data.RunFor(1); 295 data.RunFor(1);
296 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); 296 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize));
297 ASSERT_EQ(kUploadDataSize, 297 ASSERT_EQ(kUploadDataSize,
298 http_stream->ReadResponseBody(buf1, 298 http_stream->ReadResponseBody(buf1.get(),
299 kUploadDataSize, 299 kUploadDataSize,
300 callback.callback())); 300 callback.callback()));
301 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); 301 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize));
302 302
303 // Read and check |chunk2| response. 303 // Read and check |chunk2| response.
304 data.RunFor(1); 304 data.RunFor(1);
305 scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size)); 305 scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size));
306 ASSERT_EQ(kUploadData1Size, 306 ASSERT_EQ(kUploadData1Size,
307 http_stream->ReadResponseBody(buf2, 307 http_stream->ReadResponseBody(buf2.get(),
308 kUploadData1Size, 308 kUploadData1Size,
309 callback.callback())); 309 callback.callback()));
310 EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size)); 310 EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size));
311 311
312 // Read and check |chunk3| response. 312 // Read and check |chunk3| response.
313 data.RunFor(1); 313 data.RunFor(1);
314 scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize)); 314 scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize));
315 ASSERT_EQ(kUploadDataSize, 315 ASSERT_EQ(kUploadDataSize,
316 http_stream->ReadResponseBody(buf3, 316 http_stream->ReadResponseBody(buf3.get(),
317 kUploadDataSize, 317 kUploadDataSize,
318 callback.callback())); 318 callback.callback()));
319 EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize)); 319 EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize));
320 320
321 // Finish reading the |EOF|. 321 // Finish reading the |EOF|.
322 data.RunFor(1); 322 data.RunFor(1);
323 ASSERT_TRUE(response.headers.get()); 323 ASSERT_TRUE(response.headers.get());
324 ASSERT_EQ(200, response.headers->response_code()); 324 ASSERT_EQ(200, response.headers->response_code());
325 EXPECT_TRUE(data.at_read_eof()); 325 EXPECT_TRUE(data.at_read_eof());
326 EXPECT_TRUE(data.at_write_eof()); 326 EXPECT_TRUE(data.at_write_eof());
(...skipping 18 matching lines...) Expand all
345 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), 345 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes),
346 host_port_pair)); 346 host_port_pair));
347 347
348 HttpRequestInfo request; 348 HttpRequestInfo request;
349 request.method = "GET"; 349 request.method = "GET";
350 request.url = GURL(full_url); 350 request.url = GURL(full_url);
351 TestCompletionCallback callback; 351 TestCompletionCallback callback;
352 HttpResponseInfo response; 352 HttpResponseInfo response;
353 HttpRequestHeaders headers; 353 HttpRequestHeaders headers;
354 BoundNetLog net_log; 354 BoundNetLog net_log;
355 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); 355 scoped_ptr<SpdyHttpStream>
356 http_stream(new SpdyHttpStream(session_.get(), true));
356 ASSERT_EQ( 357 ASSERT_EQ(
357 OK, 358 OK,
358 http_stream->InitializeStream(&request, net_log, CompletionCallback())); 359 http_stream->InitializeStream(&request, net_log, CompletionCallback()));
359 360
360 EXPECT_EQ(ERR_IO_PENDING, 361 EXPECT_EQ(ERR_IO_PENDING,
361 http_stream->SendRequest(headers, scoped_ptr<UploadDataStream>(), 362 http_stream->SendRequest(headers, scoped_ptr<UploadDataStream>(),
362 &response, callback.callback())); 363 &response, callback.callback()));
363 364
364 const SpdyHeaderBlock& spdy_header = 365 const SpdyHeaderBlock& spdy_header =
365 http_stream->stream()->spdy_headers(); 366 http_stream->stream()->spdy_headers();
(...skipping 12 matching lines...) Expand all
378 // pool anymore. 379 // pool anymore.
379 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); 380 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair));
380 EXPECT_TRUE(data()->at_read_eof()); 381 EXPECT_TRUE(data()->at_read_eof());
381 EXPECT_TRUE(data()->at_write_eof()); 382 EXPECT_TRUE(data()->at_write_eof());
382 } 383 }
383 384
384 // TODO(willchan): Write a longer test for SpdyStream that exercises all 385 // TODO(willchan): Write a longer test for SpdyStream that exercises all
385 // methods. 386 // methods.
386 387
387 } // namespace net 388 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_proxy_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698