| 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 "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 10 matching lines...) Expand all Loading... |
| 21 using namespace net::test_spdy2; | 21 using namespace net::test_spdy2; |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class SpdyHttpStreamSpdy2Test : public testing::Test { | 25 class SpdyHttpStreamSpdy2Test : public testing::Test { |
| 26 public: | 26 public: |
| 27 OrderedSocketData* data() { return data_.get(); } | 27 OrderedSocketData* data() { return data_.get(); } |
| 28 protected: | 28 protected: |
| 29 SpdyHttpStreamSpdy2Test() {} | 29 SpdyHttpStreamSpdy2Test() {} |
| 30 | 30 |
| 31 virtual void SetUp() { | |
| 32 SpdySession::set_default_protocol(kProtoSPDY2); | |
| 33 } | |
| 34 | |
| 35 virtual void TearDown() { | 31 virtual void TearDown() { |
| 36 crypto::ECSignatureCreator::SetFactoryForTesting(NULL); | 32 crypto::ECSignatureCreator::SetFactoryForTesting(NULL); |
| 37 UploadDataStream::ResetMergeChunks(); | 33 UploadDataStream::ResetMergeChunks(); |
| 38 MessageLoop::current()->RunUntilIdle(); | 34 MessageLoop::current()->RunUntilIdle(); |
| 39 } | 35 } |
| 40 | 36 |
| 41 void set_merge_chunks(bool merge) { | 37 void set_merge_chunks(bool merge) { |
| 42 UploadDataStream::set_merge_chunks(merge); | 38 UploadDataStream::set_merge_chunks(merge); |
| 43 } | 39 } |
| 44 | 40 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 BoundNetLog())); | 62 BoundNetLog())); |
| 67 EXPECT_EQ(OK, callback.WaitForResult()); | 63 EXPECT_EQ(OK, callback.WaitForResult()); |
| 68 return session_->InitializeWithSocket(connection.release(), false, OK); | 64 return session_->InitializeWithSocket(connection.release(), false, OK); |
| 69 } | 65 } |
| 70 | 66 |
| 71 SpdySessionDependencies session_deps_; | 67 SpdySessionDependencies session_deps_; |
| 72 scoped_ptr<OrderedSocketData> data_; | 68 scoped_ptr<OrderedSocketData> data_; |
| 73 scoped_refptr<HttpNetworkSession> http_session_; | 69 scoped_refptr<HttpNetworkSession> http_session_; |
| 74 scoped_refptr<SpdySession> session_; | 70 scoped_refptr<SpdySession> session_; |
| 75 scoped_refptr<TransportSocketParams> transport_params_; | 71 scoped_refptr<TransportSocketParams> transport_params_; |
| 76 | |
| 77 private: | |
| 78 SpdyTestStateHelper spdy_state_; | |
| 79 }; | 72 }; |
| 80 | 73 |
| 81 TEST_F(SpdyHttpStreamSpdy2Test, SendRequest) { | 74 TEST_F(SpdyHttpStreamSpdy2Test, SendRequest) { |
| 82 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 75 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 83 MockWrite writes[] = { | 76 MockWrite writes[] = { |
| 84 CreateMockWrite(*req.get(), 1), | 77 CreateMockWrite(*req.get(), 1), |
| 85 }; | 78 }; |
| 86 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 79 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 87 MockRead reads[] = { | 80 MockRead reads[] = { |
| 88 CreateMockRead(*resp, 2), | 81 CreateMockRead(*resp, 2), |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // pool anymore. | 370 // pool anymore. |
| 378 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); | 371 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); |
| 379 EXPECT_TRUE(data()->at_read_eof()); | 372 EXPECT_TRUE(data()->at_read_eof()); |
| 380 EXPECT_TRUE(data()->at_write_eof()); | 373 EXPECT_TRUE(data()->at_write_eof()); |
| 381 } | 374 } |
| 382 | 375 |
| 383 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 376 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 384 // methods. | 377 // methods. |
| 385 | 378 |
| 386 } // namespace net | 379 } // namespace net |
| OLD | NEW |