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

Side by Side Diff: net/tools/quic/quic_client_session_test.cc

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with TOT Created 6 years, 9 months 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/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"
11 #include "net/quic/test_tools/crypto_test_utils.h" 11 #include "net/quic/test_tools/crypto_test_utils.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 12 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "net/tools/quic/quic_spdy_client_stream.h" 13 #include "net/tools/quic/quic_spdy_client_stream.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using net::test::CryptoTestUtils; 16 using net::test::CryptoTestUtils;
17 using net::test::DefaultQuicConfig; 17 using net::test::DefaultQuicConfig;
18 using net::test::PacketSavingConnection; 18 using net::test::PacketSavingConnection;
19 using net::test::SupportedVersions; 19 using net::test::SupportedVersions;
20 using testing::_; 20 using testing::_;
21 21
22 namespace net { 22 namespace net {
23 namespace tools { 23 namespace tools {
24 namespace test { 24 namespace test {
25 namespace { 25 namespace {
26 26
27 const char kServerHostname[] = "www.example.com"; 27 const char kServerHostname[] = "www.example.com";
28 const uint16 kPort = 80;
28 29
29 class ToolsQuicClientSessionTest 30 class ToolsQuicClientSessionTest
30 : public ::testing::TestWithParam<QuicVersion> { 31 : public ::testing::TestWithParam<QuicVersion> {
31 protected: 32 protected:
32 ToolsQuicClientSessionTest() 33 ToolsQuicClientSessionTest()
33 : connection_(new PacketSavingConnection(false, 34 : connection_(new PacketSavingConnection(false,
34 SupportedVersions(GetParam()))) { 35 SupportedVersions(GetParam()))) {
35 crypto_config_.SetDefaults(); 36 crypto_config_.SetDefaults();
36 session_.reset(new QuicClientSession(kServerHostname, DefaultQuicConfig(), 37 session_.reset(new QuicClientSession(
37 connection_, &crypto_config_)); 38 QuicSessionKey(kServerHostname, kPort, false),
39 DefaultQuicConfig(), connection_, &crypto_config_));
38 session_->config()->SetDefaults(); 40 session_->config()->SetDefaults();
39 } 41 }
40 42
41 void CompleteCryptoHandshake() { 43 void CompleteCryptoHandshake() {
42 ASSERT_TRUE(session_->CryptoConnect()); 44 ASSERT_TRUE(session_->CryptoConnect());
43 CryptoTestUtils::HandshakeWithFakeServer( 45 CryptoTestUtils::HandshakeWithFakeServer(
44 connection_, session_->GetCryptoStream()); 46 connection_, session_->GetCryptoStream());
45 } 47 }
46 48
47 PacketSavingConnection* connection_; 49 PacketSavingConnection* connection_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // After receiving a GoAway, I should no longer be able to create outgoing 81 // After receiving a GoAway, I should no longer be able to create outgoing
80 // streams. 82 // streams.
81 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); 83 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away."));
82 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream()); 84 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream());
83 } 85 }
84 86
85 } // namespace 87 } // namespace
86 } // namespace test 88 } // namespace test
87 } // namespace tools 89 } // namespace tools
88 } // namespace net 90 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698