OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tools/quic/quic_server_session.h" | 5 #include "net/tools/quic/quic_server_session.h" |
6 | 6 |
7 #include "net/quic/crypto/cached_network_parameters.h" | 7 #include "net/quic/crypto/cached_network_parameters.h" |
8 #include "net/quic/crypto/quic_crypto_server_config.h" | 8 #include "net/quic/crypto/quic_crypto_server_config.h" |
9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 using net::test::QuicConnectionPeer; | 29 using net::test::QuicConnectionPeer; |
30 using net::test::QuicDataStreamPeer; | 30 using net::test::QuicDataStreamPeer; |
31 using net::test::QuicSentPacketManagerPeer; | 31 using net::test::QuicSentPacketManagerPeer; |
32 using net::test::QuicSessionPeer; | 32 using net::test::QuicSessionPeer; |
33 using net::test::QuicSustainedBandwidthRecorderPeer; | 33 using net::test::QuicSustainedBandwidthRecorderPeer; |
34 using net::test::SupportedVersions; | 34 using net::test::SupportedVersions; |
35 using net::test::ValueRestore; | 35 using net::test::ValueRestore; |
36 using net::test::kClientDataStreamId1; | 36 using net::test::kClientDataStreamId1; |
37 using net::test::kClientDataStreamId2; | 37 using net::test::kClientDataStreamId2; |
38 using net::test::kClientDataStreamId3; | 38 using net::test::kClientDataStreamId3; |
39 using net::test::kClientDataStreamId4; | |
40 using std::string; | 39 using std::string; |
41 using testing::StrictMock; | 40 using testing::StrictMock; |
42 using testing::_; | 41 using testing::_; |
43 | 42 |
44 namespace net { | 43 namespace net { |
45 namespace tools { | 44 namespace tools { |
46 namespace test { | 45 namespace test { |
47 | 46 |
48 class QuicServerSessionPeer { | 47 class QuicServerSessionPeer { |
49 public: | 48 public: |
50 static QuicDataStream* GetIncomingDataStream( | 49 static QuicDataStream* GetIncomingDataStream( |
51 QuicServerSession* s, QuicStreamId id) { | 50 QuicServerSession* s, QuicStreamId id) { |
52 return s->GetIncomingDataStream(id); | 51 return s->GetIncomingDataStream(id); |
53 } | 52 } |
54 static QuicDataStream* GetDataStream(QuicServerSession* s, QuicStreamId id) { | |
55 return s->GetDataStream(id); | |
56 } | |
57 static void SetCryptoStream(QuicServerSession* s, | 53 static void SetCryptoStream(QuicServerSession* s, |
58 QuicCryptoServerStream* crypto_stream) { | 54 QuicCryptoServerStream* crypto_stream) { |
59 s->crypto_stream_.reset(crypto_stream); | 55 s->crypto_stream_.reset(crypto_stream); |
60 } | 56 } |
61 }; | 57 }; |
62 | 58 |
63 namespace { | 59 namespace { |
64 | 60 |
65 const size_t kMaxStreamsForTest = 10; | 61 const size_t kMaxStreamsForTest = 10; |
66 | 62 |
(...skipping 13 matching lines...) Expand all Loading... |
80 new StrictMock<MockConnection>(true, SupportedVersions(GetParam())); | 76 new StrictMock<MockConnection>(true, SupportedVersions(GetParam())); |
81 session_.reset(new QuicServerSession(config_, connection_, &owner_)); | 77 session_.reset(new QuicServerSession(config_, connection_, &owner_)); |
82 MockClock clock; | 78 MockClock clock; |
83 handshake_message_.reset(crypto_config_.AddDefaultConfig( | 79 handshake_message_.reset(crypto_config_.AddDefaultConfig( |
84 QuicRandom::GetInstance(), &clock, | 80 QuicRandom::GetInstance(), &clock, |
85 QuicCryptoServerConfig::ConfigOptions())); | 81 QuicCryptoServerConfig::ConfigOptions())); |
86 session_->InitializeSession(crypto_config_); | 82 session_->InitializeSession(crypto_config_); |
87 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 83 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
88 } | 84 } |
89 | 85 |
90 QuicVersion version() const { return connection_->version(); } | |
91 | |
92 StrictMock<MockQuicServerSessionVisitor> owner_; | 86 StrictMock<MockQuicServerSessionVisitor> owner_; |
93 StrictMock<MockConnection>* connection_; | 87 StrictMock<MockConnection>* connection_; |
94 QuicConfig config_; | 88 QuicConfig config_; |
95 QuicCryptoServerConfig crypto_config_; | 89 QuicCryptoServerConfig crypto_config_; |
96 scoped_ptr<QuicServerSession> session_; | 90 scoped_ptr<QuicServerSession> session_; |
97 scoped_ptr<CryptoHandshakeMessage> handshake_message_; | 91 scoped_ptr<CryptoHandshakeMessage> handshake_message_; |
98 QuicConnectionVisitorInterface* visitor_; | 92 QuicConnectionVisitorInterface* visitor_; |
99 }; | 93 }; |
100 | 94 |
101 // Compares CachedNetworkParameters. | 95 // Compares CachedNetworkParameters. |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 cached_network_params.set_serving_region(kTestServingRegion); | 417 cached_network_params.set_serving_region(kTestServingRegion); |
424 crypto_stream->set_previous_cached_network_params(cached_network_params); | 418 crypto_stream->set_previous_cached_network_params(cached_network_params); |
425 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); | 419 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); |
426 session_->OnConfigNegotiated(); | 420 session_->OnConfigNegotiated(); |
427 } | 421 } |
428 | 422 |
429 } // namespace | 423 } // namespace |
430 } // namespace test | 424 } // namespace test |
431 } // namespace tools | 425 } // namespace tools |
432 } // namespace net | 426 } // namespace net |
OLD | NEW |