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

Side by Side Diff: net/spdy/spdy_proxy_client_socket_unittest.cc

Issue 1779733003: Fix bug in net::RequestPriority -> HTTP/2 dependency conversion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 MockConnect connect_data_; 147 MockConnect connect_data_;
148 base::WeakPtr<SpdySession> spdy_session_; 148 base::WeakPtr<SpdySession> spdy_session_;
149 BufferedSpdyFramer framer_; 149 BufferedSpdyFramer framer_;
150 150
151 std::string user_agent_; 151 std::string user_agent_;
152 GURL url_; 152 GURL url_;
153 HostPortPair proxy_host_port_; 153 HostPortPair proxy_host_port_;
154 HostPortPair endpoint_host_port_pair_; 154 HostPortPair endpoint_host_port_pair_;
155 ProxyServer proxy_; 155 ProxyServer proxy_;
156 SpdySessionKey endpoint_spdy_session_key_; 156 SpdySessionKey endpoint_spdy_session_key_;
157 bool old_dependency_default_;
157 158
158 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketTest); 159 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocketTest);
159 }; 160 };
160 161
161 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, 162 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend,
162 SpdyProxyClientSocketTest, 163 SpdyProxyClientSocketTest,
163 testing::Values(kTestCaseSPDY31, 164 testing::Values(kTestCaseSPDY31,
164 kTestCaseHTTP2NoPriorityDependencies, 165 kTestCaseHTTP2NoPriorityDependencies,
165 kTestCaseHTTP2PriorityDependencies)); 166 kTestCaseHTTP2PriorityDependencies));
166 167
167 SpdyProxyClientSocketTest::SpdyProxyClientSocketTest() 168 SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
168 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), 169 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()),
169 read_buf_(NULL), 170 read_buf_(NULL),
170 session_deps_(GetProtocol()), 171 session_deps_(GetProtocol()),
171 connect_data_(SYNCHRONOUS, OK), 172 connect_data_(SYNCHRONOUS, OK),
172 framer_(spdy_util_.spdy_version()), 173 framer_(spdy_util_.spdy_version()),
173 user_agent_(kUserAgent), 174 user_agent_(kUserAgent),
174 url_(kRequestUrl), 175 url_(kRequestUrl),
175 proxy_host_port_(kProxyHost, kProxyPort), 176 proxy_host_port_(kProxyHost, kProxyPort),
176 endpoint_host_port_pair_(kOriginHost, kOriginPort), 177 endpoint_host_port_pair_(kOriginHost, kOriginPort),
177 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_), 178 proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_),
178 endpoint_spdy_session_key_(endpoint_host_port_pair_, 179 endpoint_spdy_session_key_(endpoint_host_port_pair_,
179 proxy_, 180 proxy_,
180 PRIVACY_MODE_DISABLED) { 181 PRIVACY_MODE_DISABLED) {
181 session_deps_.net_log = net_log_.bound().net_log(); 182 session_deps_.net_log = net_log_.bound().net_log();
182 SpdySession::SetPriorityDependencyDefaultForTesting( 183 old_dependency_default_ =
183 GetDependenciesFromPriority()); 184 Http2PriorityDependencies::SetEnabledDefaultForTesting(
185 GetDependenciesFromPriority());
184 } 186 }
185 187
186 SpdyProxyClientSocketTest::~SpdyProxyClientSocketTest() { 188 SpdyProxyClientSocketTest::~SpdyProxyClientSocketTest() {
187 EXPECT_TRUE(data_->AllWriteDataConsumed()); 189 EXPECT_TRUE(data_->AllWriteDataConsumed());
188 EXPECT_TRUE(data_->AllReadDataConsumed()); 190 EXPECT_TRUE(data_->AllReadDataConsumed());
189 SpdySession::SetPriorityDependencyDefaultForTesting(false); 191 Http2PriorityDependencies::SetEnabledDefaultForTesting(
192 old_dependency_default_);
190 } 193 }
191 194
192 void SpdyProxyClientSocketTest::TearDown() { 195 void SpdyProxyClientSocketTest::TearDown() {
193 if (session_.get() != NULL) 196 if (session_.get() != NULL)
194 session_->spdy_session_pool()->CloseAllSessions(); 197 session_->spdy_session_pool()->CloseAllSessions();
195 198
196 // Empty the current queue. 199 // Empty the current queue.
197 base::MessageLoop::current()->RunUntilIdle(); 200 base::MessageLoop::current()->RunUntilIdle();
198 PlatformTest::TearDown(); 201 PlatformTest::TearDown();
199 } 202 }
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 1384
1382 EXPECT_FALSE(sock_.get()); 1385 EXPECT_FALSE(sock_.get());
1383 EXPECT_TRUE(read_callback.have_result()); 1386 EXPECT_TRUE(read_callback.have_result());
1384 EXPECT_FALSE(write_callback_.have_result()); 1387 EXPECT_FALSE(write_callback_.have_result());
1385 1388
1386 // Let the RST_STREAM write while |rst| is in-scope. 1389 // Let the RST_STREAM write while |rst| is in-scope.
1387 base::MessageLoop::current()->RunUntilIdle(); 1390 base::MessageLoop::current()->RunUntilIdle();
1388 } 1391 }
1389 1392
1390 } // namespace net 1393 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698