aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ResourceCacheTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ResourceCacheTest.cpp')
-rw-r--r--tests/ResourceCacheTest.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 3a11bb9c2e..45946cf7d8 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -212,13 +212,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
return;
}
- GrBackendObject texHandles[3];
+ GrBackendObject texHandles[2];
static const int kW = 100;
static const int kH = 100;
texHandles[0] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
texHandles[1] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
- texHandles[2] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
context->resetContext();
@@ -240,46 +239,26 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
backendTex2, kTopLeft_GrSurfaceOrigin, kNone_GrBackendTextureFlag, 0,
kAdopt_GrWrapOwnership));
- GrBackendTexture backendTex3 = GrTest::CreateBackendTexture(context->contextPriv().getBackend(),
- kW,
- kH,
- kRGBA_8888_GrPixelConfig,
- texHandles[2]);
- sk_sp<GrTexture> adoptedAndCached(context->resourceProvider()->wrapBackendTexture(
- backendTex3, kTopLeft_GrSurfaceOrigin, kNone_GrBackendTextureFlag, 0,
- kAdoptAndCache_GrWrapOwnership));
-
- REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr &&
- adoptedAndCached != nullptr);
- if (!borrowed || !adopted || !adoptedAndCached) {
+ REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
+ if (!borrowed || !adopted) {
return;
}
borrowed.reset(nullptr);
adopted.reset(nullptr);
- adoptedAndCached.reset(nullptr);
context->flush();
bool borrowedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[0]);
bool adoptedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[1]);
- bool adoptedAndCachedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[2]);
REPORTER_ASSERT(reporter, borrowedIsAlive);
REPORTER_ASSERT(reporter, !adoptedIsAlive);
- REPORTER_ASSERT(reporter, adoptedAndCachedIsAlive); // Still alive because it's in the cache
gpu->deleteTestingOnlyBackendTexture(texHandles[0], !borrowedIsAlive);
gpu->deleteTestingOnlyBackendTexture(texHandles[1], !adoptedIsAlive);
- // We can't delete texHandles[2] - we've given control of the lifetime to the context/cache
context->resetContext();
-
- // Purge the cache. This should force texHandles[2] to be deleted
- context->getResourceCache()->purgeAllUnlocked();
- adoptedAndCachedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[2]);
- REPORTER_ASSERT(reporter, !adoptedAndCachedIsAlive);
- gpu->deleteTestingOnlyBackendTexture(texHandles[2], !adoptedAndCachedIsAlive);
}
class TestResource : public GrGpuResource {