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

Unified Diff: net/http/http_stream_factory_impl_request_unittest.cc

Issue 1952423002: JobController 2: Remove reference between HttpStreamFactoryImpl::Jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Job_Controller_1
Patch Set: fix a include typo Created 4 years, 5 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_request_unittest.cc
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc
index 45abea2f1bc98aaf1c364ea68644575626cfc4d5..e7065af902b8e8f43b0c9a49311799b8a01252f3 100644
--- a/net/http/http_stream_factory_impl_request_unittest.cc
+++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -54,78 +54,4 @@ TEST_F(HttpStreamFactoryImplRequestTest, SetPriority) {
request->SetPriority(IDLE);
EXPECT_EQ(IDLE, job_controller->main_job()->priority());
}
-
-TEST_F(HttpStreamFactoryImplRequestTest, DelayMainJob) {
- SpdySessionDependencies session_deps(ProxyService::CreateDirect());
-
- std::unique_ptr<HttpNetworkSession> session =
- SpdySessionDependencies::SpdyCreateSession(&session_deps);
-
- StaticSocketDataProvider socket_data;
- socket_data.set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING));
- session_deps.socket_factory->AddSocketDataProvider(&socket_data);
-
- HttpStreamFactoryImpl* factory =
- static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
- MockHttpStreamRequestDelegate request_delegate;
- HttpStreamFactoryImpl::JobFactory* job_factory =
- HttpStreamFactoryImplPeer::GetDefaultJobFactory(factory);
- HttpStreamFactoryImpl::JobController* job_controller =
- new HttpStreamFactoryImpl::JobController(factory, &request_delegate,
- session.get(), job_factory);
- factory->job_controller_set_.insert(base::WrapUnique(job_controller));
-
- HttpRequestInfo request_info;
- request_info.method = "GET";
- request_info.url = GURL("https://www.google.com");
-
- HttpStreamFactoryImpl::Request request(
- request_info.url, job_controller, &request_delegate, nullptr,
- BoundNetLog(), HttpStreamFactoryImpl::Request::HTTP_STREAM);
- job_controller->request_ = &request;
-
- HostPortPair server = HostPortPair::FromURL(request_info.url);
- GURL original_url =
- job_controller->ApplyHostMappingRules(request_info.url, &server);
-
- HttpStreamFactoryImpl::Job* job = new HttpStreamFactoryImpl::Job(
- job_controller, HttpStreamFactoryImpl::MAIN, session.get(), request_info,
- DEFAULT_PRIORITY, SSLConfig(), SSLConfig(), server, original_url,
- nullptr);
- job_controller->main_job_.reset(job);
- job_controller->AttachJob(job);
- EXPECT_EQ(DEFAULT_PRIORITY, job->priority());
-
- AlternativeService alternative_service(net::NPN_HTTP_2, server);
- HttpStreamFactoryImpl::Job* alternative_job = new HttpStreamFactoryImpl::Job(
- job_controller, HttpStreamFactoryImpl::ALTERNATIVE, session.get(),
- request_info, DEFAULT_PRIORITY, SSLConfig(), SSLConfig(), server,
- original_url, alternative_service, nullptr);
- job_controller->alternative_job_.reset(alternative_job);
- job_controller->AttachJob(alternative_job);
-
- job->WaitFor(alternative_job);
- EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_NONE, job->next_state_);
-
- // Test |alternative_job| resuming the |job| after delay.
- int wait_time = 1;
- base::TimeDelta delay = base::TimeDelta::FromMilliseconds(wait_time);
- job->Resume(alternative_job, delay);
-
- // Verify |job| has |wait_time_| and there is no |blocking_job_|
- EXPECT_EQ(delay, job->wait_time_);
- EXPECT_TRUE(!job->blocking_job_);
-
- // Start the |job| and verify |job|'s |wait_time_| is cleared.
- job->Start(request.stream_type());
-
- base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(wait_time + 1));
- base::RunLoop().RunUntilIdle();
-
- EXPECT_NE(delay, job->wait_time_);
- EXPECT_TRUE(job->wait_time_.is_zero());
- EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_INIT_CONNECTION_COMPLETE,
- job->next_state_);
-}
-
} // namespace net
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller_unittest.cc ('k') | net/http/http_stream_factory_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698