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

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

Issue 12806002: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor comment fix Created 7 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
« no previous file with comments | « net/quic/crypto/quic_encrypter.cc ('k') | net/quic/quic_connection.h » ('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/quic/quic_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/capturing_net_log.h" 10 #include "net/base/capturing_net_log.h"
(...skipping 10 matching lines...) Expand all
21 namespace net { 21 namespace net {
22 namespace test { 22 namespace test {
23 namespace { 23 namespace {
24 24
25 const char kServerHostname[] = "www.example.com"; 25 const char kServerHostname[] = "www.example.com";
26 26
27 class QuicClientSessionTest : public ::testing::Test { 27 class QuicClientSessionTest : public ::testing::Test {
28 protected: 28 protected:
29 QuicClientSessionTest() 29 QuicClientSessionTest()
30 : guid_(1), 30 : guid_(1),
31 connection_(new PacketSavingConnection(guid_, IPEndPoint())), 31 connection_(new PacketSavingConnection(guid_, IPEndPoint(), false)),
32 session_(connection_, NULL, NULL, kServerHostname, &net_log_) { 32 session_(connection_, NULL, NULL, kServerHostname, &net_log_) {
33 } 33 }
34 34
35 void CompleteCryptoHandshake() { 35 void CompleteCryptoHandshake() {
36 ASSERT_EQ(ERR_IO_PENDING, 36 ASSERT_EQ(ERR_IO_PENDING,
37 session_.CryptoConnect(callback_.callback())); 37 session_.CryptoConnect(callback_.callback()));
38 session_.GetCryptoStream()->OnHandshakeMessage( 38 session_.GetCryptoStream()->OnHandshakeMessage(
39 CreateShloMessage(&clock_, &random_, "www.google.com")); 39 CreateShloMessage(&clock_, &random_, "www.google.com"));
40 ASSERT_EQ(OK, callback_.WaitForResult()); 40 ASSERT_EQ(OK, callback_.WaitForResult());
41 41
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 EXPECT_EQ(NULL, session_.CreateOutgoingReliableStream()); 85 EXPECT_EQ(NULL, session_.CreateOutgoingReliableStream());
86 } 86 }
87 87
88 TEST_F(QuicClientSessionTest, Logging) { 88 TEST_F(QuicClientSessionTest, Logging) {
89 CompleteCryptoHandshake(); 89 CompleteCryptoHandshake();
90 90
91 // TODO(rch): Add some helper methods to simplify packet creation in tests. 91 // TODO(rch): Add some helper methods to simplify packet creation in tests.
92 // Receive a packet, and verify that it was logged. 92 // Receive a packet, and verify that it was logged.
93 QuicFramer framer(kQuicVersion1, 93 QuicFramer framer(kQuicVersion1,
94 QuicDecrypter::Create(kNULL), 94 QuicDecrypter::Create(kNULL),
95 QuicEncrypter::Create(kNULL)); 95 QuicEncrypter::Create(kNULL),
96 false);
96 QuicRstStreamFrame frame; 97 QuicRstStreamFrame frame;
97 frame.stream_id = 2; 98 frame.stream_id = 2;
98 frame.error_code = QUIC_CONNECTION_TIMED_OUT; 99 frame.error_code = QUIC_CONNECTION_TIMED_OUT;
99 frame.error_details = "doh!"; 100 frame.error_details = "doh!";
100 101
101 QuicFrames frames; 102 QuicFrames frames;
102 frames.push_back(QuicFrame(&frame)); 103 frames.push_back(QuicFrame(&frame));
103 QuicPacketHeader header; 104 QuicPacketHeader header;
104 header.public_header.guid = 1; 105 header.public_header.guid = 1;
105 header.public_header.reset_flag = false; 106 header.public_header.reset_flag = false;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ASSERT_TRUE(entries[pos].GetIntegerValue("error_code", &error_code)); 146 ASSERT_TRUE(entries[pos].GetIntegerValue("error_code", &error_code));
146 EXPECT_EQ(frame.error_code, static_cast<QuicErrorCode>(error_code)); 147 EXPECT_EQ(frame.error_code, static_cast<QuicErrorCode>(error_code));
147 std::string details; 148 std::string details;
148 ASSERT_TRUE(entries[pos].GetStringValue("details", &details)); 149 ASSERT_TRUE(entries[pos].GetStringValue("details", &details));
149 EXPECT_EQ(frame.error_details, details); 150 EXPECT_EQ(frame.error_details, details);
150 } 151 }
151 152
152 } // namespace 153 } // namespace
153 } // namespace test 154 } // namespace test
154 } // namespace net 155 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_encrypter.cc ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698