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

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

Issue 9350060: net: Make UploadDataStream::Init() asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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_network_transaction_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/rsa_private_key.h" 7 #include "crypto/rsa_private_key.h"
8 #include "crypto/signature_creator.h" 8 #include "crypto/signature_creator.h"
9 #include "net/base/default_origin_bound_cert_store.h" 9 #include "net/base/default_origin_bound_cert_store.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 HttpResponseInfo response; 144 HttpResponseInfo response;
145 HttpRequestHeaders headers; 145 HttpRequestHeaders headers;
146 BoundNetLog net_log; 146 BoundNetLog net_log;
147 SpdyHttpStream http_stream(session_.get(), true); 147 SpdyHttpStream http_stream(session_.get(), true);
148 ASSERT_EQ( 148 ASSERT_EQ(
149 OK, 149 OK,
150 http_stream.InitializeStream(&request, net_log, CompletionCallback())); 150 http_stream.InitializeStream(&request, net_log, CompletionCallback()));
151 151
152 // http_stream.SendRequest() will take ownership of upload_stream. 152 // http_stream.SendRequest() will take ownership of upload_stream.
153 UploadDataStream* upload_stream = new UploadDataStream(request.upload_data); 153 UploadDataStream* upload_stream = new UploadDataStream(request.upload_data);
154 ASSERT_EQ(OK, upload_stream->Init()); 154 ASSERT_EQ(OK, upload_stream->InitSync());
155 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( 155 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest(
156 headers, upload_stream, &response, callback.callback())); 156 headers, upload_stream, &response, callback.callback()));
157 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); 157 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair));
158 158
159 // This triggers the MockWrite and read 2 159 // This triggers the MockWrite and read 2
160 callback.WaitForResult(); 160 callback.WaitForResult();
161 161
162 // This triggers read 3. The empty read causes the session to shut down. 162 // This triggers read 3. The empty read causes the session to shut down.
163 data()->CompleteRead(); 163 data()->CompleteRead();
164 MessageLoop::current()->RunAllPending(); 164 MessageLoop::current()->RunAllPending();
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ASSERT_TRUE(response.headers.get() != NULL); 391 ASSERT_TRUE(response.headers.get() != NULL);
392 ASSERT_EQ(200, response.headers->response_code()); 392 ASSERT_EQ(200, response.headers->response_code());
393 } 393 }
394 394
395 #endif // !defined(USE_OPENSSL) 395 #endif // !defined(USE_OPENSSL)
396 396
397 // TODO(willchan): Write a longer test for SpdyStream that exercises all 397 // TODO(willchan): Write a longer test for SpdyStream that exercises all
398 // methods. 398 // methods.
399 399
400 } // namespace net 400 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698