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

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

Issue 10913179: net: Make UploadDataStream::Init() asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changed argument order Created 8 years, 3 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
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/spdy/spdy_http_stream_spdy3_unittest.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 HttpResponseInfo response; 157 HttpResponseInfo response;
158 HttpRequestHeaders headers; 158 HttpRequestHeaders headers;
159 BoundNetLog net_log; 159 BoundNetLog net_log;
160 SpdyHttpStream http_stream(session_.get(), true); 160 SpdyHttpStream http_stream(session_.get(), true);
161 ASSERT_EQ( 161 ASSERT_EQ(
162 OK, 162 OK,
163 http_stream.InitializeStream(&request, net_log, CompletionCallback())); 163 http_stream.InitializeStream(&request, net_log, CompletionCallback()));
164 164
165 scoped_ptr<UploadDataStream> upload_stream( 165 scoped_ptr<UploadDataStream> upload_stream(
166 new UploadDataStream(request.upload_data)); 166 new UploadDataStream(request.upload_data));
167 ASSERT_EQ(OK, upload_stream->Init()); 167 ASSERT_EQ(OK, upload_stream->InitSync());
168 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( 168 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest(
169 headers, upload_stream.Pass(), &response, callback.callback())); 169 headers, upload_stream.Pass(), &response, callback.callback()));
170 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); 170 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair));
171 171
172 // This triggers the MockWrite and read 2 172 // This triggers the MockWrite and read 2
173 callback.WaitForResult(); 173 callback.WaitForResult();
174 174
175 // This triggers read 3. The empty read causes the session to shut down. 175 // This triggers read 3. The empty read causes the session to shut down.
176 data()->CompleteRead(); 176 data()->CompleteRead();
177 MessageLoop::current()->RunAllPending(); 177 MessageLoop::current()->RunAllPending();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 BoundNetLog net_log; 252 BoundNetLog net_log;
253 scoped_ptr<SpdyHttpStream> http_stream( 253 scoped_ptr<SpdyHttpStream> http_stream(
254 new SpdyHttpStream(session_.get(), true)); 254 new SpdyHttpStream(session_.get(), true));
255 ASSERT_EQ(OK, 255 ASSERT_EQ(OK,
256 http_stream->InitializeStream(&request, 256 http_stream->InitializeStream(&request,
257 net_log, 257 net_log,
258 CompletionCallback())); 258 CompletionCallback()));
259 259
260 scoped_ptr<UploadDataStream> upload_stream( 260 scoped_ptr<UploadDataStream> upload_stream(
261 new UploadDataStream(request.upload_data)); 261 new UploadDataStream(request.upload_data));
262 ASSERT_EQ(OK, upload_stream->Init()); 262 ASSERT_EQ(OK, upload_stream->InitSync());
263 263
264 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false); 264 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false);
265 265
266 HttpRequestHeaders headers; 266 HttpRequestHeaders headers;
267 HttpResponseInfo response; 267 HttpResponseInfo response;
268 // This will attempt to Write() the initial request and headers, which will 268 // This will attempt to Write() the initial request and headers, which will
269 // complete asynchronously. 269 // complete asynchronously.
270 EXPECT_EQ(ERR_IO_PENDING, 270 EXPECT_EQ(ERR_IO_PENDING,
271 http_stream->SendRequest(headers, 271 http_stream->SendRequest(headers,
272 upload_stream.Pass(), 272 upload_stream.Pass(),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // pool anymore. 377 // pool anymore.
378 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); 378 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair));
379 EXPECT_TRUE(data()->at_read_eof()); 379 EXPECT_TRUE(data()->at_read_eof());
380 EXPECT_TRUE(data()->at_write_eof()); 380 EXPECT_TRUE(data()->at_write_eof());
381 } 381 }
382 382
383 // TODO(willchan): Write a longer test for SpdyStream that exercises all 383 // TODO(willchan): Write a longer test for SpdyStream that exercises all
384 // methods. 384 // methods.
385 385
386 } // namespace net 386 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/spdy/spdy_http_stream_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698