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

Unified Diff: net/http/http_stream_factory_impl_job_controller_unittest.cc

Issue 2621983004: Improve HttpStreamFactory NetLog events (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_factory_impl_job_controller_unittest.cc
diff --git a/net/http/http_stream_factory_impl_job_controller_unittest.cc b/net/http/http_stream_factory_impl_job_controller_unittest.cc
index 4502399072ec21881d9a3794478a60b1ec3c6a53..4b9e2c9b6b6870ce50fe970f285519a92bb5bd72 100644
--- a/net/http/http_stream_factory_impl_job_controller_unittest.cc
+++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -137,7 +137,8 @@ class HttpStreamFactoryImplJobControllerTest
factory_ =
static_cast<HttpStreamFactoryImpl*>(session_->http_stream_factory());
job_controller_ = new HttpStreamFactoryImpl::JobController(
- factory_, &request_delegate_, session_.get(), &job_factory_);
+ factory_, &request_delegate_, session_.get(), &job_factory_,
+ /*is_preconnect=*/false, net_log_);
HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller_);
}
@@ -176,6 +177,7 @@ class HttpStreamFactoryImplJobControllerTest
HttpStreamFactoryImpl* factory_;
HttpStreamFactoryImpl::JobController* job_controller_;
std::unique_ptr<HttpStreamFactoryImpl::Request> request_;
+ const NetLogWithSource net_log_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImplJobControllerTest);
};
@@ -196,10 +198,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
request_info.method = "GET";
request_info.url = GURL("http://www.google.com");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
@@ -226,10 +227,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
request_info.method = "GET";
request_info.url = GURL("http://www.google.com");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
// There's no other alternative job. Thus when a stream is ready, it should
// notify Request.
@@ -263,10 +263,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, CancelJobsBeforeBinding) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -297,10 +296,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, OnStreamFailedForBothJobs) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -341,10 +339,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -391,10 +388,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
url::SchemeHostPort server(request_info.url);
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(JobControllerPeer::main_job_is_blocked(job_controller_));
@@ -442,10 +438,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
// Hack to use different URL for the main job to help differentiate the proxy
// requests.
job_factory_.UseDifferentURLForMainJob(GURL("http://www.google.com"));
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(JobControllerPeer::main_job_is_blocked(job_controller_));
@@ -507,10 +502,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -551,10 +545,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -597,10 +590,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, GetLoadStateAfterMainJobFailed) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -645,10 +637,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, DoNotResumeMainJobBeforeWait) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -670,10 +661,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, InvalidPortForQuic) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 101);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_factory_.main_job()->is_waiting());
@@ -715,10 +705,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
// requests.
job_factory_.UseDifferentURLForMainJob(GURL("http://www.google.com"));
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
// Both jobs should be created but stalled as proxy resolution not completed.
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -777,10 +766,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
// requests.
job_factory_.UseDifferentURLForMainJob(GURL("http://www.google.com"));
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -836,10 +824,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, DelayedTCP) {
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -868,10 +855,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, HttpsURL) {
request_info.method = "GET";
request_info.url = GURL("https://mail.example.org/");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->main_job()->is_waiting());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -895,10 +881,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, HttpURLWithNoProxy) {
request_info.method = "GET";
request_info.url = GURL("http://mail.example.org/");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->main_job()->is_waiting());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -932,10 +917,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, DelayedTCPAlternativeProxy) {
request_info.method = "GET";
request_info.url = GURL("http://mail.example.org/");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -993,10 +977,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest, FailAlternativeProxy) {
request_info.method = "GET";
request_info.url = GURL("http://mail.example.org/");
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -1030,10 +1013,9 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
url::SchemeHostPort server(request_info.url);
- request_.reset(
- job_controller_->Start(request_info, &request_delegate_, nullptr,
- NetLogWithSource(), HttpStreamRequest::HTTP_STREAM,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
+ request_.reset(job_controller_->Start(
+ request_info, &request_delegate_, nullptr, HttpStreamRequest::HTTP_STREAM,
+ DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());

Powered by Google App Engine
This is Rietveld 408576698