| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
| 10 #include "crypto/ec_signature_creator.h" | 10 #include "crypto/ec_signature_creator.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 HttpResponseInfo response; | 166 HttpResponseInfo response; |
| 167 HttpRequestHeaders headers; | 167 HttpRequestHeaders headers; |
| 168 BoundNetLog net_log; | 168 BoundNetLog net_log; |
| 169 SpdyHttpStream http_stream(session_.get(), true); | 169 SpdyHttpStream http_stream(session_.get(), true); |
| 170 ASSERT_EQ( | 170 ASSERT_EQ( |
| 171 OK, | 171 OK, |
| 172 http_stream.InitializeStream(&request, net_log, CompletionCallback())); | 172 http_stream.InitializeStream(&request, net_log, CompletionCallback())); |
| 173 | 173 |
| 174 scoped_ptr<UploadDataStream> upload_stream( | 174 scoped_ptr<UploadDataStream> upload_stream( |
| 175 new UploadDataStream(request.upload_data)); | 175 new UploadDataStream(request.upload_data)); |
| 176 ASSERT_EQ(OK, upload_stream->Init()); | 176 ASSERT_EQ(OK, upload_stream->InitSync()); |
| 177 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( | 177 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( |
| 178 headers, upload_stream.Pass(), &response, callback.callback())); | 178 headers, upload_stream.Pass(), &response, callback.callback())); |
| 179 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); | 179 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); |
| 180 | 180 |
| 181 // This triggers the MockWrite and read 2 | 181 // This triggers the MockWrite and read 2 |
| 182 callback.WaitForResult(); | 182 callback.WaitForResult(); |
| 183 | 183 |
| 184 // This triggers read 3. The empty read causes the session to shut down. | 184 // This triggers read 3. The empty read causes the session to shut down. |
| 185 data()->CompleteRead(); | 185 data()->CompleteRead(); |
| 186 MessageLoop::current()->RunAllPending(); | 186 MessageLoop::current()->RunAllPending(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 BoundNetLog net_log; | 261 BoundNetLog net_log; |
| 262 scoped_ptr<SpdyHttpStream> http_stream( | 262 scoped_ptr<SpdyHttpStream> http_stream( |
| 263 new SpdyHttpStream(session_.get(), true)); | 263 new SpdyHttpStream(session_.get(), true)); |
| 264 ASSERT_EQ(OK, | 264 ASSERT_EQ(OK, |
| 265 http_stream->InitializeStream(&request, | 265 http_stream->InitializeStream(&request, |
| 266 net_log, | 266 net_log, |
| 267 CompletionCallback())); | 267 CompletionCallback())); |
| 268 | 268 |
| 269 scoped_ptr<UploadDataStream> upload_stream( | 269 scoped_ptr<UploadDataStream> upload_stream( |
| 270 new UploadDataStream(request.upload_data)); | 270 new UploadDataStream(request.upload_data)); |
| 271 ASSERT_EQ(OK, upload_stream->Init()); | 271 ASSERT_EQ(OK, upload_stream->InitSync()); |
| 272 | 272 |
| 273 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false); | 273 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, false); |
| 274 | 274 |
| 275 HttpRequestHeaders headers; | 275 HttpRequestHeaders headers; |
| 276 HttpResponseInfo response; | 276 HttpResponseInfo response; |
| 277 // This will attempt to Write() the initial request and headers, which will | 277 // This will attempt to Write() the initial request and headers, which will |
| 278 // complete asynchronously. | 278 // complete asynchronously. |
| 279 EXPECT_EQ(ERR_IO_PENDING, | 279 EXPECT_EQ(ERR_IO_PENDING, |
| 280 http_stream->SendRequest(headers, | 280 http_stream->SendRequest(headers, |
| 281 upload_stream.Pass(), | 281 upload_stream.Pass(), |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 BoundNetLog net_log; | 397 BoundNetLog net_log; |
| 398 scoped_ptr<SpdyHttpStream> http_stream( | 398 scoped_ptr<SpdyHttpStream> http_stream( |
| 399 new SpdyHttpStream(session_.get(), true)); | 399 new SpdyHttpStream(session_.get(), true)); |
| 400 ASSERT_EQ(OK, | 400 ASSERT_EQ(OK, |
| 401 http_stream->InitializeStream(&request, | 401 http_stream->InitializeStream(&request, |
| 402 net_log, | 402 net_log, |
| 403 CompletionCallback())); | 403 CompletionCallback())); |
| 404 | 404 |
| 405 scoped_ptr<UploadDataStream> upload_stream( | 405 scoped_ptr<UploadDataStream> upload_stream( |
| 406 new UploadDataStream(request.upload_data)); | 406 new UploadDataStream(request.upload_data)); |
| 407 ASSERT_EQ(OK, upload_stream->Init()); | 407 ASSERT_EQ(OK, upload_stream->InitSync()); |
| 408 | 408 |
| 409 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, true); | 409 request.upload_data->AppendChunk(kUploadData, kUploadDataSize, true); |
| 410 | 410 |
| 411 HttpRequestHeaders headers; | 411 HttpRequestHeaders headers; |
| 412 HttpResponseInfo response; | 412 HttpResponseInfo response; |
| 413 // This will attempt to Write() the initial request and headers, which will | 413 // This will attempt to Write() the initial request and headers, which will |
| 414 // complete asynchronously. | 414 // complete asynchronously. |
| 415 EXPECT_EQ(ERR_IO_PENDING, | 415 EXPECT_EQ(ERR_IO_PENDING, |
| 416 http_stream->SendRequest(headers, | 416 http_stream->SendRequest(headers, |
| 417 upload_stream.Pass(), | 417 upload_stream.Pass(), |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 739 |
| 740 sequenced_worker_pool->Shutdown(); | 740 sequenced_worker_pool->Shutdown(); |
| 741 } | 741 } |
| 742 | 742 |
| 743 #endif // !defined(USE_OPENSSL) | 743 #endif // !defined(USE_OPENSSL) |
| 744 | 744 |
| 745 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 745 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 746 // methods. | 746 // methods. |
| 747 | 747 |
| 748 } // namespace net | 748 } // namespace net |
| OLD | NEW |