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

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

Issue 1905843003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. No behavior change,… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119753783
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « net/tools/quic/quic_client_base.cc ('k') | net/tools/quic/quic_dispatcher.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/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 "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); 87 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1));
88 } 88 }
89 89
90 ~QuicClientSessionTest() override { 90 ~QuicClientSessionTest() override {
91 // Session must be destroyed before promised_by_url_ 91 // Session must be destroyed before promised_by_url_
92 session_.reset(nullptr); 92 session_.reset(nullptr);
93 } 93 }
94 94
95 void Initialize() { 95 void Initialize() {
96 session_.reset(); 96 session_.reset();
97 connection_ = new PacketSavingConnection(&helper_, Perspective::IS_CLIENT, 97 connection_ = new PacketSavingConnection(&helper_, &alarm_factory_,
98 Perspective::IS_CLIENT,
98 SupportedVersions(GetParam())); 99 SupportedVersions(GetParam()));
99 session_.reset(new TestQuicClientSession( 100 session_.reset(new TestQuicClientSession(
100 DefaultQuicConfig(), connection_, 101 DefaultQuicConfig(), connection_,
101 QuicServerId(kServerHostname, kPort, PRIVACY_MODE_DISABLED), 102 QuicServerId(kServerHostname, kPort, PRIVACY_MODE_DISABLED),
102 &crypto_config_, &push_promise_index_)); 103 &crypto_config_, &push_promise_index_));
103 session_->Initialize(); 104 session_->Initialize();
104 push_promise_[":path"] = "/bar"; 105 push_promise_[":path"] = "/bar";
105 push_promise_[":authority"] = "www.google.com"; 106 push_promise_[":authority"] = "www.google.com";
106 push_promise_[":version"] = "HTTP/1.1"; 107 push_promise_[":version"] = "HTTP/1.1";
107 push_promise_[":method"] = "GET"; 108 push_promise_[":method"] = "GET";
108 push_promise_[":scheme"] = "https"; 109 push_promise_[":scheme"] = "https";
109 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); 110 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_);
110 } 111 }
111 112
112 void CompleteCryptoHandshake() { 113 void CompleteCryptoHandshake() {
113 session_->CryptoConnect(); 114 session_->CryptoConnect();
114 QuicCryptoClientStream* stream = 115 QuicCryptoClientStream* stream =
115 static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream()); 116 static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream());
116 CryptoTestUtils::FakeServerOptions options; 117 CryptoTestUtils::FakeServerOptions options;
117 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, stream, 118 CryptoTestUtils::HandshakeWithFakeServer(&helper_, &alarm_factory_,
118 options); 119 connection_, stream, options);
119 } 120 }
120 121
121 QuicCryptoClientConfig crypto_config_; 122 QuicCryptoClientConfig crypto_config_;
122 MockConnectionHelper helper_; 123 MockConnectionHelper helper_;
124 MockAlarmFactory alarm_factory_;
123 PacketSavingConnection* connection_; 125 PacketSavingConnection* connection_;
124 std::unique_ptr<TestQuicClientSession> session_; 126 std::unique_ptr<TestQuicClientSession> session_;
125 QuicClientPushPromiseIndex push_promise_index_; 127 QuicClientPushPromiseIndex push_promise_index_;
126 SpdyHeaderBlock push_promise_; 128 SpdyHeaderBlock push_promise_;
127 string promise_url_; 129 string promise_url_;
128 QuicStreamId promised_stream_id_; 130 QuicStreamId promised_stream_id_;
129 QuicStreamId associated_stream_id_; 131 QuicStreamId associated_stream_id_;
130 }; 132 };
131 133
132 INSTANTIATE_TEST_CASE_P(Tests, 134 INSTANTIATE_TEST_CASE_P(Tests,
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 QuicClientPromisedInfo* promised = 506 QuicClientPromisedInfo* promised =
505 session_->GetPromisedById(promised_stream_id_); 507 session_->GetPromisedById(promised_stream_id_);
506 EXPECT_NE(promised, nullptr); 508 EXPECT_NE(promised, nullptr);
507 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); 509 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr);
508 EXPECT_EQ(session_->GetPromisedStream(promised_stream_id_), nullptr); 510 EXPECT_EQ(session_->GetPromisedStream(promised_stream_id_), nullptr);
509 } 511 }
510 512
511 } // namespace 513 } // namespace
512 } // namespace test 514 } // namespace test
513 } // namespace net 515 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_base.cc ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698