| 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/dns/host_cache.h" | 5 #include "net/dns/host_cache.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 }, | 353 }, |
| 354 { | 354 { |
| 355 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, | 355 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, |
| 356 HOST_RESOLVER_CANONNAME), | 356 HOST_RESOLVER_CANONNAME), |
| 357 HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, | 357 HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, |
| 358 HOST_RESOLVER_CANONNAME), | 358 HOST_RESOLVER_CANONNAME), |
| 359 -1 | 359 -1 |
| 360 }, | 360 }, |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 363 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 364 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i)); | 364 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i)); |
| 365 | 365 |
| 366 const HostCache::Key& key1 = tests[i].key1; | 366 const HostCache::Key& key1 = tests[i].key1; |
| 367 const HostCache::Key& key2 = tests[i].key2; | 367 const HostCache::Key& key2 = tests[i].key2; |
| 368 | 368 |
| 369 switch (tests[i].expected_comparison) { | 369 switch (tests[i].expected_comparison) { |
| 370 case -1: | 370 case -1: |
| 371 EXPECT_TRUE(key1 < key2); | 371 EXPECT_TRUE(key1 < key2); |
| 372 EXPECT_FALSE(key2 < key1); | 372 EXPECT_FALSE(key2 < key1); |
| 373 break; | 373 break; |
| 374 case 0: | 374 case 0: |
| 375 EXPECT_FALSE(key1 < key2); | 375 EXPECT_FALSE(key1 < key2); |
| 376 EXPECT_FALSE(key2 < key1); | 376 EXPECT_FALSE(key2 < key1); |
| 377 break; | 377 break; |
| 378 case 1: | 378 case 1: |
| 379 EXPECT_FALSE(key1 < key2); | 379 EXPECT_FALSE(key1 < key2); |
| 380 EXPECT_TRUE(key2 < key1); | 380 EXPECT_TRUE(key2 < key1); |
| 381 break; | 381 break; |
| 382 default: | 382 default: |
| 383 FAIL() << "Invalid expectation. Can be only -1, 0, 1"; | 383 FAIL() << "Invalid expectation. Can be only -1, 0, 1"; |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace net | 388 } // namespace net |
| OLD | NEW |