| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Generate hosts using the given seed. | 169 // Generate hosts using the given seed. |
| 170 DnsHosts MakeHosts(unsigned seed) { | 170 DnsHosts MakeHosts(unsigned seed) { |
| 171 DnsHosts hosts; | 171 DnsHosts hosts; |
| 172 std::string hosts_content = "127.0.0.1 localhost"; | 172 std::string hosts_content = "127.0.0.1 localhost"; |
| 173 hosts_content.append(seed, '1'); | 173 hosts_content.append(seed, '1'); |
| 174 ParseHosts(hosts_content, &hosts); | 174 ParseHosts(hosts_content, &hosts); |
| 175 EXPECT_FALSE(hosts.empty()); | 175 EXPECT_FALSE(hosts.empty()); |
| 176 return hosts; | 176 return hosts; |
| 177 } | 177 } |
| 178 | 178 |
| 179 virtual void SetUp() override { | 179 void SetUp() override { |
| 180 quit_on_config_ = false; | 180 quit_on_config_ = false; |
| 181 | 181 |
| 182 service_.reset(new TestDnsConfigService()); | 182 service_.reset(new TestDnsConfigService()); |
| 183 service_->WatchConfig(base::Bind(&DnsConfigServiceTest::OnConfigChanged, | 183 service_->WatchConfig(base::Bind(&DnsConfigServiceTest::OnConfigChanged, |
| 184 base::Unretained(this))); | 184 base::Unretained(this))); |
| 185 EXPECT_FALSE(last_config_.IsValid()); | 185 EXPECT_FALSE(last_config_.IsValid()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 DnsConfig last_config_; | 188 DnsConfig last_config_; |
| 189 bool quit_on_config_; | 189 bool quit_on_config_; |
| (...skipping 153 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 |