aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ResourceCacheTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ResourceCacheTest.cpp')
-rw-r--r--tests/ResourceCacheTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 2af2d69e8e..14705cbb03 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) {