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

Unified Diff: net/http/http_stream_factory_impl_job_controller_unittest.cc

Issue 2894723002: Revert of Return Request as unique_ptr from JobController::Start(). (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4110789ee730737d1cd717fac9b4ec2f71ee4b12..6024ac0c087968780dcd4155ba1bafe70883ed0e 100644
--- a/net/http/http_stream_factory_impl_job_controller_unittest.cc
+++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -5,8 +5,6 @@
#include "net/http/http_stream_factory_impl_job_controller.h"
#include <memory>
-#include <string>
-#include <utility>
#include <vector>
#include "base/memory/ptr_util.h"
@@ -309,9 +307,9 @@
EXPECT_CALL(request_delegate_,
OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _))
.Times(1);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_FALSE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -337,9 +335,9 @@
Initialize(request_info);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_FALSE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -366,9 +364,9 @@
EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_NO_SUPPORTED_PROXIES, _))
.Times(1);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_FALSE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -401,9 +399,9 @@
request_info, is_preconnect_, enable_ip_based_pooling_,
enable_alternative_services_, SSLConfig(), SSLConfig());
HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller);
- return job_controller->Start(
+ return base::WrapUnique(job_controller->Start(
&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
}
private:
@@ -540,9 +538,9 @@
Initialize(request_info);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -564,9 +562,9 @@
Initialize(request_info);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
// There's no other alternative job. Thus when a stream is ready, it should
// notify Request.
@@ -597,9 +595,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -626,9 +624,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -662,9 +660,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -703,9 +701,9 @@
url::SchemeHostPort server(request_info.url);
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(JobControllerPeer::main_job_is_blocked(job_controller_));
@@ -752,9 +750,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
// main job should not be blocked because alt job returned ERR_IO_PENDING.
@@ -808,9 +806,9 @@
// |main_job| fails but should not report status to Request.
EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -853,9 +851,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -897,9 +895,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -939,9 +937,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -987,9 +985,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -1013,9 +1011,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 101);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_factory_.main_job()->is_waiting());
@@ -1049,9 +1047,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
@@ -1116,9 +1114,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
@@ -1175,9 +1173,9 @@
// The alternative job stalls as host resolution hangs when creating the QUIC
// request and controller should resume the main job with delay.
// OnStreamFailed should resume the main job immediately.
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
@@ -1220,9 +1218,9 @@
Initialize(request_info);
EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic());
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->main_job()->is_waiting());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -1246,9 +1244,9 @@
Initialize(request_info);
EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic());
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_FALSE(job_controller_->main_job()->is_waiting());
EXPECT_FALSE(job_controller_->alternative_job());
@@ -1288,9 +1286,9 @@
session_->http_server_properties()->SetServerNetworkStats(
url::SchemeHostPort(GURL("https://myproxy.org")), stats1);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->main_job()->is_waiting());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -1344,9 +1342,9 @@
session_->http_server_properties()->SetServerNetworkStats(
url::SchemeHostPort(GURL("https://myproxy.org")), stats1);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -1388,9 +1386,9 @@
url::SchemeHostPort server(request_info.url);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
EXPECT_TRUE(job_controller_->alternative_job());
@@ -1488,9 +1486,9 @@
AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
SetAlternativeService(request_info, alternative_service);
- request_ =
- job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
- HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY);
+ request_.reset(
+ job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
+ HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
EXPECT_TRUE(job_controller_->main_job());
if (enable_alternative_services) {
EXPECT_TRUE(job_controller_->alternative_job());
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698