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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/quic_http_utils_test.cc ('k') | net/quic/quic_packet_creator.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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "net/base/network_quality_estimator.h" 13 #include "net/base/network_quality_estimator.h"
14 #include "net/base/socket_performance_watcher.h" 14 #include "net/base/socket_performance_watcher.h"
15 #include "net/base/test_completion_callback.h" 15 #include "net/base/test_completion_callback.h"
16 #include "net/base/test_data_directory.h" 16 #include "net/base/test_data_directory.h"
17 #include "net/cert/mock_cert_verifier.h" 17 #include "net/cert/mock_cert_verifier.h"
18 #include "net/cert/multi_log_ct_verifier.h" 18 #include "net/cert/multi_log_ct_verifier.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 ASSERT_TRUE(response != nullptr); 344 ASSERT_TRUE(response != nullptr);
345 ASSERT_TRUE(response->headers.get() != nullptr); 345 ASSERT_TRUE(response->headers.get() != nullptr);
346 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 346 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
347 EXPECT_TRUE(response->was_fetched_via_spdy); 347 EXPECT_TRUE(response->was_fetched_via_spdy);
348 EXPECT_TRUE(response->was_npn_negotiated); 348 EXPECT_TRUE(response->was_npn_negotiated);
349 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, 349 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3,
350 response->connection_info); 350 response->connection_info);
351 } 351 }
352 352
353 void CheckResponsePort(const scoped_ptr<HttpNetworkTransaction>& trans, 353 void CheckResponsePort(const scoped_ptr<HttpNetworkTransaction>& trans,
354 uint16 port) { 354 uint16_t port) {
355 const HttpResponseInfo* response = trans->GetResponseInfo(); 355 const HttpResponseInfo* response = trans->GetResponseInfo();
356 ASSERT_TRUE(response != nullptr); 356 ASSERT_TRUE(response != nullptr);
357 EXPECT_EQ(port, response->socket_address.port()); 357 EXPECT_EQ(port, response->socket_address.port());
358 } 358 }
359 359
360 void CheckWasHttpResponse(const scoped_ptr<HttpNetworkTransaction>& trans) { 360 void CheckWasHttpResponse(const scoped_ptr<HttpNetworkTransaction>& trans) {
361 const HttpResponseInfo* response = trans->GetResponseInfo(); 361 const HttpResponseInfo* response = trans->GetResponseInfo();
362 ASSERT_TRUE(response != nullptr); 362 ASSERT_TRUE(response != nullptr);
363 ASSERT_TRUE(response->headers.get() != nullptr); 363 ASSERT_TRUE(response->headers.get() != nullptr);
364 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 364 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
(...skipping 23 matching lines...) Expand all
388 RunTransaction(trans); 388 RunTransaction(trans);
389 CheckWasHttpResponse(trans); 389 CheckWasHttpResponse(trans);
390 CheckResponseData(trans, expected); 390 CheckResponseData(trans, expected);
391 } 391 }
392 392
393 void SendRequestAndExpectQuicResponse(const std::string& expected) { 393 void SendRequestAndExpectQuicResponse(const std::string& expected) {
394 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443); 394 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443);
395 } 395 }
396 396
397 void SendRequestAndExpectQuicResponseOnPort(const std::string& expected, 397 void SendRequestAndExpectQuicResponseOnPort(const std::string& expected,
398 uint16 port) { 398 uint16_t port) {
399 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, port); 399 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, port);
400 } 400 }
401 401
402 void SendRequestAndExpectQuicResponseFromProxyOnPort( 402 void SendRequestAndExpectQuicResponseFromProxyOnPort(
403 const std::string& expected, 403 const std::string& expected,
404 uint16 port) { 404 uint16_t port) {
405 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port); 405 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port);
406 } 406 }
407 407
408 void AddQuicAlternateProtocolMapping( 408 void AddQuicAlternateProtocolMapping(
409 MockCryptoClientStream::HandshakeMode handshake_mode) { 409 MockCryptoClientStream::HandshakeMode handshake_mode) {
410 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); 410 crypto_client_stream_factory_.set_handshake_mode(handshake_mode);
411 HostPortPair host_port_pair = HostPortPair::FromURL(request_.url); 411 HostPortPair host_port_pair = HostPortPair::FromURL(request_.url);
412 AlternativeService alternative_service(QUIC, host_port_pair.host(), 443); 412 AlternativeService alternative_service(QUIC, host_port_pair.host(), 443);
413 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 413 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
414 http_server_properties_.SetAlternativeService( 414 http_server_properties_.SetAlternativeService(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 HttpNetworkSession::Params params_; 459 HttpNetworkSession::Params params_;
460 HttpRequestInfo request_; 460 HttpRequestInfo request_;
461 BoundTestNetLog net_log_; 461 BoundTestNetLog net_log_;
462 StaticSocketDataProvider hanging_data_; 462 StaticSocketDataProvider hanging_data_;
463 SSLSocketDataProvider ssl_data_; 463 SSLSocketDataProvider ssl_data_;
464 464
465 private: 465 private:
466 void SendRequestAndExpectQuicResponseMaybeFromProxy( 466 void SendRequestAndExpectQuicResponseMaybeFromProxy(
467 const std::string& expected, 467 const std::string& expected,
468 bool used_proxy, 468 bool used_proxy,
469 uint16 port) { 469 uint16_t port) {
470 scoped_ptr<HttpNetworkTransaction> trans( 470 scoped_ptr<HttpNetworkTransaction> trans(
471 new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get())); 471 new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get()));
472 ProxyHeadersHandler proxy_headers_handler; 472 ProxyHeadersHandler proxy_headers_handler;
473 trans->SetBeforeProxyHeadersSentCallback( 473 trans->SetBeforeProxyHeadersSentCallback(
474 base::Bind(&ProxyHeadersHandler::OnBeforeProxyHeadersSent, 474 base::Bind(&ProxyHeadersHandler::OnBeforeProxyHeadersSent,
475 base::Unretained(&proxy_headers_handler))); 475 base::Unretained(&proxy_headers_handler)));
476 RunTransaction(trans); 476 RunTransaction(trans);
477 CheckWasQuicResponse(trans); 477 CheckWasQuicResponse(trans);
478 CheckResponsePort(trans, port); 478 CheckResponsePort(trans, port);
479 CheckResponseData(trans, expected); 479 CheckResponseData(trans, expected);
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 request_.url = GURL("https://www.example.org:443"); 1839 request_.url = GURL("https://www.example.org:443");
1840 AddHangingNonAlternateProtocolSocketData(); 1840 AddHangingNonAlternateProtocolSocketData();
1841 CreateSessionWithNextProtos(); 1841 CreateSessionWithNextProtos();
1842 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); 1842 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
1843 SendRequestAndExpectQuicResponse("hello!"); 1843 SendRequestAndExpectQuicResponse("hello!");
1844 EXPECT_TRUE(rtt_observer_.rtt_notification_received()); 1844 EXPECT_TRUE(rtt_observer_.rtt_notification_received());
1845 } 1845 }
1846 1846
1847 } // namespace test 1847 } // namespace test
1848 } // namespace net 1848 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_utils_test.cc ('k') | net/quic/quic_packet_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698