| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/connect_interceptor.h" | 5 #include "chrome/browser/net/connect_interceptor.h" |
| 6 | 6 |
| 7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace chrome_browser_net { | 10 namespace chrome_browser_net { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 TEST(ConnectInterceptorTest, TimedCacheEviction) { | 58 TEST(ConnectInterceptorTest, TimedCacheEviction) { |
| 59 // Creat a cache that has a short expiration so that we can force evictions. | 59 // Creat a cache that has a short expiration so that we can force evictions. |
| 60 ConnectInterceptor::TimedCache cache(base::TimeDelta::FromMilliseconds(1)); | 60 ConnectInterceptor::TimedCache cache(base::TimeDelta::FromMilliseconds(1)); |
| 61 | 61 |
| 62 GURL url("http://google.com/anypath"); | 62 GURL url("http://google.com/anypath"); |
| 63 EXPECT_FALSE(cache.WasRecentlySeen(url)); | 63 EXPECT_FALSE(cache.WasRecentlySeen(url)); |
| 64 | 64 |
| 65 cache.SetRecentlySeen(url); | 65 cache.SetRecentlySeen(url); |
| 66 | 66 |
| 67 // Sleep at least long enough to cause an eviction. | 67 // Sleep at least long enough to cause an eviction. |
| 68 base::PlatformThread::Sleep(30); | 68 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(30)); |
| 69 | 69 |
| 70 EXPECT_FALSE(cache.WasRecentlySeen(url)); | 70 EXPECT_FALSE(cache.WasRecentlySeen(url)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace chrome_browser_net. | 73 } // namespace chrome_browser_net. |
| OLD | NEW |