Commit f8eb126a authored by Josh Karlin's avatar Josh Karlin Committed by Commit Bot

A second attempt at fixing SimpleCacheCalculateSizeOfEntriesBetween

This is a second attempt to fix a unittest race.

The main thread gets a callback to update its total cache size that is
posted after the cache entry is created. Wait for that to be run
before checking the cache size.

I was able to reproduce the issue this time and can confirm that this
fixes it.

Bug: 1042441
Change-Id: Ic3f0f5a05415ba391be2887a3597c9645faac661
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015738Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734974}
parent 58b557ab
......@@ -2324,6 +2324,7 @@ void DiskCacheBackendTest::BackendCalculateSizeOfEntriesBetween(
ASSERT_THAT(CreateEntry("first", &entry), IsOk());
entry->Close();
FlushQueueForTest();
base::RunLoop().RunUntilIdle();
AddDelay();
Time middle = Time::Now();
......@@ -2334,6 +2335,7 @@ void DiskCacheBackendTest::BackendCalculateSizeOfEntriesBetween(
ASSERT_THAT(CreateEntry("third_entry", &entry), IsOk());
entry->Close();
FlushQueueForTest();
base::RunLoop().RunUntilIdle();
AddDelay();
Time end = Time::Now();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment