diff options
author | jkarlin <jkarlin@chromium.org> | 2014-09-26 07:32:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-26 14:33:02 +0000 |
commit | 80e53817d6d93c7d1136dd3feeb2d4275056360f (patch) | |
tree | 34faa560cec1e855d7fdd4a67e3b9a0614fe5b95 /content/browser | |
parent | 62f3270dc28a7bccc7820ea9fb51f18fd4c74f6e (diff) | |
download | chromium_src-80e53817d6d93c7d1136dd3feeb2d4275056360f.zip chromium_src-80e53817d6d93c7d1136dd3feeb2d4275056360f.tar.gz chromium_src-80e53817d6d93c7d1136dd3feeb2d4275056360f.tar.bz2 |
Flush SimpleCache worker pool between all tests.
This will prevent tests that utilize a SimpleCache from running into teardown leaks.
BUG=413688
Review URL: https://codereview.chromium.org/562203002
Cr-Commit-Position: refs/heads/master@{#296936}
Diffstat (limited to 'content/browser')
4 files changed, 4 insertions, 16 deletions
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index 641056f..0331f03 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc @@ -15,6 +15,7 @@ #include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_restrictions.h" #include "content/public/browser/browser_thread_delegate.h" +#include "net/disk_cache/simple/simple_backend_impl.h" #if defined(OS_ANDROID) #include "base/android/jni_android.h" @@ -141,11 +142,12 @@ void BrowserThreadImpl::ShutdownThreadPool() { } // static -void BrowserThreadImpl::FlushThreadPoolHelper() { +void BrowserThreadImpl::FlushThreadPoolHelperForTesting() { // We don't want to create a pool if none exists. if (g_globals == NULL) return; g_globals.Get().blocking_pool->FlushForTesting(); + disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); } void BrowserThreadImpl::Init() { diff --git a/content/browser/browser_thread_impl.h b/content/browser/browser_thread_impl.h index 167cc3b..1a6d75b 100644 --- a/content/browser/browser_thread_impl.h +++ b/content/browser/browser_thread_impl.h @@ -61,7 +61,7 @@ class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread, // For testing. friend class ContentTestSuiteBaseListener; friend class TestBrowserThreadBundle; - static void FlushThreadPoolHelper(); + static void FlushThreadPoolHelperForTesting(); // The identifier of this thread. Only one thread can exist with a given // identifier at a given time. diff --git a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc index de8a58a..e44618b 100644 --- a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc @@ -12,7 +12,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread_bundle.h" -#include "net/disk_cache/simple/simple_backend_impl.h" #include "net/url_request/url_request_context_getter.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" @@ -53,12 +52,6 @@ class ServiceWorkerCacheStorageManagerTest : public testing::Test { virtual void TearDown() OVERRIDE { base::RunLoop().RunUntilIdle(); - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - base::RunLoop().RunUntilIdle(); - cache_manager_.reset(); - base::RunLoop().RunUntilIdle(); - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - base::RunLoop().RunUntilIdle(); } virtual bool MemoryOnly() { return false; } diff --git a/content/browser/service_worker/service_worker_cache_unittest.cc b/content/browser/service_worker/service_worker_cache_unittest.cc index b4dcc3a..0f3c5ea 100644 --- a/content/browser/service_worker/service_worker_cache_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_unittest.cc @@ -14,7 +14,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread_bundle.h" -#include "net/disk_cache/simple/simple_backend_impl.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -80,12 +79,6 @@ class ServiceWorkerCacheTest : public testing::Test { virtual void TearDown() OVERRIDE { base::RunLoop().RunUntilIdle(); - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - base::RunLoop().RunUntilIdle(); - cache_ = NULL; - base::RunLoop().RunUntilIdle(); - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - base::RunLoop().RunUntilIdle(); } void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { |