Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1154)

Unified Diff: content/browser/appcache/chrome_appcache_service_unittest.cc

Issue 2940023002: TaskScheduler: migrate appcache database over to use it. (Closed)
Patch Set: comments + rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/chrome_appcache_service_unittest.cc
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc
index 7a66a2a7951a591649d7db959dea88b073eefe12..c69ce704d552c4df645c6cd0abdc1ceed04bf272 100644
--- a/content/browser/appcache/chrome_appcache_service_unittest.cc
+++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/appcache/appcache_database.h"
#include "content/browser/appcache/appcache_storage_impl.h"
@@ -64,7 +65,9 @@ class MockURLRequestContextGetter : public net::URLRequestContextGetter {
class ChromeAppCacheServiceTest : public testing::Test {
public:
ChromeAppCacheServiceTest()
- : kProtectedManifestURL(kProtectedManifest),
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::IO),
+ kProtectedManifestURL(kProtectedManifest),
kNormalManifestURL(kNormalManifest),
kSessionOnlyManifestURL(kSessionOnlyManifest),
thread_bundle_(TestBrowserThreadBundle::Options::IO_MAINLOOP) {}
@@ -75,6 +78,7 @@ class ChromeAppCacheServiceTest : public testing::Test {
bool init_storage);
void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service);
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
base::ScopedTempDir temp_dir_;
const GURL kProtectedManifestURL;
const GURL kNormalManifestURL;
@@ -106,14 +110,14 @@ ChromeAppCacheServiceTest::CreateAppCacheServiceImpl(
browser_context_.GetResourceContext(),
base::RetainedRef(mock_request_context_getter), mock_policy));
// Steps needed to initialize the storage of AppCache data.
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
if (init_storage) {
AppCacheStorageImpl* storage =
static_cast<AppCacheStorageImpl*>(
appcache_service->storage());
storage->database_->db_connection();
storage->disk_cache();
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
}
return appcache_service;
}
@@ -149,7 +153,7 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) {
// Test: delete the ChromeAppCacheService
appcache_service = NULL;
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
// Recreate the appcache (for reading the data back)
appcache_service = CreateAppCacheServiceImpl(appcache_path, false);
@@ -169,7 +173,7 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) {
// Delete and let cleanup tasks run prior to returning.
appcache_service = NULL;
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
}
TEST_F(ChromeAppCacheServiceTest, SaveSessionState) {
@@ -189,7 +193,7 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) {
// Test: delete the ChromeAppCacheService
appcache_service = NULL;
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
// Recreate the appcache (for reading the data back)
appcache_service = CreateAppCacheServiceImpl(appcache_path, false);
@@ -209,7 +213,7 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) {
// Delete and let cleanup tasks run prior to returning.
appcache_service = NULL;
- base::RunLoop().RunUntilIdle();
+ scoped_task_environment_.RunUntilIdle();
}
} // namespace content
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698