OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Single threaded tests of DnsHostInfo functionality. | 5 // Single threaded tests of DnsHostInfo functionality. |
6 | 6 |
7 #include <time.h> | 7 #include <time.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/platform_thread.h" | 10 #include "base/platform_thread.h" |
11 #include "chrome/browser/net/dns_host_info.h" | 11 #include "chrome/browser/net/dns_host_info.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
| 14 using base::TimeDelta; |
| 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 class DnsHostInfoTest : public testing::Test { | 18 class DnsHostInfoTest : public testing::Test { |
17 }; | 19 }; |
18 | 20 |
19 typedef chrome_browser_net::DnsHostInfo DnsHostInfo; | 21 typedef chrome_browser_net::DnsHostInfo DnsHostInfo; |
20 | 22 |
21 TEST(DnsHostInfoTest, StateChangeTest) { | 23 TEST(DnsHostInfoTest, StateChangeTest) { |
22 DnsHostInfo info_practice, info; | 24 DnsHostInfo info_practice, info; |
23 std::string hostname1("domain1.com"), hostname2("domain2.com"); | 25 std::string hostname1("domain1.com"), hostname2("domain2.com"); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored"; | 87 EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored"; |
86 PlatformThread::Sleep(150); | 88 PlatformThread::Sleep(150); |
87 EXPECT_TRUE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored"; | 89 EXPECT_TRUE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored"; |
88 } | 90 } |
89 | 91 |
90 // TODO(jar): Add death test for illegal state changes, and also for setting | 92 // TODO(jar): Add death test for illegal state changes, and also for setting |
91 // hostname when already set. | 93 // hostname when already set. |
92 | 94 |
93 } // namespace | 95 } // namespace |
94 | 96 |
OLD | NEW |