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