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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 | 1264 |
1265 // Check by initializing empty address. | 1265 // Check by initializing empty address. |
1266 IPAddress initial_address; | 1266 IPAddress initial_address; |
1267 impl_.InitializeSupportsQuic(&initial_address); | 1267 impl_.InitializeSupportsQuic(&initial_address); |
1268 | 1268 |
1269 IPAddress address; | 1269 IPAddress address; |
1270 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | 1270 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); |
1271 EXPECT_TRUE(address.empty()); | 1271 EXPECT_TRUE(address.empty()); |
1272 | 1272 |
1273 // Check by initializing with a valid address. | 1273 // Check by initializing with a valid address. |
1274 CHECK(IPAddress::FromIPLiteral("127.0.0.1", &initial_address)); | 1274 CHECK(initial_address.AssignFromIPLiteral("127.0.0.1")); |
1275 impl_.InitializeSupportsQuic(&initial_address); | 1275 impl_.InitializeSupportsQuic(&initial_address); |
1276 | 1276 |
1277 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); | 1277 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); |
1278 EXPECT_EQ(initial_address, address); | 1278 EXPECT_EQ(initial_address, address); |
1279 } | 1279 } |
1280 | 1280 |
1281 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) { | 1281 TEST_F(SupportsQuicServerPropertiesTest, SetSupportsQuic) { |
1282 IPAddress address; | 1282 IPAddress address; |
1283 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | 1283 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); |
1284 EXPECT_TRUE(address.empty()); | 1284 EXPECT_TRUE(address.empty()); |
1285 | 1285 |
1286 IPAddress actual_address; | 1286 IPAddress actual_address; |
1287 CHECK(IPAddress::FromIPLiteral("127.0.0.1", &actual_address)); | 1287 CHECK(actual_address.AssignFromIPLiteral("127.0.0.1")); |
1288 impl_.SetSupportsQuic(true, actual_address); | 1288 impl_.SetSupportsQuic(true, actual_address); |
1289 | 1289 |
1290 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); | 1290 EXPECT_TRUE(impl_.GetSupportsQuic(&address)); |
1291 EXPECT_EQ(actual_address, address); | 1291 EXPECT_EQ(actual_address, address); |
1292 | 1292 |
1293 impl_.Clear(); | 1293 impl_.Clear(); |
1294 | 1294 |
1295 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); | 1295 EXPECT_FALSE(impl_.GetSupportsQuic(&address)); |
1296 } | 1296 } |
1297 | 1297 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); | 1484 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); |
1485 | 1485 |
1486 impl_.Clear(); | 1486 impl_.Clear(); |
1487 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); | 1487 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); |
1488 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); | 1488 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); |
1489 } | 1489 } |
1490 | 1490 |
1491 } // namespace | 1491 } // namespace |
1492 | 1492 |
1493 } // namespace net | 1493 } // namespace net |
OLD | NEW |