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

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

Issue 11415219: Move a number of static variables SPDY to HttpNetworkSession::Params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar cleanup Created 8 years 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
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 "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"
11 #include "crypto/signature_creator.h" 11 #include "crypto/signature_creator.h"
12 #include "net/base/asn1_util.h" 12 #include "net/base/asn1_util.h"
13 #include "net/base/default_server_bound_cert_store.h" 13 #include "net/base/default_server_bound_cert_store.h"
14 #include "net/base/upload_data.h" 14 #include "net/base/upload_data.h"
15 #include "net/base/upload_data_stream.h" 15 #include "net/base/upload_data_stream.h"
16 #include "net/http/http_request_info.h" 16 #include "net/http/http_request_info.h"
17 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
18 #include "net/http/http_response_info.h" 18 #include "net/http/http_response_info.h"
19 #include "net/spdy/spdy_credential_builder.h" 19 #include "net/spdy/spdy_credential_builder.h"
20 #include "net/spdy/spdy_http_utils.h" 20 #include "net/spdy/spdy_http_utils.h"
21 #include "net/spdy/spdy_session.h" 21 #include "net/spdy/spdy_session.h"
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 namespace {
30
31 } // namespace
willchan no longer on Chromium 2012/12/01 20:49:13 ?
Ryan Hamilton 2012/12/01 23:02:25 Removed.
32
29 class SpdyHttpStreamSpdy3Test : public testing::Test { 33 class SpdyHttpStreamSpdy3Test : public testing::Test {
30 public: 34 public:
31 OrderedSocketData* data() { return data_.get(); } 35 OrderedSocketData* data() { return data_.get(); }
32 protected: 36 protected:
33 SpdyHttpStreamSpdy3Test() {} 37 SpdyHttpStreamSpdy3Test()
34 38 : ec_signature_creator_factory_(new MockECSignatureCreatorFactory()) {
35 virtual void SetUp() {
36 SpdySession::set_default_protocol(kProtoSPDY3);
37 } 39 }
38 40
39 virtual void TearDown() { 41 virtual void TearDown() {
40 crypto::ECSignatureCreator::SetFactoryForTesting(NULL);
41 UploadDataStream::ResetMergeChunks(); 42 UploadDataStream::ResetMergeChunks();
42 MessageLoop::current()->RunUntilIdle(); 43 MessageLoop::current()->RunUntilIdle();
43 } 44 }
44 45
45 void set_merge_chunks(bool merge) { 46 void set_merge_chunks(bool merge) {
46 UploadDataStream::set_merge_chunks(merge); 47 UploadDataStream::set_merge_chunks(merge);
47 } 48 }
48 49
49 int InitSession(MockRead* reads, size_t reads_count, 50 int InitSession(MockRead* reads, size_t reads_count,
50 MockWrite* writes, size_t writes_count, 51 MockWrite* writes, size_t writes_count,
(...skipping 26 matching lines...) Expand all
77 const std::string& cert, 78 const std::string& cert,
78 const std::string& proof); 79 const std::string& proof);
79 80
80 SpdySessionDependencies session_deps_; 81 SpdySessionDependencies session_deps_;
81 scoped_ptr<OrderedSocketData> data_; 82 scoped_ptr<OrderedSocketData> data_;
82 scoped_refptr<HttpNetworkSession> http_session_; 83 scoped_refptr<HttpNetworkSession> http_session_;
83 scoped_refptr<SpdySession> session_; 84 scoped_refptr<SpdySession> session_;
84 scoped_refptr<TransportSocketParams> transport_params_; 85 scoped_refptr<TransportSocketParams> transport_params_;
85 86
86 private: 87 private:
87 SpdyTestStateHelper spdy_state_; 88 scoped_ptr<MockECSignatureCreatorFactory> ec_signature_creator_factory_;
willchan no longer on Chromium 2012/12/01 20:49:13 Why bother with a scoped_ptr? Do you need to reset
Ryan Hamilton 2012/12/01 23:02:25 Done.
88 }; 89 };
89 90
90 TEST_F(SpdyHttpStreamSpdy3Test, SendRequest) { 91 TEST_F(SpdyHttpStreamSpdy3Test, SendRequest) {
91 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 92 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
92 MockWrite writes[] = { 93 MockWrite writes[] = {
93 CreateMockWrite(*req.get(), 1), 94 CreateMockWrite(*req.get(), 1),
94 }; 95 };
95 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 96 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
96 MockRead reads[] = { 97 MockRead reads[] = {
97 CreateMockRead(*resp, 2), 98 CreateMockRead(*resp, 2),
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 733
733 sequenced_worker_pool->Shutdown(); 734 sequenced_worker_pool->Shutdown();
734 } 735 }
735 736
736 #endif // !defined(USE_OPENSSL) 737 #endif // !defined(USE_OPENSSL)
737 738
738 // TODO(willchan): Write a longer test for SpdyStream that exercises all 739 // TODO(willchan): Write a longer test for SpdyStream that exercises all
739 // methods. 740 // methods.
740 741
741 } // namespace net 742 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698