| 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/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ASSERT_TRUE(stream); | 70 ASSERT_TRUE(stream); |
| 71 EXPECT_FALSE(session_->CreateOutgoingReliableStream()); | 71 EXPECT_FALSE(session_->CreateOutgoingReliableStream()); |
| 72 | 72 |
| 73 // Close a stream and ensure I can now open a new one. | 73 // Close a stream and ensure I can now open a new one. |
| 74 session_->CloseStream(stream->id()); | 74 session_->CloseStream(stream->id()); |
| 75 stream = session_->CreateOutgoingReliableStream(); | 75 stream = session_->CreateOutgoingReliableStream(); |
| 76 EXPECT_TRUE(stream); | 76 EXPECT_TRUE(stream); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST_F(QuicClientSessionTest, GoAwayReceived) { | 79 TEST_F(QuicClientSessionTest, GoAwayReceived) { |
| 80 // Initialize crypto before the client session will create a stream. | 80 if (!Aes128Gcm12Encrypter::IsSupported()) { |
| 81 ASSERT_TRUE(session_->CryptoConnect()); | 81 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 82 // Simulate the server crypto handshake. | 82 return; |
| 83 CryptoHandshakeMessage server_message; | 83 } |
| 84 server_message.set_tag(kSHLO); | 84 |
| 85 session_->GetCryptoStream()->OnHandshakeMessage(server_message); | 85 CompleteCryptoHandshake(); |
| 86 | 86 |
| 87 // After receiving a GoAway, I should no longer be able to create outgoing | 87 // After receiving a GoAway, I should no longer be able to create outgoing |
| 88 // streams. | 88 // streams. |
| 89 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 89 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
| 90 EXPECT_EQ(NULL, session_->CreateOutgoingReliableStream()); | 90 EXPECT_EQ(NULL, session_->CreateOutgoingReliableStream()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 } // namespace test | 94 } // namespace test |
| 95 } // namespace tools | 95 } // namespace tools |
| 96 } // namespace net | 96 } // namespace net |
| OLD | NEW |