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

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

Issue 114933003: Minor cleanup of QUIC MockConnection and PacketSavingConnection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 10 matching lines...) Expand all
21 namespace net { 21 namespace net {
22 namespace tools { 22 namespace tools {
23 namespace test { 23 namespace test {
24 namespace { 24 namespace {
25 25
26 const char kServerHostname[] = "www.example.com"; 26 const char kServerHostname[] = "www.example.com";
27 27
28 class ToolsQuicClientSessionTest : public ::testing::Test { 28 class ToolsQuicClientSessionTest : public ::testing::Test {
29 protected: 29 protected:
30 ToolsQuicClientSessionTest() 30 ToolsQuicClientSessionTest()
31 : guid_(1), 31 : connection_(new PacketSavingConnection(false)) {
32 connection_(new PacketSavingConnection(guid_, IPEndPoint(), false)) {
33 crypto_config_.SetDefaults(); 32 crypto_config_.SetDefaults();
34 session_.reset(new QuicClientSession(kServerHostname, DefaultQuicConfig(), 33 session_.reset(new QuicClientSession(kServerHostname, DefaultQuicConfig(),
35 connection_, &crypto_config_)); 34 connection_, &crypto_config_));
36 session_->config()->SetDefaults(); 35 session_->config()->SetDefaults();
37 } 36 }
38 37
39 void CompleteCryptoHandshake() { 38 void CompleteCryptoHandshake() {
40 ASSERT_TRUE(session_->CryptoConnect()); 39 ASSERT_TRUE(session_->CryptoConnect());
41 CryptoTestUtils::HandshakeWithFakeServer( 40 CryptoTestUtils::HandshakeWithFakeServer(
42 connection_, session_->GetCryptoStream()); 41 connection_, session_->GetCryptoStream());
43 } 42 }
44 43
45 QuicGuid guid_;
46 PacketSavingConnection* connection_; 44 PacketSavingConnection* connection_;
47 scoped_ptr<QuicClientSession> session_; 45 scoped_ptr<QuicClientSession> session_;
48 QuicCryptoClientConfig crypto_config_; 46 QuicCryptoClientConfig crypto_config_;
49 }; 47 };
50 48
51 TEST_F(ToolsQuicClientSessionTest, CryptoConnect) { 49 TEST_F(ToolsQuicClientSessionTest, CryptoConnect) {
52 CompleteCryptoHandshake(); 50 CompleteCryptoHandshake();
53 } 51 }
54 52
55 TEST_F(ToolsQuicClientSessionTest, MaxNumStreams) { 53 TEST_F(ToolsQuicClientSessionTest, MaxNumStreams) {
(...skipping 19 matching lines...) Expand all
75 // After receiving a GoAway, I should no longer be able to create outgoing 73 // After receiving a GoAway, I should no longer be able to create outgoing
76 // streams. 74 // streams.
77 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); 75 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away."));
78 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream()); 76 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream());
79 } 77 }
80 78
81 } // namespace 79 } // namespace
82 } // namespace test 80 } // namespace test
83 } // namespace tools 81 } // namespace tools
84 } // namespace net 82 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698