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

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

Issue 1979763002: Landing Recent QUIC changes until Sun May 8 00:39:29 2016 +0000 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/quic/congestion_control/cubic_test.cc ('k') | net/quic/quic_client_promised_info_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/quic/quic_chromium_client_stream.h" 5 #include "net/quic/quic_chromium_client_stream.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 137 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
138 } 138 }
139 139
140 MockQuicClientSessionBase::~MockQuicClientSessionBase() {} 140 MockQuicClientSessionBase::~MockQuicClientSessionBase() {}
141 141
142 class QuicChromiumClientStreamTest 142 class QuicChromiumClientStreamTest
143 : public ::testing::TestWithParam<QuicVersion> { 143 : public ::testing::TestWithParam<QuicVersion> {
144 public: 144 public:
145 QuicChromiumClientStreamTest() 145 QuicChromiumClientStreamTest()
146 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()), 146 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
147 session_(new MockConnection(&helper_, 147 session_(new MockQuicConnection(&helper_,
148 &alarm_factory_, 148 &alarm_factory_,
149 Perspective::IS_CLIENT, 149 Perspective::IS_CLIENT,
150 SupportedVersions(GetParam())), 150 SupportedVersions(GetParam())),
151 &push_promise_index_) { 151 &push_promise_index_) {
152 stream_ = 152 stream_ =
153 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog()); 153 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog());
154 session_.ActivateStream(stream_); 154 session_.ActivateStream(stream_);
155 stream_->SetDelegate(&delegate_); 155 stream_->SetDelegate(&delegate_);
156 } 156 }
157 157
158 void InitializeHeaders() { 158 void InitializeHeaders() {
159 headers_[":host"] = "www.google.com"; 159 headers_[":host"] = "www.google.com";
160 headers_[":path"] = "/index.hml"; 160 headers_[":path"] = "/index.hml";
(...skipping 27 matching lines...) Expand all
188 void ReadData(StringPiece expected_data) { 188 void ReadData(StringPiece expected_data) {
189 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); 189 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1));
190 EXPECT_EQ(static_cast<int>(expected_data.length()), 190 EXPECT_EQ(static_cast<int>(expected_data.length()),
191 stream_->Read(buffer.get(), expected_data.length() + 1)); 191 stream_->Read(buffer.get(), expected_data.length() + 1));
192 EXPECT_EQ(expected_data, 192 EXPECT_EQ(expected_data,
193 StringPiece(buffer->data(), expected_data.length())); 193 StringPiece(buffer->data(), expected_data.length()));
194 } 194 }
195 195
196 QuicCryptoClientConfig crypto_config_; 196 QuicCryptoClientConfig crypto_config_;
197 testing::StrictMock<MockDelegate> delegate_; 197 testing::StrictMock<MockDelegate> delegate_;
198 MockConnectionHelper helper_; 198 MockQuicConnectionHelper helper_;
199 MockAlarmFactory alarm_factory_; 199 MockAlarmFactory alarm_factory_;
200 MockQuicClientSessionBase session_; 200 MockQuicClientSessionBase session_;
201 QuicChromiumClientStream* stream_; 201 QuicChromiumClientStream* stream_;
202 SpdyHeaderBlock headers_; 202 SpdyHeaderBlock headers_;
203 QuicClientPushPromiseIndex push_promise_index_; 203 QuicClientPushPromiseIndex push_promise_index_;
204 }; 204 };
205 205
206 INSTANTIATE_TEST_CASE_P(Version, 206 INSTANTIATE_TEST_CASE_P(Version,
207 QuicChromiumClientStreamTest, 207 QuicChromiumClientStreamTest,
208 ::testing::ValuesIn(QuicSupportedVersions())); 208 ::testing::ValuesIn(QuicSupportedVersions()));
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 stream->SetDelegate(&delegate_); 530 stream->SetDelegate(&delegate_);
531 base::MessageLoop::current()->RunUntilIdle(); 531 base::MessageLoop::current()->RunUntilIdle();
532 532
533 // Times(2) because OnClose will be called for stream and stream_. 533 // Times(2) because OnClose will be called for stream and stream_.
534 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); 534 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2);
535 } 535 }
536 536
537 } // namespace 537 } // namespace
538 } // namespace test 538 } // namespace test
539 } // namespace net 539 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/cubic_test.cc ('k') | net/quic/quic_client_promised_info_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698