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

Unified Diff: content/browser/cache_storage/cache_storage_cache_unittest.cc

Issue 1681653002: [CacheStorage] Use backend size to determine change in cache size in put and delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run callbacks immediately Created 4 years, 10 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/cache_storage/cache_storage_cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/cache_storage/cache_storage_cache_unittest.cc
diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc
index 8abda9c383075e695c7dd83bea7a9b2a9e402cb5..e4b94edcfa50587930426e6f1086c77e9b9ab521 100644
--- a/content/browser/cache_storage/cache_storage_cache_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc
@@ -421,6 +421,10 @@ class CacheStorageCacheTest : public testing::Test {
}
int64_t Size() {
+ // Storage notification happens after an operation completes. Let the any
+ // notifications complete before calling Size.
+ base::RunLoop().RunUntilIdle();
+
base::RunLoop run_loop;
cache_->Size(base::Bind(&CacheStorageCacheTest::SizeCallback,
base::Unretained(this), &run_loop));
@@ -934,20 +938,26 @@ TEST_P(CacheStorageCacheTestP, QuotaManagerModified) {
EXPECT_EQ(0, quota_manager_proxy_->notify_storage_modified_count());
EXPECT_TRUE(Put(no_body_request_, no_body_response_));
+ // Storage notification happens after the operation returns, so continue the
+ // event loop.
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, quota_manager_proxy_->notify_storage_modified_count());
EXPECT_LT(0, quota_manager_proxy_->last_notified_delta());
int64_t sum_delta = quota_manager_proxy_->last_notified_delta();
EXPECT_TRUE(Put(body_request_, body_response_));
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(2, quota_manager_proxy_->notify_storage_modified_count());
EXPECT_LT(sum_delta, quota_manager_proxy_->last_notified_delta());
sum_delta += quota_manager_proxy_->last_notified_delta();
EXPECT_TRUE(Delete(body_request_));
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(3, quota_manager_proxy_->notify_storage_modified_count());
sum_delta += quota_manager_proxy_->last_notified_delta();
EXPECT_TRUE(Delete(no_body_request_));
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(4, quota_manager_proxy_->notify_storage_modified_count());
sum_delta += quota_manager_proxy_->last_notified_delta();
« no previous file with comments | « content/browser/cache_storage/cache_storage_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698