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

Side by Side Diff: net/http/http_network_transaction_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <limits> 10 #include <limits>
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 : public PlatformTest, 264 : public PlatformTest,
265 public ::testing::WithParamInterface<TestCase> { 265 public ::testing::WithParamInterface<TestCase> {
266 public: 266 public:
267 virtual ~HttpNetworkTransactionTest() { 267 virtual ~HttpNetworkTransactionTest() {
268 // Important to restore the per-pool limit first, since the pool limit must 268 // Important to restore the per-pool limit first, since the pool limit must
269 // always be greater than group limit, and the tests reduce both limits. 269 // always be greater than group limit, and the tests reduce both limits.
270 ClientSocketPoolManager::set_max_sockets_per_pool( 270 ClientSocketPoolManager::set_max_sockets_per_pool(
271 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_pool_sockets_); 271 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_pool_sockets_);
272 ClientSocketPoolManager::set_max_sockets_per_group( 272 ClientSocketPoolManager::set_max_sockets_per_group(
273 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); 273 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_);
274 SpdySession::SetPriorityDependencyDefaultForTesting(false); 274 Http2PriorityDependencies::SetEnabledDefaultForTesting(
275 old_dependency_default_);
275 } 276 }
276 277
277 protected: 278 protected:
278 HttpNetworkTransactionTest() 279 HttpNetworkTransactionTest()
279 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), 280 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()),
280 session_deps_(GetProtocol()), 281 session_deps_(GetProtocol()),
281 old_max_group_sockets_(ClientSocketPoolManager::max_sockets_per_group( 282 old_max_group_sockets_(ClientSocketPoolManager::max_sockets_per_group(
282 HttpNetworkSession::NORMAL_SOCKET_POOL)), 283 HttpNetworkSession::NORMAL_SOCKET_POOL)),
283 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( 284 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool(
284 HttpNetworkSession::NORMAL_SOCKET_POOL)) { 285 HttpNetworkSession::NORMAL_SOCKET_POOL)) {
285 SpdySession::SetPriorityDependencyDefaultForTesting( 286 old_dependency_default_ =
286 GetDependenciesFromPriority()); 287 Http2PriorityDependencies::SetEnabledDefaultForTesting(
288 GetDependenciesFromPriority());
287 } 289 }
288 290
289 struct SimpleGetHelperResult { 291 struct SimpleGetHelperResult {
290 int rv; 292 int rv;
291 std::string status_line; 293 std::string status_line;
292 std::string response_data; 294 std::string response_data;
293 int64_t total_received_bytes; 295 int64_t total_received_bytes;
294 int64_t total_sent_bytes; 296 int64_t total_sent_bytes;
295 LoadTimingInfo load_timing_info; 297 LoadTimingInfo load_timing_info;
296 ConnectionAttempts connection_attempts; 298 ConnectionAttempts connection_attempts;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 471
470 void CheckErrorIsPassedBack(int error, IoMode mode); 472 void CheckErrorIsPassedBack(int error, IoMode mode);
471 473
472 SpdyTestUtil spdy_util_; 474 SpdyTestUtil spdy_util_;
473 SpdySessionDependencies session_deps_; 475 SpdySessionDependencies session_deps_;
474 476
475 // Original socket limits. Some tests set these. Safest to always restore 477 // Original socket limits. Some tests set these. Safest to always restore
476 // them once each test has been run. 478 // them once each test has been run.
477 int old_max_group_sockets_; 479 int old_max_group_sockets_;
478 int old_max_pool_sockets_; 480 int old_max_pool_sockets_;
481
482 // Pre-test default for priority dependencies.
483 bool old_dependency_default_;
479 }; 484 };
480 485
481 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, 486 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend,
482 HttpNetworkTransactionTest, 487 HttpNetworkTransactionTest,
483 testing::Values(kTestCaseSPDY31, 488 testing::Values(kTestCaseSPDY31,
484 kTestCaseHTTP2NoPriorityDependencies, 489 kTestCaseHTTP2NoPriorityDependencies,
485 kTestCaseHTTP2PriorityDependencies)); 490 kTestCaseHTTP2PriorityDependencies));
486 491
487 namespace { 492 namespace {
488 493
(...skipping 15470 matching lines...) Expand 10 before | Expand all | Expand 10 after
15959 base::MessageLoop::current()->RunUntilIdle(); 15964 base::MessageLoop::current()->RunUntilIdle();
15960 15965
15961 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); 15966 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy);
15962 HttpRequestHeaders headers; 15967 HttpRequestHeaders headers;
15963 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); 15968 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers));
15964 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); 15969 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding));
15965 } 15970 }
15966 #endif // !defined(OS_IOS) 15971 #endif // !defined(OS_IOS)
15967 15972
15968 } // namespace net 15973 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | net/spdy/http2_priority_dependencies.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698