| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/http/http_server_properties_impl.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/containers/hash_tables.h" | |
| 12 #include "base/logging.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/values.h" | |
| 15 #include "net/base/host_port_pair.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | |
| 17 | |
| 18 namespace base { | |
| 19 class ListValue; | |
| 20 } | |
| 21 | |
| 22 namespace net { | |
| 23 | |
| 24 const int kMaxSupportsSpdyServerHosts = 500; | |
| 25 | |
| 26 namespace { | |
| 27 | |
| 28 class HttpServerPropertiesImplTest : public testing::Test { | |
| 29 protected: | |
| 30 bool HasAlternateProtocol(const HostPortPair& server) { | |
| 31 const AlternateProtocolInfo alternate = impl_.GetAlternateProtocol(server); | |
| 32 return alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; | |
| 33 } | |
| 34 | |
| 35 HttpServerPropertiesImpl impl_; | |
| 36 }; | |
| 37 | |
| 38 typedef HttpServerPropertiesImplTest SpdyServerPropertiesTest; | |
| 39 | |
| 40 TEST_F(SpdyServerPropertiesTest, Initialize) { | |
| 41 HostPortPair spdy_server_google("www.google.com", 443); | |
| 42 std::string spdy_server_g = spdy_server_google.ToString(); | |
| 43 | |
| 44 HostPortPair spdy_server_docs("docs.google.com", 443); | |
| 45 std::string spdy_server_d = spdy_server_docs.ToString(); | |
| 46 | |
| 47 // Check by initializing NULL spdy servers. | |
| 48 impl_.InitializeSpdyServers(NULL, true); | |
| 49 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 50 | |
| 51 // Check by initializing empty spdy servers. | |
| 52 std::vector<std::string> spdy_servers; | |
| 53 impl_.InitializeSpdyServers(&spdy_servers, true); | |
| 54 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 55 | |
| 56 // Check by initializing with www.google.com:443 spdy server. | |
| 57 std::vector<std::string> spdy_servers1; | |
| 58 spdy_servers1.push_back(spdy_server_g); | |
| 59 impl_.InitializeSpdyServers(&spdy_servers1, true); | |
| 60 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 61 | |
| 62 // Check by initializing with www.google.com:443 and docs.google.com:443 spdy | |
| 63 // servers. | |
| 64 std::vector<std::string> spdy_servers2; | |
| 65 spdy_servers2.push_back(spdy_server_g); | |
| 66 spdy_servers2.push_back(spdy_server_d); | |
| 67 impl_.InitializeSpdyServers(&spdy_servers2, true); | |
| 68 | |
| 69 // Verify spdy_server_g and spdy_server_d are in the list in the same order. | |
| 70 base::ListValue spdy_server_list; | |
| 71 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 72 EXPECT_EQ(2U, spdy_server_list.GetSize()); | |
| 73 std::string string_value_g; | |
| 74 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); | |
| 75 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 76 std::string string_value_d; | |
| 77 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_d)); | |
| 78 ASSERT_EQ(spdy_server_d, string_value_d); | |
| 79 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 80 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); | |
| 81 } | |
| 82 | |
| 83 TEST_F(SpdyServerPropertiesTest, SupportsRequestPriorityTest) { | |
| 84 HostPortPair spdy_server_empty(std::string(), 443); | |
| 85 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_empty)); | |
| 86 | |
| 87 // Add www.google.com:443 as supporting SPDY. | |
| 88 HostPortPair spdy_server_google("www.google.com", 443); | |
| 89 impl_.SetSupportsSpdy(spdy_server_google, true); | |
| 90 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 91 | |
| 92 // Add mail.google.com:443 as not supporting SPDY. | |
| 93 HostPortPair spdy_server_mail("mail.google.com", 443); | |
| 94 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); | |
| 95 | |
| 96 // Add docs.google.com:443 as supporting SPDY. | |
| 97 HostPortPair spdy_server_docs("docs.google.com", 443); | |
| 98 impl_.SetSupportsSpdy(spdy_server_docs, true); | |
| 99 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); | |
| 100 | |
| 101 // Add www.youtube.com:443 as supporting QUIC. | |
| 102 HostPortPair quic_server_youtube("www.youtube.com", 443); | |
| 103 impl_.SetAlternateProtocol(quic_server_youtube, 443, QUIC, 1); | |
| 104 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube)); | |
| 105 | |
| 106 // Verify all the entries are the same after additions. | |
| 107 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 108 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); | |
| 109 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); | |
| 110 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube)); | |
| 111 } | |
| 112 | |
| 113 TEST_F(SpdyServerPropertiesTest, Clear) { | |
| 114 // Add www.google.com:443 and mail.google.com:443 as supporting SPDY. | |
| 115 HostPortPair spdy_server_google("www.google.com", 443); | |
| 116 impl_.SetSupportsSpdy(spdy_server_google, true); | |
| 117 HostPortPair spdy_server_mail("mail.google.com", 443); | |
| 118 impl_.SetSupportsSpdy(spdy_server_mail, true); | |
| 119 | |
| 120 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 121 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_mail)); | |
| 122 | |
| 123 impl_.Clear(); | |
| 124 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 125 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); | |
| 126 } | |
| 127 | |
| 128 TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) { | |
| 129 base::ListValue spdy_server_list; | |
| 130 | |
| 131 // Check there are no spdy_servers. | |
| 132 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 133 EXPECT_EQ(0U, spdy_server_list.GetSize()); | |
| 134 | |
| 135 // Check empty server is not added. | |
| 136 HostPortPair spdy_server_empty(std::string(), 443); | |
| 137 impl_.SetSupportsSpdy(spdy_server_empty, true); | |
| 138 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 139 EXPECT_EQ(0U, spdy_server_list.GetSize()); | |
| 140 | |
| 141 std::string string_value_g; | |
| 142 std::string string_value_m; | |
| 143 HostPortPair spdy_server_google("www.google.com", 443); | |
| 144 std::string spdy_server_g = spdy_server_google.ToString(); | |
| 145 HostPortPair spdy_server_mail("mail.google.com", 443); | |
| 146 std::string spdy_server_m = spdy_server_mail.ToString(); | |
| 147 | |
| 148 // Add www.google.com:443 as not supporting SPDY. | |
| 149 impl_.SetSupportsSpdy(spdy_server_google, false); | |
| 150 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 151 EXPECT_EQ(0U, spdy_server_list.GetSize()); | |
| 152 | |
| 153 // Add www.google.com:443 as supporting SPDY. | |
| 154 impl_.SetSupportsSpdy(spdy_server_google, true); | |
| 155 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 156 ASSERT_EQ(1U, spdy_server_list.GetSize()); | |
| 157 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); | |
| 158 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 159 | |
| 160 // Add mail.google.com:443 as not supporting SPDY. | |
| 161 impl_.SetSupportsSpdy(spdy_server_mail, false); | |
| 162 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 163 ASSERT_EQ(1U, spdy_server_list.GetSize()); | |
| 164 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); | |
| 165 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 166 | |
| 167 // Add mail.google.com:443 as supporting SPDY. | |
| 168 impl_.SetSupportsSpdy(spdy_server_mail, true); | |
| 169 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 170 ASSERT_EQ(2U, spdy_server_list.GetSize()); | |
| 171 | |
| 172 // Verify www.google.com:443 and mail.google.com:443 are in the list. | |
| 173 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m)); | |
| 174 ASSERT_EQ(spdy_server_m, string_value_m); | |
| 175 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_g)); | |
| 176 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 177 | |
| 178 // Request for only one server and verify that we get only one server. | |
| 179 impl_.GetSpdyServerList(&spdy_server_list, 1); | |
| 180 ASSERT_EQ(1U, spdy_server_list.GetSize()); | |
| 181 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m)); | |
| 182 ASSERT_EQ(spdy_server_m, string_value_m); | |
| 183 } | |
| 184 | |
| 185 TEST_F(SpdyServerPropertiesTest, MRUOfGetSpdyServerList) { | |
| 186 base::ListValue spdy_server_list; | |
| 187 | |
| 188 std::string string_value_g; | |
| 189 std::string string_value_m; | |
| 190 HostPortPair spdy_server_google("www.google.com", 443); | |
| 191 std::string spdy_server_g = spdy_server_google.ToString(); | |
| 192 HostPortPair spdy_server_mail("mail.google.com", 443); | |
| 193 std::string spdy_server_m = spdy_server_mail.ToString(); | |
| 194 | |
| 195 // Add www.google.com:443 as supporting SPDY. | |
| 196 impl_.SetSupportsSpdy(spdy_server_google, true); | |
| 197 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 198 ASSERT_EQ(1U, spdy_server_list.GetSize()); | |
| 199 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); | |
| 200 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 201 | |
| 202 // Add mail.google.com:443 as supporting SPDY. Verify mail.google.com:443 and | |
| 203 // www.google.com:443 are in the list. | |
| 204 impl_.SetSupportsSpdy(spdy_server_mail, true); | |
| 205 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 206 ASSERT_EQ(2U, spdy_server_list.GetSize()); | |
| 207 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m)); | |
| 208 ASSERT_EQ(spdy_server_m, string_value_m); | |
| 209 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_g)); | |
| 210 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 211 | |
| 212 // Get www.google.com:443 should reorder SpdyServerHostPortMap. Verify that it | |
| 213 // is www.google.com:443 is the MRU server. | |
| 214 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); | |
| 215 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); | |
| 216 ASSERT_EQ(2U, spdy_server_list.GetSize()); | |
| 217 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); | |
| 218 ASSERT_EQ(spdy_server_g, string_value_g); | |
| 219 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_m)); | |
| 220 ASSERT_EQ(spdy_server_m, string_value_m); | |
| 221 } | |
| 222 | |
| 223 typedef HttpServerPropertiesImplTest AlternateProtocolServerPropertiesTest; | |
| 224 | |
| 225 TEST_F(AlternateProtocolServerPropertiesTest, Basic) { | |
| 226 HostPortPair test_host_port_pair("foo", 80); | |
| 227 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 228 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0); | |
| 229 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 230 const AlternateProtocolInfo alternate = | |
| 231 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 232 EXPECT_EQ(443, alternate.port); | |
| 233 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | |
| 234 | |
| 235 impl_.Clear(); | |
| 236 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 237 } | |
| 238 | |
| 239 TEST_F(AlternateProtocolServerPropertiesTest, DefaultProbabilityExcluded) { | |
| 240 HostPortPair test_host_port_pair("foo", 80); | |
| 241 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .99); | |
| 242 | |
| 243 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 244 } | |
| 245 | |
| 246 TEST_F(AlternateProtocolServerPropertiesTest, Probability) { | |
| 247 impl_.SetAlternateProtocolProbabilityThreshold(.25); | |
| 248 | |
| 249 HostPortPair test_host_port_pair("foo", 80); | |
| 250 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .5); | |
| 251 | |
| 252 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 253 const AlternateProtocolInfo alternate = | |
| 254 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 255 EXPECT_EQ(443, alternate.port); | |
| 256 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | |
| 257 EXPECT_EQ(.5, alternate.probability); | |
| 258 } | |
| 259 | |
| 260 TEST_F(AlternateProtocolServerPropertiesTest, ProbabilityExcluded) { | |
| 261 impl_.SetAlternateProtocolProbabilityThreshold(.75); | |
| 262 | |
| 263 HostPortPair test_host_port_pair("foo", 80); | |
| 264 | |
| 265 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, .5); | |
| 266 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 267 } | |
| 268 | |
| 269 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { | |
| 270 HostPortPair test_host_port_pair1("foo1", 80); | |
| 271 impl_.SetAlternateProtocol(test_host_port_pair1, 443, NPN_SPDY_3, 1.0); | |
| 272 impl_.SetBrokenAlternateProtocol(test_host_port_pair1); | |
| 273 HostPortPair test_host_port_pair2("foo2", 80); | |
| 274 impl_.SetAlternateProtocol(test_host_port_pair2, 443, NPN_SPDY_3, 1.0); | |
| 275 | |
| 276 AlternateProtocolMap alternate_protocol_map( | |
| 277 AlternateProtocolMap::NO_AUTO_EVICT); | |
| 278 AlternateProtocolInfo alternate(123, NPN_SPDY_3, 1); | |
| 279 alternate_protocol_map.Put(test_host_port_pair2, alternate); | |
| 280 HostPortPair test_host_port_pair3("foo3", 80); | |
| 281 alternate.port = 1234; | |
| 282 alternate_protocol_map.Put(test_host_port_pair3, alternate); | |
| 283 impl_.InitializeAlternateProtocolServers(&alternate_protocol_map); | |
| 284 | |
| 285 // Verify test_host_port_pair3 is the MRU server. | |
| 286 const AlternateProtocolMap& map = impl_.alternate_protocol_map(); | |
| 287 AlternateProtocolMap::const_iterator it = map.begin(); | |
| 288 EXPECT_TRUE(it->first.Equals(test_host_port_pair3)); | |
| 289 EXPECT_EQ(1234, it->second.port); | |
| 290 EXPECT_EQ(NPN_SPDY_3, it->second.protocol); | |
| 291 | |
| 292 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair1)); | |
| 293 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair2)); | |
| 294 alternate = impl_.GetAlternateProtocol(test_host_port_pair1); | |
| 295 EXPECT_TRUE(alternate.is_broken); | |
| 296 alternate = impl_.GetAlternateProtocol(test_host_port_pair2); | |
| 297 EXPECT_EQ(123, alternate.port); | |
| 298 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | |
| 299 } | |
| 300 | |
| 301 TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternateProtocol) { | |
| 302 HostPortPair test_host_port_pair1("foo1", 80); | |
| 303 impl_.SetAlternateProtocol(test_host_port_pair1, 443, NPN_SPDY_3, 1.0); | |
| 304 HostPortPair test_host_port_pair2("foo2", 80); | |
| 305 impl_.SetAlternateProtocol(test_host_port_pair2, 1234, NPN_SPDY_3, 1.0); | |
| 306 | |
| 307 const AlternateProtocolMap& map = impl_.alternate_protocol_map(); | |
| 308 AlternateProtocolMap::const_iterator it = map.begin(); | |
| 309 EXPECT_TRUE(it->first.Equals(test_host_port_pair2)); | |
| 310 EXPECT_EQ(1234, it->second.port); | |
| 311 EXPECT_EQ(NPN_SPDY_3, it->second.protocol); | |
| 312 | |
| 313 // GetAlternateProtocol should reorder the AlternateProtocol map. | |
| 314 AlternateProtocolInfo alternate = | |
| 315 impl_.GetAlternateProtocol(test_host_port_pair1); | |
| 316 EXPECT_EQ(443, alternate.port); | |
| 317 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | |
| 318 it = map.begin(); | |
| 319 EXPECT_TRUE(it->first.Equals(test_host_port_pair1)); | |
| 320 EXPECT_EQ(443, it->second.port); | |
| 321 EXPECT_EQ(NPN_SPDY_3, it->second.protocol); | |
| 322 } | |
| 323 | |
| 324 TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) { | |
| 325 HostPortPair test_host_port_pair("foo", 80); | |
| 326 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0); | |
| 327 impl_.SetBrokenAlternateProtocol(test_host_port_pair); | |
| 328 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 329 AlternateProtocolInfo alternate = | |
| 330 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 331 EXPECT_TRUE(alternate.is_broken); | |
| 332 | |
| 333 impl_.SetAlternateProtocol(test_host_port_pair, 1234, NPN_SPDY_3, 1.0); | |
| 334 alternate = impl_.GetAlternateProtocol(test_host_port_pair); | |
| 335 EXPECT_TRUE(alternate.is_broken) << "Second attempt should be ignored."; | |
| 336 } | |
| 337 | |
| 338 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { | |
| 339 HostPortPair test_host_port_pair("foo", 80); | |
| 340 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0); | |
| 341 impl_.SetBrokenAlternateProtocol(test_host_port_pair); | |
| 342 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 343 AlternateProtocolInfo alternate = | |
| 344 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 345 EXPECT_TRUE(alternate.is_broken); | |
| 346 impl_.ClearAlternateProtocol(test_host_port_pair); | |
| 347 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 348 } | |
| 349 | |
| 350 TEST_F(AlternateProtocolServerPropertiesTest, Forced) { | |
| 351 // Test forced alternate protocols. | |
| 352 | |
| 353 AlternateProtocolInfo default_protocol(1234, NPN_SPDY_3, 1); | |
| 354 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol); | |
| 355 | |
| 356 // Verify the forced protocol. | |
| 357 HostPortPair test_host_port_pair("foo", 80); | |
| 358 EXPECT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 359 AlternateProtocolInfo alternate = | |
| 360 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 361 EXPECT_EQ(default_protocol.port, alternate.port); | |
| 362 EXPECT_EQ(default_protocol.protocol, alternate.protocol); | |
| 363 | |
| 364 // Verify the real protocol overrides the forced protocol. | |
| 365 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0); | |
| 366 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 367 alternate = impl_.GetAlternateProtocol(test_host_port_pair); | |
| 368 EXPECT_EQ(443, alternate.port); | |
| 369 EXPECT_EQ(NPN_SPDY_3, alternate.protocol); | |
| 370 | |
| 371 // Turn off the static, forced alternate protocol so that tests don't | |
| 372 // have this state. | |
| 373 HttpServerPropertiesImpl::DisableForcedAlternateProtocol(); | |
| 374 | |
| 375 // Verify the forced protocol is off. | |
| 376 HostPortPair test_host_port_pair2("bar", 80); | |
| 377 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair2)); | |
| 378 } | |
| 379 | |
| 380 TEST_F(AlternateProtocolServerPropertiesTest, Canonical) { | |
| 381 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 382 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 383 | |
| 384 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 385 EXPECT_FALSE(HasAlternateProtocol(canonical_port_pair)); | |
| 386 | |
| 387 AlternateProtocolInfo canonical_protocol(1234, QUIC, 1); | |
| 388 | |
| 389 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 390 canonical_protocol.protocol, 1.0); | |
| 391 // Verify the forced protocol. | |
| 392 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 393 AlternateProtocolInfo alternate = | |
| 394 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 395 EXPECT_EQ(canonical_protocol.port, alternate.port); | |
| 396 EXPECT_EQ(canonical_protocol.protocol, alternate.protocol); | |
| 397 | |
| 398 // Verify the canonical suffix. | |
| 399 EXPECT_EQ(".c.youtube.com", | |
| 400 impl_.GetCanonicalSuffix(test_host_port_pair.host())); | |
| 401 EXPECT_EQ(".c.youtube.com", | |
| 402 impl_.GetCanonicalSuffix(canonical_port_pair.host())); | |
| 403 } | |
| 404 | |
| 405 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBelowThreshold) { | |
| 406 impl_.SetAlternateProtocolProbabilityThreshold(0.02); | |
| 407 | |
| 408 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 409 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 410 AlternateProtocolInfo canonical_protocol(1234, QUIC, 0.01); | |
| 411 | |
| 412 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 413 canonical_protocol.protocol, | |
| 414 canonical_protocol.probability); | |
| 415 EXPECT_FALSE(HasAlternateProtocol(canonical_port_pair)); | |
| 416 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 417 } | |
| 418 | |
| 419 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalAboveThreshold) { | |
| 420 impl_.SetAlternateProtocolProbabilityThreshold(0.02); | |
| 421 | |
| 422 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 423 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 424 AlternateProtocolInfo canonical_protocol(1234, QUIC, 0.03); | |
| 425 | |
| 426 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 427 canonical_protocol.protocol, | |
| 428 canonical_protocol.probability); | |
| 429 EXPECT_TRUE(HasAlternateProtocol(canonical_port_pair)); | |
| 430 EXPECT_TRUE(HasAlternateProtocol(test_host_port_pair)); | |
| 431 } | |
| 432 | |
| 433 TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) { | |
| 434 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 435 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 436 | |
| 437 AlternateProtocolInfo canonical_protocol(1234, QUIC, 1); | |
| 438 | |
| 439 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 440 canonical_protocol.protocol, | |
| 441 canonical_protocol.probability); | |
| 442 | |
| 443 impl_.ClearAlternateProtocol(canonical_port_pair); | |
| 444 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 445 } | |
| 446 | |
| 447 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) { | |
| 448 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 449 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 450 | |
| 451 AlternateProtocolInfo canonical_protocol(1234, QUIC, 1); | |
| 452 | |
| 453 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 454 canonical_protocol.protocol, | |
| 455 canonical_protocol.probability); | |
| 456 | |
| 457 impl_.SetBrokenAlternateProtocol(canonical_port_pair); | |
| 458 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 459 } | |
| 460 | |
| 461 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken2) { | |
| 462 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 463 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 464 | |
| 465 AlternateProtocolInfo canonical_protocol(1234, QUIC, 1); | |
| 466 | |
| 467 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 468 canonical_protocol.protocol, | |
| 469 canonical_protocol.probability); | |
| 470 | |
| 471 impl_.SetBrokenAlternateProtocol(test_host_port_pair); | |
| 472 AlternateProtocolInfo alternate = | |
| 473 impl_.GetAlternateProtocol(test_host_port_pair); | |
| 474 EXPECT_TRUE(alternate.is_broken); | |
| 475 } | |
| 476 | |
| 477 TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) { | |
| 478 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 479 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 480 | |
| 481 AlternateProtocolInfo canonical_protocol(1234, QUIC, 1); | |
| 482 | |
| 483 impl_.SetAlternateProtocol(canonical_port_pair, canonical_protocol.port, | |
| 484 canonical_protocol.protocol, | |
| 485 canonical_protocol.probability); | |
| 486 | |
| 487 impl_.Clear(); | |
| 488 EXPECT_FALSE(HasAlternateProtocol(test_host_port_pair)); | |
| 489 } | |
| 490 | |
| 491 typedef HttpServerPropertiesImplTest SpdySettingsServerPropertiesTest; | |
| 492 | |
| 493 TEST_F(SpdySettingsServerPropertiesTest, Initialize) { | |
| 494 HostPortPair spdy_server_google("www.google.com", 443); | |
| 495 | |
| 496 // Check by initializing empty spdy settings. | |
| 497 SpdySettingsMap spdy_settings_map(SpdySettingsMap::NO_AUTO_EVICT); | |
| 498 impl_.InitializeSpdySettingsServers(&spdy_settings_map); | |
| 499 EXPECT_TRUE(impl_.GetSpdySettings(spdy_server_google).empty()); | |
| 500 | |
| 501 // Check by initializing with www.google.com:443 spdy server settings. | |
| 502 SettingsMap settings_map; | |
| 503 const SpdySettingsIds id = SETTINGS_UPLOAD_BANDWIDTH; | |
| 504 const SpdySettingsFlags flags = SETTINGS_FLAG_PERSISTED; | |
| 505 const uint32 value = 31337; | |
| 506 SettingsFlagsAndValue flags_and_value(flags, value); | |
| 507 settings_map[id] = flags_and_value; | |
| 508 spdy_settings_map.Put(spdy_server_google, settings_map); | |
| 509 impl_.InitializeSpdySettingsServers(&spdy_settings_map); | |
| 510 | |
| 511 const SettingsMap& settings_map2 = impl_.GetSpdySettings(spdy_server_google); | |
| 512 ASSERT_EQ(1U, settings_map2.size()); | |
| 513 SettingsMap::const_iterator it = settings_map2.find(id); | |
| 514 EXPECT_TRUE(it != settings_map2.end()); | |
| 515 SettingsFlagsAndValue flags_and_value2 = it->second; | |
| 516 EXPECT_EQ(flags, flags_and_value2.first); | |
| 517 EXPECT_EQ(value, flags_and_value2.second); | |
| 518 } | |
| 519 | |
| 520 TEST_F(SpdySettingsServerPropertiesTest, SetSpdySetting) { | |
| 521 HostPortPair spdy_server_empty(std::string(), 443); | |
| 522 const SettingsMap& settings_map0 = impl_.GetSpdySettings(spdy_server_empty); | |
| 523 EXPECT_EQ(0U, settings_map0.size()); // Returns kEmptySettingsMap. | |
| 524 | |
| 525 // Add www.google.com:443 as persisting. | |
| 526 HostPortPair spdy_server_google("www.google.com", 443); | |
| 527 const SpdySettingsIds id1 = SETTINGS_UPLOAD_BANDWIDTH; | |
| 528 const SpdySettingsFlags flags1 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 529 const uint32 value1 = 31337; | |
| 530 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_google, id1, flags1, value1)); | |
| 531 // Check the values. | |
| 532 const SettingsMap& settings_map1_ret = | |
| 533 impl_.GetSpdySettings(spdy_server_google); | |
| 534 ASSERT_EQ(1U, settings_map1_ret.size()); | |
| 535 SettingsMap::const_iterator it1_ret = settings_map1_ret.find(id1); | |
| 536 EXPECT_TRUE(it1_ret != settings_map1_ret.end()); | |
| 537 SettingsFlagsAndValue flags_and_value1_ret = it1_ret->second; | |
| 538 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | |
| 539 EXPECT_EQ(value1, flags_and_value1_ret.second); | |
| 540 | |
| 541 // Add mail.google.com:443 as not persisting. | |
| 542 HostPortPair spdy_server_mail("mail.google.com", 443); | |
| 543 const SpdySettingsIds id2 = SETTINGS_DOWNLOAD_BANDWIDTH; | |
| 544 const SpdySettingsFlags flags2 = SETTINGS_FLAG_NONE; | |
| 545 const uint32 value2 = 62667; | |
| 546 EXPECT_FALSE(impl_.SetSpdySetting(spdy_server_mail, id2, flags2, value2)); | |
| 547 const SettingsMap& settings_map2_ret = | |
| 548 impl_.GetSpdySettings(spdy_server_mail); | |
| 549 EXPECT_EQ(0U, settings_map2_ret.size()); // Returns kEmptySettingsMap. | |
| 550 | |
| 551 // Add docs.google.com:443 as persisting | |
| 552 HostPortPair spdy_server_docs("docs.google.com", 443); | |
| 553 const SpdySettingsIds id3 = SETTINGS_ROUND_TRIP_TIME; | |
| 554 const SpdySettingsFlags flags3 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 555 const uint32 value3 = 93997; | |
| 556 SettingsFlagsAndValue flags_and_value3(flags3, value3); | |
| 557 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_docs, id3, flags3, value3)); | |
| 558 // Check the values. | |
| 559 const SettingsMap& settings_map3_ret = | |
| 560 impl_.GetSpdySettings(spdy_server_docs); | |
| 561 ASSERT_EQ(1U, settings_map3_ret.size()); | |
| 562 SettingsMap::const_iterator it3_ret = settings_map3_ret.find(id3); | |
| 563 EXPECT_TRUE(it3_ret != settings_map3_ret.end()); | |
| 564 SettingsFlagsAndValue flags_and_value3_ret = it3_ret->second; | |
| 565 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value3_ret.first); | |
| 566 EXPECT_EQ(value3, flags_and_value3_ret.second); | |
| 567 | |
| 568 // Check data for www.google.com:443 (id1). | |
| 569 const SettingsMap& settings_map4_ret = | |
| 570 impl_.GetSpdySettings(spdy_server_google); | |
| 571 ASSERT_EQ(1U, settings_map4_ret.size()); | |
| 572 SettingsMap::const_iterator it4_ret = settings_map4_ret.find(id1); | |
| 573 EXPECT_TRUE(it4_ret != settings_map4_ret.end()); | |
| 574 SettingsFlagsAndValue flags_and_value4_ret = it4_ret->second; | |
| 575 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value4_ret.first); | |
| 576 EXPECT_EQ(value1, flags_and_value1_ret.second); | |
| 577 | |
| 578 // Clear www.google.com:443 as persisting. | |
| 579 impl_.ClearSpdySettings(spdy_server_google); | |
| 580 // Check the values. | |
| 581 const SettingsMap& settings_map5_ret = | |
| 582 impl_.GetSpdySettings(spdy_server_google); | |
| 583 ASSERT_EQ(0U, settings_map5_ret.size()); | |
| 584 | |
| 585 // Clear all settings. | |
| 586 ASSERT_GT(impl_.spdy_settings_map().size(), 0U); | |
| 587 impl_.ClearAllSpdySettings(); | |
| 588 ASSERT_EQ(0U, impl_.spdy_settings_map().size()); | |
| 589 } | |
| 590 | |
| 591 TEST_F(SpdySettingsServerPropertiesTest, Clear) { | |
| 592 // Add www.google.com:443 as persisting. | |
| 593 HostPortPair spdy_server_google("www.google.com", 443); | |
| 594 const SpdySettingsIds id1 = SETTINGS_UPLOAD_BANDWIDTH; | |
| 595 const SpdySettingsFlags flags1 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 596 const uint32 value1 = 31337; | |
| 597 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_google, id1, flags1, value1)); | |
| 598 // Check the values. | |
| 599 const SettingsMap& settings_map1_ret = | |
| 600 impl_.GetSpdySettings(spdy_server_google); | |
| 601 ASSERT_EQ(1U, settings_map1_ret.size()); | |
| 602 SettingsMap::const_iterator it1_ret = settings_map1_ret.find(id1); | |
| 603 EXPECT_TRUE(it1_ret != settings_map1_ret.end()); | |
| 604 SettingsFlagsAndValue flags_and_value1_ret = it1_ret->second; | |
| 605 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | |
| 606 EXPECT_EQ(value1, flags_and_value1_ret.second); | |
| 607 | |
| 608 // Add docs.google.com:443 as persisting | |
| 609 HostPortPair spdy_server_docs("docs.google.com", 443); | |
| 610 const SpdySettingsIds id3 = SETTINGS_ROUND_TRIP_TIME; | |
| 611 const SpdySettingsFlags flags3 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 612 const uint32 value3 = 93997; | |
| 613 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_docs, id3, flags3, value3)); | |
| 614 // Check the values. | |
| 615 const SettingsMap& settings_map3_ret = | |
| 616 impl_.GetSpdySettings(spdy_server_docs); | |
| 617 ASSERT_EQ(1U, settings_map3_ret.size()); | |
| 618 SettingsMap::const_iterator it3_ret = settings_map3_ret.find(id3); | |
| 619 EXPECT_TRUE(it3_ret != settings_map3_ret.end()); | |
| 620 SettingsFlagsAndValue flags_and_value3_ret = it3_ret->second; | |
| 621 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value3_ret.first); | |
| 622 EXPECT_EQ(value3, flags_and_value3_ret.second); | |
| 623 | |
| 624 impl_.Clear(); | |
| 625 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); | |
| 626 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); | |
| 627 } | |
| 628 | |
| 629 TEST_F(SpdySettingsServerPropertiesTest, MRUOfGetSpdySettings) { | |
| 630 // Add www.google.com:443 as persisting. | |
| 631 HostPortPair spdy_server_google("www.google.com", 443); | |
| 632 const SpdySettingsIds id1 = SETTINGS_UPLOAD_BANDWIDTH; | |
| 633 const SpdySettingsFlags flags1 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 634 const uint32 value1 = 31337; | |
| 635 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_google, id1, flags1, value1)); | |
| 636 | |
| 637 // Add docs.google.com:443 as persisting | |
| 638 HostPortPair spdy_server_docs("docs.google.com", 443); | |
| 639 const SpdySettingsIds id2 = SETTINGS_ROUND_TRIP_TIME; | |
| 640 const SpdySettingsFlags flags2 = SETTINGS_FLAG_PLEASE_PERSIST; | |
| 641 const uint32 value2 = 93997; | |
| 642 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_docs, id2, flags2, value2)); | |
| 643 | |
| 644 // Verify the first element is docs.google.com:443. | |
| 645 const SpdySettingsMap& map = impl_.spdy_settings_map(); | |
| 646 SpdySettingsMap::const_iterator it = map.begin(); | |
| 647 EXPECT_TRUE(it->first.Equals(spdy_server_docs)); | |
| 648 const SettingsMap& settings_map2_ret = it->second; | |
| 649 ASSERT_EQ(1U, settings_map2_ret.size()); | |
| 650 SettingsMap::const_iterator it2_ret = settings_map2_ret.find(id2); | |
| 651 EXPECT_TRUE(it2_ret != settings_map2_ret.end()); | |
| 652 SettingsFlagsAndValue flags_and_value2_ret = it2_ret->second; | |
| 653 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value2_ret.first); | |
| 654 EXPECT_EQ(value2, flags_and_value2_ret.second); | |
| 655 | |
| 656 // GetSpdySettings should reorder the SpdySettingsMap. | |
| 657 const SettingsMap& settings_map1_ret = | |
| 658 impl_.GetSpdySettings(spdy_server_google); | |
| 659 ASSERT_EQ(1U, settings_map1_ret.size()); | |
| 660 SettingsMap::const_iterator it1_ret = settings_map1_ret.find(id1); | |
| 661 EXPECT_TRUE(it1_ret != settings_map1_ret.end()); | |
| 662 SettingsFlagsAndValue flags_and_value1_ret = it1_ret->second; | |
| 663 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | |
| 664 EXPECT_EQ(value1, flags_and_value1_ret.second); | |
| 665 | |
| 666 // Check the first entry is spdy_server_google by accessing it via iterator. | |
| 667 it = map.begin(); | |
| 668 EXPECT_TRUE(it->first.Equals(spdy_server_google)); | |
| 669 const SettingsMap& settings_map1_it_ret = it->second; | |
| 670 ASSERT_EQ(1U, settings_map1_it_ret.size()); | |
| 671 it1_ret = settings_map1_it_ret.find(id1); | |
| 672 EXPECT_TRUE(it1_ret != settings_map1_it_ret.end()); | |
| 673 flags_and_value1_ret = it1_ret->second; | |
| 674 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1_ret.first); | |
| 675 EXPECT_EQ(value1, flags_and_value1_ret.second); | |
| 676 } | |
| 677 | |
| 678 typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest; | |
| 679 | |
| 680 TEST_F(SupportsQuicServerPropertiesTest, Initialize) { | |
| 681 HostPortPair quic_server_google("www.google.com", 443); | |
| 682 | |
| 683 // Check by initializing empty address. | |
| 684 IPAddressNumber initial_address; | |
| 685 impl_.InitializeSupportsQuic(&initial_address); | |
| 686 | |
| 687 IPAddressNumber address; | |
| 688 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | |
| 689 EXPECT_TRUE(address.empty()); | |
| 690 | |
| 691 // Check by initializing with a valid address. | |
| 692 CHECK(ParseIPLiteralToNumber("127.0.0.1", &initial_address)); | |
| 693 impl_.InitializeSupportsQuic(&initial_address); | |
| 694 | |
| 695 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); | |
| 696 EXPECT_EQ(initial_address, address); | |
| 697 } | |
| 698 | |
| 699 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) { | |
| 700 IPAddressNumber address; | |
| 701 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | |
| 702 EXPECT_TRUE(address.empty()); | |
| 703 | |
| 704 IPAddressNumber actual_address; | |
| 705 CHECK(ParseIPLiteralToNumber("127.0.0.1", &actual_address)); | |
| 706 impl_.SetSupportsQuic(true, actual_address); | |
| 707 | |
| 708 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); | |
| 709 EXPECT_EQ(actual_address, address); | |
| 710 | |
| 711 impl_.Clear(); | |
| 712 | |
| 713 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | |
| 714 } | |
| 715 | |
| 716 typedef HttpServerPropertiesImplTest ServerNetworkStatsServerPropertiesTest; | |
| 717 | |
| 718 TEST_F(ServerNetworkStatsServerPropertiesTest, Initialize) { | |
| 719 HostPortPair google_server("www.google.com", 443); | |
| 720 | |
| 721 // Check by initializing empty ServerNetworkStats. | |
| 722 ServerNetworkStatsMap server_network_stats_map( | |
| 723 ServerNetworkStatsMap::NO_AUTO_EVICT); | |
| 724 impl_.InitializeServerNetworkStats(&server_network_stats_map); | |
| 725 const ServerNetworkStats* stats = impl_.GetServerNetworkStats(google_server); | |
| 726 EXPECT_EQ(NULL, stats); | |
| 727 | |
| 728 // Check by initializing with www.google.com:443. | |
| 729 ServerNetworkStats stats1; | |
| 730 stats1.srtt = base::TimeDelta::FromMicroseconds(10); | |
| 731 stats1.bandwidth_estimate = QuicBandwidth::FromBitsPerSecond(100); | |
| 732 server_network_stats_map.Put(google_server, stats1); | |
| 733 impl_.InitializeServerNetworkStats(&server_network_stats_map); | |
| 734 | |
| 735 const ServerNetworkStats* stats2 = impl_.GetServerNetworkStats(google_server); | |
| 736 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); | |
| 737 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); | |
| 738 } | |
| 739 | |
| 740 TEST_F(ServerNetworkStatsServerPropertiesTest, SetServerNetworkStats) { | |
| 741 HostPortPair foo_server("foo", 80); | |
| 742 const ServerNetworkStats* stats = impl_.GetServerNetworkStats(foo_server); | |
| 743 EXPECT_EQ(NULL, stats); | |
| 744 | |
| 745 ServerNetworkStats stats1; | |
| 746 stats1.srtt = base::TimeDelta::FromMicroseconds(10); | |
| 747 stats1.bandwidth_estimate = QuicBandwidth::FromBitsPerSecond(100); | |
| 748 impl_.SetServerNetworkStats(foo_server, stats1); | |
| 749 | |
| 750 const ServerNetworkStats* stats2 = impl_.GetServerNetworkStats(foo_server); | |
| 751 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); | |
| 752 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); | |
| 753 | |
| 754 impl_.Clear(); | |
| 755 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); | |
| 756 EXPECT_EQ(NULL, stats3); | |
| 757 } | |
| 758 | |
| 759 } // namespace | |
| 760 | |
| 761 } // namespace net | |
| OLD | NEW |