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

Side by Side Diff: net/http/http_stream_factory_impl_request_unittest.cc

Issue 2140673002: Remove SPDY/3.1 tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/http/http_stream_factory_impl_request.h" 5 #include "net/http/http_stream_factory_impl_request.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "net/http/http_stream_factory_impl.h" 10 #include "net/http/http_stream_factory_impl.h"
11 #include "net/http/http_stream_factory_impl_job.h" 11 #include "net/http/http_stream_factory_impl_job.h"
12 #include "net/http/http_stream_factory_impl_job_controller.h" 12 #include "net/http/http_stream_factory_impl_job_controller.h"
13 #include "net/http/http_stream_factory_test_util.h" 13 #include "net/http/http_stream_factory_test_util.h"
14 #include "net/proxy/proxy_info.h" 14 #include "net/proxy/proxy_info.h"
15 #include "net/proxy/proxy_service.h" 15 #include "net/proxy/proxy_service.h"
16 #include "net/spdy/spdy_test_util_common.h" 16 #include "net/spdy/spdy_test_util_common.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using testing::_; 19 using testing::_;
20 20
21 namespace net { 21 namespace net {
22 22
23 class HttpStreamFactoryImplRequestTest 23 class HttpStreamFactoryImplRequestTest : public ::testing::Test {};
24 : public ::testing::Test,
25 public ::testing::WithParamInterface<NextProto> {};
26
27 INSTANTIATE_TEST_CASE_P(NextProto,
28 HttpStreamFactoryImplRequestTest,
29 testing::Values(kProtoSPDY31,
30 kProtoHTTP2));
31 24
32 // Make sure that Request passes on its priority updates to its jobs. 25 // Make sure that Request passes on its priority updates to its jobs.
33 TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) { 26 TEST_F(HttpStreamFactoryImplRequestTest, SetPriority) {
34 SpdySessionDependencies session_deps(GetParam(), 27 SpdySessionDependencies session_deps(ProxyService::CreateDirect());
35 ProxyService::CreateDirect());
36 std::unique_ptr<HttpNetworkSession> session = 28 std::unique_ptr<HttpNetworkSession> session =
37 SpdySessionDependencies::SpdyCreateSession(&session_deps); 29 SpdySessionDependencies::SpdyCreateSession(&session_deps);
38 HttpStreamFactoryImpl* factory = 30 HttpStreamFactoryImpl* factory =
39 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); 31 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
40 MockHttpStreamRequestDelegate request_delegate; 32 MockHttpStreamRequestDelegate request_delegate;
41 TestJobFactory job_factory; 33 TestJobFactory job_factory;
42 HttpStreamFactoryImpl::JobController* job_controller = 34 HttpStreamFactoryImpl::JobController* job_controller =
43 new HttpStreamFactoryImpl::JobController(factory, &request_delegate, 35 new HttpStreamFactoryImpl::JobController(factory, &request_delegate,
44 session.get(), &job_factory); 36 session.get(), &job_factory);
45 factory->job_controller_set_.insert(base::WrapUnique(job_controller)); 37 factory->job_controller_set_.insert(base::WrapUnique(job_controller));
(...skipping 10 matching lines...) Expand all
56 EXPECT_EQ(MEDIUM, job_controller->main_job()->priority()); 48 EXPECT_EQ(MEDIUM, job_controller->main_job()->priority());
57 49
58 EXPECT_CALL(request_delegate, OnStreamFailed(_, _)).Times(1); 50 EXPECT_CALL(request_delegate, OnStreamFailed(_, _)).Times(1);
59 job_controller->OnStreamFailed(job_factory.main_job(), ERR_FAILED, 51 job_controller->OnStreamFailed(job_factory.main_job(), ERR_FAILED,
60 SSLConfig()); 52 SSLConfig());
61 53
62 request->SetPriority(IDLE); 54 request->SetPriority(IDLE);
63 EXPECT_EQ(IDLE, job_controller->main_job()->priority()); 55 EXPECT_EQ(IDLE, job_controller->main_job()->priority());
64 } 56 }
65 57
66 TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) { 58 TEST_F(HttpStreamFactoryImplRequestTest, DelayMainJob) {
67 SpdySessionDependencies session_deps(GetParam(), 59 SpdySessionDependencies session_deps(ProxyService::CreateDirect());
68 ProxyService::CreateDirect());
69 60
70 std::unique_ptr<HttpNetworkSession> session = 61 std::unique_ptr<HttpNetworkSession> session =
71 SpdySessionDependencies::SpdyCreateSession(&session_deps); 62 SpdySessionDependencies::SpdyCreateSession(&session_deps);
72 63
73 StaticSocketDataProvider socket_data; 64 StaticSocketDataProvider socket_data;
74 socket_data.set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING)); 65 socket_data.set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING));
75 session_deps.socket_factory->AddSocketDataProvider(&socket_data); 66 session_deps.socket_factory->AddSocketDataProvider(&socket_data);
76 67
77 HttpStreamFactoryImpl* factory = 68 HttpStreamFactoryImpl* factory =
78 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); 69 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(wait_time + 1)); 122 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(wait_time + 1));
132 base::RunLoop().RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
133 124
134 EXPECT_NE(delay, job->wait_time_); 125 EXPECT_NE(delay, job->wait_time_);
135 EXPECT_TRUE(job->wait_time_.is_zero()); 126 EXPECT_TRUE(job->wait_time_.is_zero());
136 EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_INIT_CONNECTION_COMPLETE, 127 EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_INIT_CONNECTION_COMPLETE,
137 job->next_state_); 128 job->next_state_);
138 } 129 }
139 130
140 } // namespace net 131 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller_unittest.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698