diff --git a/test/storage/cache_size.cpp b/test/storage/cache_size.cpp index 87f033e71..f94c52d23 100644 --- a/test/storage/cache_size.cpp +++ b/test/storage/cache_size.cpp @@ -6,12 +6,11 @@ #include #include #include +#include #include #include -#include - bool tileIsCached(mbgl::SQLiteCache* cache, unsigned id) { using namespace mbgl; @@ -184,7 +183,16 @@ TEST_F(Storage, CacheSizePruneLeastAccessed) { // entry, that should update the // `accessed` time, so it won't get // pruned when we need more space. - sleep(1); + bool done = false; + + util::Timer timer; + timer.start(std::chrono::milliseconds(1300), + Duration::zero(), + [&done] { done = true; }); + + while (!done) { + loop.runOnce(); + } EXPECT_TRUE(tileIsCached(&cache, 7));