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/dns_config_service.h" | 5 #include "net/dns/dns_config_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/cancelable_callback.h" | 9 #include "base/cancelable_callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 public: | 114 public: |
115 void OnConfigChanged(const DnsConfig& config) { | 115 void OnConfigChanged(const DnsConfig& config) { |
116 last_config_ = config; | 116 last_config_ = config; |
117 if (quit_on_config_) | 117 if (quit_on_config_) |
118 base::MessageLoop::current()->Quit(); | 118 base::MessageLoop::current()->Quit(); |
119 } | 119 } |
120 | 120 |
121 protected: | 121 protected: |
122 class TestDnsConfigService : public DnsConfigService { | 122 class TestDnsConfigService : public DnsConfigService { |
123 public: | 123 public: |
124 virtual void ReadNow() override {} | 124 void ReadNow() override {} |
125 virtual bool StartWatching() override { return true; } | 125 bool StartWatching() override { return true; } |
126 | 126 |
127 // Expose the protected methods to this test suite. | 127 // Expose the protected methods to this test suite. |
128 void InvalidateConfig() { | 128 void InvalidateConfig() { |
129 DnsConfigService::InvalidateConfig(); | 129 DnsConfigService::InvalidateConfig(); |
130 } | 130 } |
131 | 131 |
132 void InvalidateHosts() { | 132 void InvalidateHosts() { |
133 DnsConfigService::InvalidateHosts(); | 133 DnsConfigService::InvalidateHosts(); |
134 } | 134 } |
135 | 135 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 base::Unretained(this))); | 343 base::Unretained(this))); |
344 base::TimeDelta kTimeout = TestTimeouts::action_max_timeout(); | 344 base::TimeDelta kTimeout = TestTimeouts::action_max_timeout(); |
345 WaitForConfig(kTimeout); | 345 WaitForConfig(kTimeout); |
346 ASSERT_TRUE(last_config_.IsValid()) << "Did not receive DnsConfig in " << | 346 ASSERT_TRUE(last_config_.IsValid()) << "Did not receive DnsConfig in " << |
347 kTimeout.InSecondsF() << "s"; | 347 kTimeout.InSecondsF() << "s"; |
348 } | 348 } |
349 #endif // OS_POSIX || OS_WIN | 349 #endif // OS_POSIX || OS_WIN |
350 | 350 |
351 } // namespace net | 351 } // namespace net |
352 | 352 |
OLD | NEW |