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/tools/quic/quic_client_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
10 #include "net/quic/core/quic_flags.h" | 10 #include "net/quic/core/quic_flags.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); | 96 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); |
97 } | 97 } |
98 | 98 |
99 void CompleteCryptoHandshake() { | 99 void CompleteCryptoHandshake() { |
100 CompleteCryptoHandshake(kDefaultMaxStreamsPerConnection); | 100 CompleteCryptoHandshake(kDefaultMaxStreamsPerConnection); |
101 } | 101 } |
102 | 102 |
103 void CompleteCryptoHandshake(uint32_t server_max_incoming_streams) { | 103 void CompleteCryptoHandshake(uint32_t server_max_incoming_streams) { |
104 session_->CryptoConnect(); | 104 session_->CryptoConnect(); |
105 QuicCryptoClientStream* stream = | 105 QuicCryptoClientStream* stream = |
106 static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream()); | 106 static_cast<QuicCryptoClientStream*>(session_->GetMutableCryptoStream())
; |
107 crypto_test_utils::FakeServerOptions options; | 107 crypto_test_utils::FakeServerOptions options; |
108 QuicConfig config = DefaultQuicConfig(); | 108 QuicConfig config = DefaultQuicConfig(); |
109 config.SetMaxIncomingDynamicStreamsToSend(server_max_incoming_streams); | 109 config.SetMaxIncomingDynamicStreamsToSend(server_max_incoming_streams); |
110 crypto_test_utils::HandshakeWithFakeServer( | 110 crypto_test_utils::HandshakeWithFakeServer( |
111 &config, &helper_, &alarm_factory_, connection_, stream, options); | 111 &config, &helper_, &alarm_factory_, connection_, stream, options); |
112 } | 112 } |
113 | 113 |
114 QuicCryptoClientConfig crypto_config_; | 114 QuicCryptoClientConfig crypto_config_; |
115 MockQuicConnectionHelper helper_; | 115 MockQuicConnectionHelper helper_; |
116 MockAlarmFactory alarm_factory_; | 116 MockAlarmFactory alarm_factory_; |
(...skipping 29 matching lines...) Expand all Loading... |
146 session_->CreateOutgoingDynamicStream(kDefaultPriority); | 146 session_->CreateOutgoingDynamicStream(kDefaultPriority); |
147 ASSERT_TRUE(stream != nullptr); | 147 ASSERT_TRUE(stream != nullptr); |
148 EXPECT_NE(kCryptoStreamId, stream->id()); | 148 EXPECT_NE(kCryptoStreamId, stream->id()); |
149 | 149 |
150 // Process an "inchoate" REJ from the server which will cause | 150 // Process an "inchoate" REJ from the server which will cause |
151 // an inchoate CHLO to be sent and will leave the encryption level | 151 // an inchoate CHLO to be sent and will leave the encryption level |
152 // at NONE. | 152 // at NONE. |
153 CryptoHandshakeMessage rej; | 153 CryptoHandshakeMessage rej; |
154 crypto_test_utils::FillInDummyReject(&rej, /* stateless */ false); | 154 crypto_test_utils::FillInDummyReject(&rej, /* stateless */ false); |
155 EXPECT_TRUE(session_->IsEncryptionEstablished()); | 155 EXPECT_TRUE(session_->IsEncryptionEstablished()); |
156 session_->GetCryptoStream()->OnHandshakeMessage(rej); | 156 session_->GetMutableCryptoStream()->OnHandshakeMessage(rej); |
157 EXPECT_FALSE(session_->IsEncryptionEstablished()); | 157 EXPECT_FALSE(session_->IsEncryptionEstablished()); |
158 EXPECT_EQ(ENCRYPTION_NONE, | 158 EXPECT_EQ(ENCRYPTION_NONE, |
159 QuicPacketCreatorPeer::GetEncryptionLevel( | 159 QuicPacketCreatorPeer::GetEncryptionLevel( |
160 QuicConnectionPeer::GetPacketCreator(connection_))); | 160 QuicConnectionPeer::GetPacketCreator(connection_))); |
161 // Verify that no new streams may be created. | 161 // Verify that no new streams may be created. |
162 EXPECT_TRUE(session_->CreateOutgoingDynamicStream(kDefaultPriority) == | 162 EXPECT_TRUE(session_->CreateOutgoingDynamicStream(kDefaultPriority) == |
163 nullptr); | 163 nullptr); |
164 // Verify that no data may be send on existing streams. | 164 // Verify that no data may be send on existing streams. |
165 char data[] = "hello world"; | 165 char data[] = "hello world"; |
166 struct iovec iov = {data, arraysize(data)}; | 166 struct iovec iov = {data, arraysize(data)}; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 QuicClientPromisedInfo* promised = | 484 QuicClientPromisedInfo* promised = |
485 session_->GetPromisedById(promised_stream_id_); | 485 session_->GetPromisedById(promised_stream_id_); |
486 EXPECT_NE(promised, nullptr); | 486 EXPECT_NE(promised, nullptr); |
487 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); | 487 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); |
488 EXPECT_EQ(session_->GetPromisedStream(promised_stream_id_), nullptr); | 488 EXPECT_EQ(session_->GetPromisedStream(promised_stream_id_), nullptr); |
489 } | 489 } |
490 | 490 |
491 } // namespace | 491 } // namespace |
492 } // namespace test | 492 } // namespace test |
493 } // namespace net | 493 } // namespace net |
OLD | NEW |