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

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

Issue 1676023002: Make IPAddress::FromIPLiteral a member function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 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 "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 814 }
815 815
816 TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) { 816 TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) {
817 ExpectPrefsUpdate(); 817 ExpectPrefsUpdate();
818 ExpectScheduleUpdatePrefsOnNetworkThread(); 818 ExpectScheduleUpdatePrefsOnNetworkThread();
819 819
820 IPAddress address; 820 IPAddress address;
821 EXPECT_FALSE(http_server_props_manager_->GetSupportsQuic(&address)); 821 EXPECT_FALSE(http_server_props_manager_->GetSupportsQuic(&address));
822 822
823 IPAddress actual_address; 823 IPAddress actual_address;
824 CHECK(IPAddress::FromIPLiteral("127.0.0.1", &actual_address)); 824 CHECK(actual_address.AssignFromIPLiteral("127.0.0.1"));
825 http_server_props_manager_->SetSupportsQuic(true, actual_address); 825 http_server_props_manager_->SetSupportsQuic(true, actual_address);
826 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. 826 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
827 http_server_props_manager_->SetSupportsQuic(true, actual_address); 827 http_server_props_manager_->SetSupportsQuic(true, actual_address);
828 828
829 // Run the task. 829 // Run the task.
830 base::RunLoop().RunUntilIdle(); 830 base::RunLoop().RunUntilIdle();
831 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 831 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
832 832
833 EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&address)); 833 EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&address));
834 EXPECT_EQ(actual_address, address); 834 EXPECT_EQ(actual_address, address);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 TEST_P(HttpServerPropertiesManagerTest, Clear) { 882 TEST_P(HttpServerPropertiesManagerTest, Clear) {
883 ExpectPrefsUpdate(); 883 ExpectPrefsUpdate();
884 ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly(); 884 ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly();
885 885
886 HostPortPair spdy_server_mail("mail.google.com", 443); 886 HostPortPair spdy_server_mail("mail.google.com", 443);
887 http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true); 887 http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true);
888 AlternativeService alternative_service(NPN_HTTP_2, "mail.google.com", 1234); 888 AlternativeService alternative_service(NPN_HTTP_2, "mail.google.com", 1234);
889 http_server_props_manager_->SetAlternativeService( 889 http_server_props_manager_->SetAlternativeService(
890 spdy_server_mail, alternative_service, 1.0, one_day_from_now_); 890 spdy_server_mail, alternative_service, 1.0, one_day_from_now_);
891 IPAddress actual_address; 891 IPAddress actual_address;
892 CHECK(IPAddress::FromIPLiteral("127.0.0.1", &actual_address)); 892 CHECK(actual_address.AssignFromIPLiteral("127.0.0.1"));
893 http_server_props_manager_->SetSupportsQuic(true, actual_address); 893 http_server_props_manager_->SetSupportsQuic(true, actual_address);
894 ServerNetworkStats stats; 894 ServerNetworkStats stats;
895 stats.srtt = base::TimeDelta::FromMicroseconds(10); 895 stats.srtt = base::TimeDelta::FromMicroseconds(10);
896 http_server_props_manager_->SetServerNetworkStats(spdy_server_mail, stats); 896 http_server_props_manager_->SetServerNetworkStats(spdy_server_mail, stats);
897 897
898 QuicServerId mail_quic_server_id("mail.google.com", 80); 898 QuicServerId mail_quic_server_id("mail.google.com", 80);
899 std::string quic_server_info1("quic_server_info1"); 899 std::string quic_server_info1("quic_server_info1");
900 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id, 900 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id,
901 quic_server_info1); 901 quic_server_info1);
902 902
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 http_server_props_manager_->SetServerNetworkStats(server_mail, stats); 1072 http_server_props_manager_->SetServerNetworkStats(server_mail, stats);
1073 1073
1074 // Set quic_server_info string. 1074 // Set quic_server_info string.
1075 QuicServerId mail_quic_server_id("mail.google.com", 80); 1075 QuicServerId mail_quic_server_id("mail.google.com", 80);
1076 std::string quic_server_info1("quic_server_info1"); 1076 std::string quic_server_info1("quic_server_info1");
1077 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id, 1077 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id,
1078 quic_server_info1); 1078 quic_server_info1);
1079 1079
1080 // Set SupportsQuic. 1080 // Set SupportsQuic.
1081 IPAddress actual_address; 1081 IPAddress actual_address;
1082 CHECK(IPAddress::FromIPLiteral("127.0.0.1", &actual_address)); 1082 CHECK(actual_address.AssignFromIPLiteral("127.0.0.1"));
1083 http_server_props_manager_->SetSupportsQuic(true, actual_address); 1083 http_server_props_manager_->SetSupportsQuic(true, actual_address);
1084 1084
1085 // Update cache. 1085 // Update cache.
1086 ExpectPrefsUpdate(); 1086 ExpectPrefsUpdate();
1087 ExpectCacheUpdate(); 1087 ExpectCacheUpdate();
1088 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread(); 1088 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread();
1089 base::RunLoop().RunUntilIdle(); 1089 base::RunLoop().RunUntilIdle();
1090 1090
1091 // Verify preferences. 1091 // Verify preferences.
1092 const char expected_json[] = 1092 const char expected_json[] =
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 // Shutdown comes before the task is executed. 1345 // Shutdown comes before the task is executed.
1346 http_server_props_manager_->ShutdownOnPrefThread(); 1346 http_server_props_manager_->ShutdownOnPrefThread();
1347 // Run the task after shutdown, but before deletion. 1347 // Run the task after shutdown, but before deletion.
1348 base::RunLoop().RunUntilIdle(); 1348 base::RunLoop().RunUntilIdle();
1349 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 1349 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
1350 http_server_props_manager_.reset(); 1350 http_server_props_manager_.reset();
1351 base::RunLoop().RunUntilIdle(); 1351 base::RunLoop().RunUntilIdle();
1352 } 1352 }
1353 1353
1354 } // namespace net 1354 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698