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

Side by Side Diff: net/quic/chromium/quic_network_transaction_unittest.cc

Issue 2347163002: s/NPN/ALPN/ (Closed)
Patch Set: Re: #12. Created 4 years, 3 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/chromium/quic_http_stream.cc ('k') | net/socket/ssl_client_socket_pool.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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 ASSERT_EQ(params_.quic_socket_receive_buffer_size, 481 ASSERT_EQ(params_.quic_socket_receive_buffer_size,
482 session_->quic_stream_factory()->socket_receive_buffer_size()); 482 session_->quic_stream_factory()->socket_receive_buffer_size());
483 } 483 }
484 484
485 void CheckWasQuicResponse(HttpNetworkTransaction* trans) { 485 void CheckWasQuicResponse(HttpNetworkTransaction* trans) {
486 const HttpResponseInfo* response = trans->GetResponseInfo(); 486 const HttpResponseInfo* response = trans->GetResponseInfo();
487 ASSERT_TRUE(response != nullptr); 487 ASSERT_TRUE(response != nullptr);
488 ASSERT_TRUE(response->headers.get() != nullptr); 488 ASSERT_TRUE(response->headers.get() != nullptr);
489 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 489 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
490 EXPECT_TRUE(response->was_fetched_via_spdy); 490 EXPECT_TRUE(response->was_fetched_via_spdy);
491 EXPECT_TRUE(response->was_npn_negotiated); 491 EXPECT_TRUE(response->was_alpn_negotiated);
492 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, 492 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3,
493 response->connection_info); 493 response->connection_info);
494 } 494 }
495 495
496 void CheckResponsePort(HttpNetworkTransaction* trans, uint16_t port) { 496 void CheckResponsePort(HttpNetworkTransaction* trans, uint16_t port) {
497 const HttpResponseInfo* response = trans->GetResponseInfo(); 497 const HttpResponseInfo* response = trans->GetResponseInfo();
498 ASSERT_TRUE(response != nullptr); 498 ASSERT_TRUE(response != nullptr);
499 EXPECT_EQ(port, response->socket_address.port()); 499 EXPECT_EQ(port, response->socket_address.port());
500 } 500 }
501 501
502 void CheckWasHttpResponse(HttpNetworkTransaction* trans) { 502 void CheckWasHttpResponse(HttpNetworkTransaction* trans) {
503 const HttpResponseInfo* response = trans->GetResponseInfo(); 503 const HttpResponseInfo* response = trans->GetResponseInfo();
504 ASSERT_TRUE(response != nullptr); 504 ASSERT_TRUE(response != nullptr);
505 ASSERT_TRUE(response->headers.get() != nullptr); 505 ASSERT_TRUE(response->headers.get() != nullptr);
506 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 506 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
507 EXPECT_FALSE(response->was_fetched_via_spdy); 507 EXPECT_FALSE(response->was_fetched_via_spdy);
508 EXPECT_FALSE(response->was_npn_negotiated); 508 EXPECT_FALSE(response->was_alpn_negotiated);
509 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 509 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1,
510 response->connection_info); 510 response->connection_info);
511 } 511 }
512 512
513 void CheckResponseData(HttpNetworkTransaction* trans, 513 void CheckResponseData(HttpNetworkTransaction* trans,
514 const std::string& expected) { 514 const std::string& expected) {
515 std::string response_data; 515 std::string response_data;
516 ASSERT_THAT(ReadTransaction(trans, &response_data), IsOk()); 516 ASSERT_THAT(ReadTransaction(trans, &response_data), IsOk());
517 EXPECT_EQ(expected, response_data); 517 EXPECT_EQ(expected, response_data);
518 } 518 }
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent( 2011 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent(
2012 QuicSession::HANDSHAKE_CONFIRMED); 2012 QuicSession::HANDSHAKE_CONFIRMED);
2013 // Read the headers. 2013 // Read the headers.
2014 EXPECT_THAT(callback.WaitForResult(), IsOk()); 2014 EXPECT_THAT(callback.WaitForResult(), IsOk());
2015 2015
2016 const HttpResponseInfo* response = trans.GetResponseInfo(); 2016 const HttpResponseInfo* response = trans.GetResponseInfo();
2017 ASSERT_TRUE(response != nullptr); 2017 ASSERT_TRUE(response != nullptr);
2018 ASSERT_TRUE(response->headers.get() != nullptr); 2018 ASSERT_TRUE(response->headers.get() != nullptr);
2019 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 2019 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
2020 EXPECT_TRUE(response->was_fetched_via_spdy); 2020 EXPECT_TRUE(response->was_fetched_via_spdy);
2021 EXPECT_TRUE(response->was_npn_negotiated); 2021 EXPECT_TRUE(response->was_alpn_negotiated);
2022 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, 2022 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3,
2023 response->connection_info); 2023 response->connection_info);
2024 2024
2025 std::string response_data; 2025 std::string response_data;
2026 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, ReadTransaction(&trans, &response_data)); 2026 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, ReadTransaction(&trans, &response_data));
2027 } 2027 }
2028 2028
2029 TEST_P(QuicNetworkTransactionTest, RstSteamBeforeHeaders) { 2029 TEST_P(QuicNetworkTransactionTest, RstSteamBeforeHeaders) {
2030 MockQuicData mock_quic_data; 2030 MockQuicData mock_quic_data;
2031 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( 2031 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket(
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 2956
2957 std::string response_data; 2957 std::string response_data;
2958 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk()); 2958 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk());
2959 EXPECT_EQ("hello", response_data); 2959 EXPECT_EQ("hello", response_data);
2960 2960
2961 const HttpResponseInfo* response = trans.GetResponseInfo(); 2961 const HttpResponseInfo* response = trans.GetResponseInfo();
2962 ASSERT_TRUE(response != nullptr); 2962 ASSERT_TRUE(response != nullptr);
2963 ASSERT_TRUE(response->headers.get() != nullptr); 2963 ASSERT_TRUE(response->headers.get() != nullptr);
2964 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 2964 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
2965 EXPECT_TRUE(response->was_fetched_via_spdy); 2965 EXPECT_TRUE(response->was_fetched_via_spdy);
2966 EXPECT_TRUE(response->was_npn_negotiated); 2966 EXPECT_TRUE(response->was_alpn_negotiated);
2967 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, 2967 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3,
2968 response->connection_info); 2968 response->connection_info);
2969 EXPECT_EQ(443, response->socket_address.port()); 2969 EXPECT_EQ(443, response->socket_address.port());
2970 } 2970 }
2971 2971
2972 MockClock* clock_; 2972 MockClock* clock_;
2973 QuicVersion version_; 2973 QuicVersion version_;
2974 DestinationType destination_type_; 2974 DestinationType destination_type_;
2975 std::string origin1_; 2975 std::string origin1_;
2976 std::string origin2_; 2976 std::string origin2_;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 AddHangingSocketData(); 3185 AddHangingSocketData();
3186 3186
3187 SendRequestAndExpectQuicResponse(origin1_); 3187 SendRequestAndExpectQuicResponse(origin1_);
3188 SendRequestAndExpectQuicResponse(origin2_); 3188 SendRequestAndExpectQuicResponse(origin2_);
3189 3189
3190 EXPECT_TRUE(AllDataConsumed()); 3190 EXPECT_TRUE(AllDataConsumed());
3191 } 3191 }
3192 3192
3193 } // namespace test 3193 } // namespace test
3194 } // namespace net 3194 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_http_stream.cc ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698