Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_server_properties_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 http_server_props_manager_->SupportsRequestPriority(google_server)); | 400 http_server_props_manager_->SupportsRequestPriority(google_server)); |
| 401 EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(mail_server)); | 401 EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(mail_server)); |
| 402 HostPortPair foo_host_port_pair = | 402 HostPortPair foo_host_port_pair = |
| 403 HostPortPair::FromString("foo.google.com:1337"); | 403 HostPortPair::FromString("foo.google.com:1337"); |
| 404 url::SchemeHostPort foo_server("http", foo_host_port_pair.host(), | 404 url::SchemeHostPort foo_server("http", foo_host_port_pair.host(), |
| 405 foo_host_port_pair.port()); | 405 foo_host_port_pair.port()); |
| 406 | 406 |
| 407 EXPECT_FALSE(http_server_props_manager_->SupportsRequestPriority(foo_server)); | 407 EXPECT_FALSE(http_server_props_manager_->SupportsRequestPriority(foo_server)); |
| 408 | 408 |
| 409 // Verify alternative service. | 409 // Verify alternative service. |
| 410 if (GetParam() >= 4) { | 410 const AlternativeServiceMap& map = |
| 411 const AlternativeServiceMap& map = | 411 http_server_props_manager_->alternative_service_map(); |
| 412 http_server_props_manager_->alternative_service_map(); | 412 ASSERT_EQ(2u, map.size()); |
| 413 ASSERT_EQ(2u, map.size()); | |
| 414 | 413 |
| 415 AlternativeServiceMap::const_iterator map_it = map.begin(); | 414 AlternativeServiceMap::const_iterator map_it = map.begin(); |
| 416 EXPECT_EQ("mail.google.com", map_it->first.host()); | 415 EXPECT_EQ("www.google.com", map_it->first.host()); |
| 417 ASSERT_EQ(1u, map_it->second.size()); | 416 ASSERT_EQ(2u, map_it->second.size()); |
| 418 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); | 417 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); |
| 419 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); | 418 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); |
| 420 EXPECT_EQ(444, map_it->second[0].alternative_service().port); | 419 EXPECT_EQ(443, map_it->second[0].alternative_service().port); |
| 421 ++map_it; | 420 EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service().protocol); |
| 422 EXPECT_EQ("www.google.com", map_it->first.host()); | 421 EXPECT_TRUE(map_it->second[1].alternative_service().host.empty()); |
| 423 ASSERT_EQ(2u, map_it->second.size()); | 422 EXPECT_EQ(1234, map_it->second[1].alternative_service().port); |
| 424 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); | 423 ++map_it; |
| 425 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); | 424 EXPECT_EQ("mail.google.com", map_it->first.host()); |
| 426 EXPECT_EQ(443, map_it->second[0].alternative_service().port); | 425 ASSERT_EQ(1u, map_it->second.size()); |
| 427 EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service().protocol); | 426 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); |
| 428 EXPECT_TRUE(map_it->second[1].alternative_service().host.empty()); | 427 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); |
| 429 EXPECT_EQ(1234, map_it->second[1].alternative_service().port); | 428 EXPECT_EQ(444, map_it->second[0].alternative_service().port); |
|
Zhongyi Shi
2017/06/26 19:05:55
Urm, old test indicated that the order has been ch
| |
| 430 } else { | |
| 431 const AlternativeServiceMap& map = | |
| 432 http_server_props_manager_->alternative_service_map(); | |
| 433 ASSERT_EQ(2u, map.size()); | |
| 434 AlternativeServiceMap::const_iterator map_it = map.begin(); | |
| 435 EXPECT_EQ("www.google.com", map_it->first.host()); | |
| 436 ASSERT_EQ(2u, map_it->second.size()); | |
| 437 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); | |
| 438 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); | |
| 439 EXPECT_EQ(443, map_it->second[0].alternative_service().port); | |
| 440 EXPECT_EQ(kProtoQUIC, map_it->second[1].alternative_service().protocol); | |
| 441 EXPECT_TRUE(map_it->second[1].alternative_service().host.empty()); | |
| 442 EXPECT_EQ(1234, map_it->second[1].alternative_service().port); | |
| 443 ++map_it; | |
| 444 EXPECT_EQ("mail.google.com", map_it->first.host()); | |
| 445 ASSERT_EQ(1u, map_it->second.size()); | |
| 446 EXPECT_EQ(kProtoHTTP2, map_it->second[0].alternative_service().protocol); | |
| 447 EXPECT_TRUE(map_it->second[0].alternative_service().host.empty()); | |
| 448 EXPECT_EQ(444, map_it->second[0].alternative_service().port); | |
| 449 } | |
| 450 | 429 |
| 451 // Verify SupportsQuic. | 430 // Verify SupportsQuic. |
| 452 IPAddress last_address; | 431 IPAddress last_address; |
| 453 EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&last_address)); | 432 EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&last_address)); |
| 454 EXPECT_EQ("127.0.0.1", last_address.ToString()); | 433 EXPECT_EQ("127.0.0.1", last_address.ToString()); |
| 455 | 434 |
| 456 // Verify ServerNetworkStats. | 435 // Verify ServerNetworkStats. |
| 457 const ServerNetworkStats* stats2 = | 436 const ServerNetworkStats* stats2 = |
| 458 http_server_props_manager_->GetServerNetworkStats(google_server); | 437 http_server_props_manager_->GetServerNetworkStats(google_server); |
| 459 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); | 438 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1565 pref_test_task_runner_->FastForwardUntilNoTasksRemain(); | 1544 pref_test_task_runner_->FastForwardUntilNoTasksRemain(); |
| 1566 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); | 1545 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); |
| 1567 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); | 1546 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); |
| 1568 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 1547 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 1569 http_server_props_manager_.reset(); | 1548 http_server_props_manager_.reset(); |
| 1570 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); | 1549 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); |
| 1571 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); | 1550 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); |
| 1572 } | 1551 } |
| 1573 | 1552 |
| 1574 } // namespace net | 1553 } // namespace net |
| OLD | NEW |