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

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

Issue 19866006: [Net] Propagate priority changes from HttpNetworkTransaction to its request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/http/http_stream_factory_impl_request.h"
6
7 #include "net/http/http_stream_factory_impl_job.h"
8 #include "net/proxy/proxy_info.h"
9 #include "net/proxy/proxy_service.h"
10 #include "net/spdy/spdy_test_util_common.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace net {
14
15 class HttpStreamFactoryImplRequestTest
16 : public ::testing::Test,
17 public ::testing::WithParamInterface<NextProto> {};
18
19 INSTANTIATE_TEST_CASE_P(
20 NextProto,
21 HttpStreamFactoryImplRequestTest,
22 testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
23
24 namespace {
25
26 class DoNothingRequestDelegate : public HttpStreamRequest::Delegate {
27 public:
28 DoNothingRequestDelegate() {}
29
30 virtual ~DoNothingRequestDelegate() {}
31
32 // HttpStreamRequest::Delegate
33 virtual void OnStreamReady(
34 const SSLConfig& used_ssl_config,
35 const ProxyInfo& used_proxy_info,
36 HttpStreamBase* stream) OVERRIDE {}
37 virtual void OnWebSocketStreamReady(
38 const SSLConfig& used_ssl_config,
39 const ProxyInfo& used_proxy_info,
40 WebSocketStreamBase* stream) OVERRIDE {}
41 virtual void OnStreamFailed(
42 int status,
43 const SSLConfig& used_ssl_config) OVERRIDE {}
44 virtual void OnCertificateError(
45 int status,
46 const SSLConfig& used_ssl_config,
47 const SSLInfo& ssl_info) OVERRIDE {}
48 virtual void OnNeedsProxyAuth(const HttpResponseInfo& proxy_response,
49 const SSLConfig& used_ssl_config,
50 const ProxyInfo& used_proxy_info,
51 HttpAuthController* auth_controller) OVERRIDE {}
52 virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config,
53 SSLCertRequestInfo* cert_info) OVERRIDE {}
54 virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
55 const SSLConfig& used_ssl_config,
56 const ProxyInfo& used_proxy_info,
57 HttpStreamBase* stream) OVERRIDE {}
58 };
59
60 } // namespace
61
62 // Make sure that Request passes on its priority updates to its jobs.
63 TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) {
64 SpdySessionDependencies session_deps(GetParam(),
65 ProxyService::CreateDirect());
66
67 scoped_refptr<HttpNetworkSession>
68 session(SpdySessionDependencies::SpdyCreateSession(&session_deps));
69 HttpStreamFactoryImpl* factory =
70 static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
71
72 DoNothingRequestDelegate request_delegate;
73 HttpStreamFactoryImpl::Request request(
74 GURL(), factory, &request_delegate, NULL, BoundNetLog());
75
76 HttpStreamFactoryImpl::Job* job =
77 new HttpStreamFactoryImpl::Job(factory,
78 session,
79 HttpRequestInfo(),
80 DEFAULT_PRIORITY,
81 SSLConfig(),
82 SSLConfig(),
83 NULL);
84 request.AttachJob(job);
85
86 request.SetPriority(LOW);
87 EXPECT_EQ(LOW, job->priority());
88
89 // Make |job| the bound job.
90 request.OnStreamFailed(job, ERR_FAILED, SSLConfig());
91
92 request.SetPriority(IDLE);
93 EXPECT_EQ(IDLE, job->priority());
94 }
95
96 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698