OLD | NEW |
---|---|
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/http/http_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); | 1103 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); |
1104 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); | 1104 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); |
1105 // Https server should have nothing set for server network stats. | 1105 // Https server should have nothing set for server network stats. |
1106 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); | 1106 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); |
1107 | 1107 |
1108 impl_.Clear(); | 1108 impl_.Clear(); |
1109 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_http_server)); | 1109 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_http_server)); |
1110 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); | 1110 EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); |
1111 } | 1111 } |
1112 | 1112 |
1113 TEST_F(ServerNetworkStatsServerPropertiesTest, ClearServerNetworkStats) { | |
1114 ServerNetworkStats stats; | |
1115 stats.srtt = base::TimeDelta::FromMicroseconds(10); | |
1116 stats.bandwidth_estimate = QuicBandwidth::FromBitsPerSecond(100); | |
1117 url::SchemeHostPort foo_https_server("https", "foo", 443); | |
1118 impl_.SetServerNetworkStats(foo_https_server, stats); | |
1119 | |
1120 impl_.ClearServerNetworkStats(foo_https_server); | |
Jana
2017/02/17 02:52:12
Nit: can you do a GetServerNetworkStats() before t
Ryan Hamilton
2017/02/17 03:41:53
I can but that's tested in the previous test, and
| |
1121 EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_https_server)); | |
1122 } | |
1123 | |
1113 typedef HttpServerPropertiesImplTest QuicServerInfoServerPropertiesTest; | 1124 typedef HttpServerPropertiesImplTest QuicServerInfoServerPropertiesTest; |
1114 | 1125 |
1115 TEST_F(QuicServerInfoServerPropertiesTest, Set) { | 1126 TEST_F(QuicServerInfoServerPropertiesTest, Set) { |
1116 HostPortPair google_server("www.google.com", 443); | 1127 HostPortPair google_server("www.google.com", 443); |
1117 QuicServerId google_quic_server_id(google_server, PRIVACY_MODE_ENABLED); | 1128 QuicServerId google_quic_server_id(google_server, PRIVACY_MODE_ENABLED); |
1118 | 1129 |
1119 EXPECT_EQ(QuicServerInfoMap::NO_AUTO_EVICT, | 1130 EXPECT_EQ(QuicServerInfoMap::NO_AUTO_EVICT, |
1120 impl_.quic_server_info_map().max_size()); | 1131 impl_.quic_server_info_map().max_size()); |
1121 impl_.SetMaxServerConfigsStoredInProperties(10); | 1132 impl_.SetMaxServerConfigsStoredInProperties(10); |
1122 EXPECT_EQ(10u, impl_.quic_server_info_map().max_size()); | 1133 EXPECT_EQ(10u, impl_.quic_server_info_map().max_size()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); | 1222 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); |
1212 | 1223 |
1213 impl_.Clear(); | 1224 impl_.Clear(); |
1214 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); | 1225 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); |
1215 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); | 1226 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); |
1216 } | 1227 } |
1217 | 1228 |
1218 } // namespace | 1229 } // namespace |
1219 | 1230 |
1220 } // namespace net | 1231 } // namespace net |
OLD | NEW |