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

Side by Side Diff: net/tools/quic/quic_simple_server_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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_simple_server_stream.h" 5 #include "net/tools/quic/quic_simple_server_stream.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
11 #include "net/quic/quic_protocol.h" 11 #include "net/quic/quic_protocol.h"
12 #include "net/quic/quic_utils.h" 12 #include "net/quic/quic_utils.h"
13 #include "net/quic/spdy_utils.h" 13 #include "net/quic/spdy_utils.h"
14 #include "net/quic/test_tools/crypto_test_utils.h" 14 #include "net/quic/test_tools/crypto_test_utils.h"
15 #include "net/quic/test_tools/quic_test_utils.h" 15 #include "net/quic/test_tools/quic_test_utils.h"
16 #include "net/quic/test_tools/reliable_quic_stream_peer.h" 16 #include "net/quic/test_tools/reliable_quic_stream_peer.h"
17 #include "net/test/gtest_util.h" 17 #include "net/test/gtest_util.h"
18 #include "net/tools/epoll_server/epoll_server.h" 18 #include "net/tools/epoll_server/epoll_server.h"
19 #include "net/tools/quic/quic_in_memory_cache.h" 19 #include "net/tools/quic/quic_in_memory_cache.h"
20 #include "net/tools/quic/quic_simple_server_session.h" 20 #include "net/tools/quic/quic_simple_server_session.h"
21 #include "net/tools/quic/spdy_balsa_utils.h" 21 #include "net/tools/quic/spdy_balsa_utils.h"
22 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h" 22 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h"
23 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 using base::StringPiece; 27 using base::StringPiece;
28 using net::test::MockConnection; 28 using net::test::MockQuicConnection;
29 using net::test::MockConnectionHelper; 29 using net::test::MockQuicConnectionHelper;
30 using net::test::MockQuicSpdySession; 30 using net::test::MockQuicSpdySession;
31 using net::test::ReliableQuicStreamPeer; 31 using net::test::ReliableQuicStreamPeer;
32 using net::test::SupportedVersions; 32 using net::test::SupportedVersions;
33 using net::test::kInitialSessionFlowControlWindowForTest; 33 using net::test::kInitialSessionFlowControlWindowForTest;
34 using net::test::kInitialStreamFlowControlWindowForTest; 34 using net::test::kInitialStreamFlowControlWindowForTest;
35 using std::string; 35 using std::string;
36 using testing::_; 36 using testing::_;
37 using testing::AnyNumber; 37 using testing::AnyNumber;
38 using testing::Invoke; 38 using testing::Invoke;
39 using testing::InvokeArgument; 39 using testing::InvokeArgument;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 DISALLOW_COPY_AND_ASSIGN(MockQuicSimpleServerSession); 142 DISALLOW_COPY_AND_ASSIGN(MockQuicSimpleServerSession);
143 }; 143 };
144 144
145 namespace { 145 namespace {
146 146
147 class QuicSimpleServerStreamTest 147 class QuicSimpleServerStreamTest
148 : public ::testing::TestWithParam<QuicVersion> { 148 : public ::testing::TestWithParam<QuicVersion> {
149 public: 149 public:
150 QuicSimpleServerStreamTest() 150 QuicSimpleServerStreamTest()
151 : connection_( 151 : connection_(
152 new StrictMock<MockConnection>(&helper_, 152 new StrictMock<MockQuicConnection>(&helper_,
153 &alarm_factory_, 153 &alarm_factory_,
154 Perspective::IS_SERVER, 154 Perspective::IS_SERVER,
155 SupportedVersions(GetParam()))), 155 SupportedVersions(GetParam()))),
156 session_owner_(new StrictMock<MockQuicServerSessionVisitor>()), 156 session_owner_(new StrictMock<MockQuicServerSessionVisitor>()),
157 crypto_config_(new QuicCryptoServerConfig( 157 crypto_config_(new QuicCryptoServerConfig(
158 QuicCryptoServerConfig::TESTING, 158 QuicCryptoServerConfig::TESTING,
159 QuicRandom::GetInstance(), 159 QuicRandom::GetInstance(),
160 ::net::test::CryptoTestUtils::ProofSourceForTesting())), 160 ::net::test::CryptoTestUtils::ProofSourceForTesting())),
161 compressed_certs_cache_( 161 compressed_certs_cache_(
162 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), 162 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
163 session_(connection_, 163 session_(connection_,
164 session_owner_, 164 session_owner_,
165 crypto_config_.get(), 165 crypto_config_.get(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 const string& StreamBody() { 198 const string& StreamBody() {
199 return QuicSimpleServerStreamPeer::body(stream_); 199 return QuicSimpleServerStreamPeer::body(stream_);
200 } 200 }
201 201
202 StringPiece StreamHeadersValue(const string& key) { 202 StringPiece StreamHeadersValue(const string& key) {
203 return (*stream_->mutable_headers())[key]; 203 return (*stream_->mutable_headers())[key];
204 } 204 }
205 205
206 SpdyHeaderBlock response_headers_; 206 SpdyHeaderBlock response_headers_;
207 MockConnectionHelper helper_; 207 MockQuicConnectionHelper helper_;
208 MockAlarmFactory alarm_factory_; 208 MockAlarmFactory alarm_factory_;
209 StrictMock<MockConnection>* connection_; 209 StrictMock<MockQuicConnection>* connection_;
210 StrictMock<MockQuicServerSessionVisitor>* session_owner_; 210 StrictMock<MockQuicServerSessionVisitor>* session_owner_;
211 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; 211 std::unique_ptr<QuicCryptoServerConfig> crypto_config_;
212 QuicCompressedCertsCache compressed_certs_cache_; 212 QuicCompressedCertsCache compressed_certs_cache_;
213 StrictMock<MockQuicSimpleServerSession> session_; 213 StrictMock<MockQuicSimpleServerSession> session_;
214 QuicSimpleServerStreamPeer* stream_; // Owned by session_. 214 QuicSimpleServerStreamPeer* stream_; // Owned by session_.
215 string headers_string_; 215 string headers_string_;
216 string body_; 216 string body_;
217 }; 217 };
218 218
219 INSTANTIATE_TEST_CASE_P(Tests, 219 INSTANTIATE_TEST_CASE_P(Tests,
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 }; 638 };
639 StringPiece data(arr, arraysize(arr)); 639 StringPiece data(arr, arraysize(arr));
640 QuicStreamFrame frame(stream_->id(), true, 0, data); 640 QuicStreamFrame frame(stream_->id(), true, 0, data);
641 // Verify that we don't crash when we get a invalid headers in stream frame. 641 // Verify that we don't crash when we get a invalid headers in stream frame.
642 stream_->OnStreamFrame(frame); 642 stream_->OnStreamFrame(frame);
643 } 643 }
644 644
645 } // namespace 645 } // namespace
646 } // namespace test 646 } // namespace test
647 } // namespace net 647 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_session_test.cc ('k') | net/tools/quic/quic_simple_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698