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

Unified Diff: net/http/http_stream_factory_impl_job_controller_unittest.cc

Issue 2621983004: Improve HttpStreamFactory NetLog events (Closed)
Patch Set: Get rid of long-running Source 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 b21d15d935905417bf63876f5094f15cd88ff71e..9db7c39c1089dc298e1a42560c30bddcb0805368 100644
--- a/net/http/http_stream_factory_impl_job_controller_unittest.cc
+++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -142,7 +142,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_);
}
@@ -181,6 +182,7 @@ class HttpStreamFactoryImplJobControllerTest
HttpStreamFactoryImpl* factory_;
HttpStreamFactoryImpl::JobController* job_controller_;
std::unique_ptr<HttpStreamFactoryImpl::Request> request_;
+ const NetLogWithSource net_log_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImplJobControllerTest);
};
@@ -201,10 +203,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());
@@ -231,10 +232,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.
@@ -268,10 +268,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());
@@ -302,10 +301,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());
@@ -346,10 +344,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());
@@ -397,10 +394,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_));
@@ -447,10 +443,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_));
@@ -512,10 +507,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());
@@ -556,10 +550,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());
@@ -602,10 +595,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());
@@ -650,10 +642,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());
@@ -675,10 +666,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());
@@ -720,10 +710,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());
@@ -782,10 +771,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());
@@ -841,10 +829,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());
@@ -873,10 +860,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());
@@ -900,10 +886,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());
@@ -937,10 +922,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());
@@ -998,10 +982,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());
@@ -1035,10 +1018,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