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/disk_cache/disk_cache_test_base.h" | 5 #include "net/disk_cache/disk_cache_test_base.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 void DiskCacheTestWithCache::AddDelay() { | 223 void DiskCacheTestWithCache::AddDelay() { |
224 base::Time initial = base::Time::Now(); | 224 base::Time initial = base::Time::Now(); |
225 while (base::Time::Now() <= initial) { | 225 while (base::Time::Now() <= initial) { |
226 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); | 226 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); |
227 }; | 227 }; |
228 } | 228 } |
229 | 229 |
230 void DiskCacheTestWithCache::TearDown() { | 230 void DiskCacheTestWithCache::TearDown() { |
231 base::RunLoop().RunUntilIdle(); | 231 base::RunLoop().RunUntilIdle(); |
| 232 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
| 233 base::RunLoop().RunUntilIdle(); |
232 cache_.reset(); | 234 cache_.reset(); |
233 if (cache_thread_.IsRunning()) | 235 if (cache_thread_.IsRunning()) |
234 cache_thread_.Stop(); | 236 cache_thread_.Stop(); |
235 | 237 |
236 if (!memory_only_ && !simple_cache_mode_ && integrity_) { | 238 if (!memory_only_ && !simple_cache_mode_ && integrity_) { |
237 EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_)); | 239 EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_)); |
238 } | 240 } |
239 | 241 |
240 PlatformTest::TearDown(); | 242 PlatformTest::TearDown(); |
241 } | 243 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 if (size_) | 300 if (size_) |
299 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 301 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
300 if (new_eviction_) | 302 if (new_eviction_) |
301 cache_impl_->SetNewEviction(); | 303 cache_impl_->SetNewEviction(); |
302 cache_impl_->SetType(type_); | 304 cache_impl_->SetType(type_); |
303 cache_impl_->SetFlags(flags); | 305 cache_impl_->SetFlags(flags); |
304 net::TestCompletionCallback cb; | 306 net::TestCompletionCallback cb; |
305 int rv = cache_impl_->Init(cb.callback()); | 307 int rv = cache_impl_->Init(cb.callback()); |
306 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 308 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
307 } | 309 } |
OLD | NEW |