| 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 11 matching lines...) Expand all Loading... |
| 22 #include "net/spdy/spdy_test_util_spdy3.h" | 22 #include "net/spdy/spdy_test_util_spdy3.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 using namespace net::test_spdy3; | 25 using namespace net::test_spdy3; |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 class SpdyHttpStreamSpdy3Test : public testing::Test { | 29 class SpdyHttpStreamSpdy3Test : public testing::Test { |
| 30 public: | 30 public: |
| 31 OrderedSocketData* data() { return data_.get(); } | 31 OrderedSocketData* data() { return data_.get(); } |
| 32 |
| 32 protected: | 33 protected: |
| 33 SpdyHttpStreamSpdy3Test() {} | |
| 34 | |
| 35 virtual void SetUp() { | |
| 36 SpdySession::set_default_protocol(kProtoSPDY3); | |
| 37 } | |
| 38 | |
| 39 virtual void TearDown() { | 34 virtual void TearDown() { |
| 40 crypto::ECSignatureCreator::SetFactoryForTesting(NULL); | |
| 41 UploadDataStream::ResetMergeChunks(); | 35 UploadDataStream::ResetMergeChunks(); |
| 42 MessageLoop::current()->RunUntilIdle(); | 36 MessageLoop::current()->RunUntilIdle(); |
| 43 } | 37 } |
| 44 | 38 |
| 45 void set_merge_chunks(bool merge) { | 39 void set_merge_chunks(bool merge) { |
| 46 UploadDataStream::set_merge_chunks(merge); | 40 UploadDataStream::set_merge_chunks(merge); |
| 47 } | 41 } |
| 48 | 42 |
| 49 int InitSession(MockRead* reads, size_t reads_count, | 43 int InitSession(MockRead* reads, size_t reads_count, |
| 50 MockWrite* writes, size_t writes_count, | 44 MockWrite* writes, size_t writes_count, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 77 const std::string& cert, | 71 const std::string& cert, |
| 78 const std::string& proof); | 72 const std::string& proof); |
| 79 | 73 |
| 80 SpdySessionDependencies session_deps_; | 74 SpdySessionDependencies session_deps_; |
| 81 scoped_ptr<OrderedSocketData> data_; | 75 scoped_ptr<OrderedSocketData> data_; |
| 82 scoped_refptr<HttpNetworkSession> http_session_; | 76 scoped_refptr<HttpNetworkSession> http_session_; |
| 83 scoped_refptr<SpdySession> session_; | 77 scoped_refptr<SpdySession> session_; |
| 84 scoped_refptr<TransportSocketParams> transport_params_; | 78 scoped_refptr<TransportSocketParams> transport_params_; |
| 85 | 79 |
| 86 private: | 80 private: |
| 87 SpdyTestStateHelper spdy_state_; | 81 MockECSignatureCreatorFactory ec_signature_creator_factory_; |
| 88 }; | 82 }; |
| 89 | 83 |
| 90 TEST_F(SpdyHttpStreamSpdy3Test, SendRequest) { | 84 TEST_F(SpdyHttpStreamSpdy3Test, SendRequest) { |
| 91 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 85 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 92 MockWrite writes[] = { | 86 MockWrite writes[] = { |
| 93 CreateMockWrite(*req.get(), 1), | 87 CreateMockWrite(*req.get(), 1), |
| 94 }; | 88 }; |
| 95 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 89 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 96 MockRead reads[] = { | 90 MockRead reads[] = { |
| 97 CreateMockRead(*resp, 2), | 91 CreateMockRead(*resp, 2), |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 726 |
| 733 sequenced_worker_pool->Shutdown(); | 727 sequenced_worker_pool->Shutdown(); |
| 734 } | 728 } |
| 735 | 729 |
| 736 #endif // !defined(USE_OPENSSL) | 730 #endif // !defined(USE_OPENSSL) |
| 737 | 731 |
| 738 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 732 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 739 // methods. | 733 // methods. |
| 740 | 734 |
| 741 } // namespace net | 735 } // namespace net |
| OLD | NEW |