| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/cronet/stale_host_resolver.h" | 5 #include "components/cronet/stale_host_resolver.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class StaleHostResolverTest : public testing::Test { | 74 class StaleHostResolverTest : public testing::Test { |
| 75 protected: | 75 protected: |
| 76 StaleHostResolverTest() | 76 StaleHostResolverTest() |
| 77 : mock_proc_(new MockHostResolverProc()), | 77 : mock_proc_(new MockHostResolverProc()), |
| 78 resolver_(nullptr), | 78 resolver_(nullptr), |
| 79 resolve_pending_(false), | 79 resolve_pending_(false), |
| 80 resolve_complete_(false) {} | 80 resolve_complete_(false) {} |
| 81 | 81 |
| 82 ~StaleHostResolverTest() {} | 82 ~StaleHostResolverTest() override {} |
| 83 | 83 |
| 84 void SetStaleDelay(int stale_delay_sec) { | 84 void SetStaleDelay(int stale_delay_sec) { |
| 85 DCHECK(!resolver_); | 85 DCHECK(!resolver_); |
| 86 | 86 |
| 87 options_.delay = base::TimeDelta::FromSeconds(stale_delay_sec); | 87 options_.delay = base::TimeDelta::FromSeconds(stale_delay_sec); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SetStaleUsability(int max_expired_time_sec, | 90 void SetStaleUsability(int max_expired_time_sec, |
| 91 int max_stale_uses, | 91 int max_stale_uses, |
| 92 bool allow_other_network) { | 92 bool allow_other_network) { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 EXPECT_TRUE(resolve_complete()); | 489 EXPECT_TRUE(resolve_complete()); |
| 490 EXPECT_EQ(net::OK, resolve_error()); | 490 EXPECT_EQ(net::OK, resolve_error()); |
| 491 EXPECT_EQ(1u, resolve_addresses().size()); | 491 EXPECT_EQ(1u, resolve_addresses().size()); |
| 492 EXPECT_EQ(kCacheAddress, resolve_addresses()[0].ToStringWithoutPort()); | 492 EXPECT_EQ(kCacheAddress, resolve_addresses()[0].ToStringWithoutPort()); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace | 495 } // namespace |
| 496 | 496 |
| 497 } // namespace cronet | 497 } // namespace cronet |
| OLD | NEW |