OLD | NEW |
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 "net/http/http_stream_factory_impl_job.h" | 7 #include "net/http/http_stream_factory_impl_job.h" |
8 #include "net/proxy/proxy_info.h" | 8 #include "net/proxy/proxy_info.h" |
9 #include "net/proxy/proxy_service.h" | 9 #include "net/proxy/proxy_service.h" |
10 #include "net/spdy/spdy_test_util_common.h" | 10 #include "net/spdy/spdy_test_util_common.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 HttpStream* stream) override {} | 56 HttpStream* stream) override {} |
57 }; | 57 }; |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 // Make sure that Request passes on its priority updates to its jobs. | 61 // Make sure that Request passes on its priority updates to its jobs. |
62 TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) { | 62 TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) { |
63 SpdySessionDependencies session_deps(GetParam(), | 63 SpdySessionDependencies session_deps(GetParam(), |
64 ProxyService::CreateDirect()); | 64 ProxyService::CreateDirect()); |
65 | 65 |
66 scoped_ptr<HttpNetworkSession> session = | 66 scoped_refptr<HttpNetworkSession> |
67 SpdySessionDependencies::SpdyCreateSession(&session_deps); | 67 session(SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
68 HttpStreamFactoryImpl* factory = | 68 HttpStreamFactoryImpl* factory = |
69 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); | 69 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory()); |
70 | 70 |
71 DoNothingRequestDelegate request_delegate; | 71 DoNothingRequestDelegate request_delegate; |
72 HttpStreamFactoryImpl::Request request( | 72 HttpStreamFactoryImpl::Request request( |
73 GURL(), factory, &request_delegate, NULL, BoundNetLog()); | 73 GURL(), factory, &request_delegate, NULL, BoundNetLog()); |
74 | 74 |
75 HttpStreamFactoryImpl::Job* job = | 75 HttpStreamFactoryImpl::Job* job = |
76 new HttpStreamFactoryImpl::Job(factory, | 76 new HttpStreamFactoryImpl::Job(factory, |
77 session.get(), | 77 session.get(), |
78 HttpRequestInfo(), | 78 HttpRequestInfo(), |
79 DEFAULT_PRIORITY, | 79 DEFAULT_PRIORITY, |
80 SSLConfig(), | 80 SSLConfig(), |
81 SSLConfig(), | 81 SSLConfig(), |
82 NULL); | 82 NULL); |
83 request.AttachJob(job); | 83 request.AttachJob(job); |
84 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); | 84 EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); |
85 | 85 |
86 request.SetPriority(MEDIUM); | 86 request.SetPriority(MEDIUM); |
87 EXPECT_EQ(MEDIUM, job->priority()); | 87 EXPECT_EQ(MEDIUM, job->priority()); |
88 | 88 |
89 // Make |job| the bound job. | 89 // Make |job| the bound job. |
90 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); | 90 request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE); |
91 | 91 |
92 request.SetPriority(IDLE); | 92 request.SetPriority(IDLE); |
93 EXPECT_EQ(IDLE, job->priority()); | 93 EXPECT_EQ(IDLE, job->priority()); |
94 } | 94 } |
95 | 95 |
96 } // namespace net | 96 } // namespace net |
OLD | NEW |