Index: tests/ResourceCacheTest.cpp |
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp |
index 2af2d69e8ece7cb0a8cff3471a3a4d56353d2609..14705cbb03bd7394ff69bc7afafad8b30e4991e0 100644 |
--- a/tests/ResourceCacheTest.cpp |
+++ b/tests/ResourceCacheTest.cpp |
@@ -1195,6 +1195,22 @@ static void test_flush(skiatest::Reporter* reporter) { |
} |
REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); |
+ |
+ // Verify that calling flush() on a GrContext with nothing to do will not trigger resource |
+ // eviction. |
+ context->flush(); |
+ for (int i = 0; i < 10; ++i) { |
+ TestResource* r = new TestResource(context->getGpu()); |
+ GrUniqueKey k; |
+ make_unique_key<1>(&k, i); |
+ r->resourcePriv().setUniqueKey(k); |
+ r->unref(); |
+ } |
+ REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); |
+ for (int i = 0; i < 10 * kFlushCount; ++i) { |
+ context->flush(); |
+ } |
+ REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); |
} |
static void test_large_resource_count(skiatest::Reporter* reporter) { |