aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-01-10 09:57:53 -0500
committerGravatar Mike Klein <mtklein@chromium.org>2018-01-10 17:56:20 +0000
commit5366e59e8826a235d25f34f50ae1b93ee9675663 (patch)
tree5c54a95c62d115993289d05078fc01e5f0106556 /tests
parentb19737d78afd3b5fab247b05fa475b6f6f47f54f (diff)
Add valid checks in places we query isTestingOnlyBackendTexture
Bug: skia:7477 Change-Id: I410427f12c7bb85d11a5e4ed1f09bbd80bbbb54c Reviewed-on: https://skia-review.googlesource.com/93000 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/EGLImageTest.cpp3
-rw-r--r--tests/ResourceCacheTest.cpp5
-rw-r--r--tests/SurfaceTest.cpp7
3 files changed, 11 insertions, 4 deletions
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 9ea6379dc6..efa7de20d7 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -88,7 +88,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
backendTexture1 =
gpu1->createTestingOnlyBackendTexture(nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig,
false, GrMipMapped::kNo);
- if (!gpu1->isTestingOnlyBackendTexture(backendTexture1)) {
+
+ if (!backendTexture1.isValid() || !gpu1->isTestingOnlyBackendTexture(backendTexture1)) {
ERRORF(reporter, "Error creating texture for EGL Image");
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);
return;
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 7b2d835db4..27d197143d 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -211,6 +211,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
backendTextures[1] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH,
kRGBA_8888_GrPixelConfig,
false, GrMipMapped::kNo);
+ REPORTER_ASSERT(reporter, backendTextures[0].isValid());
+ REPORTER_ASSERT(reporter, backendTextures[1].isValid());
+ if (!backendTextures[0].isValid() || !backendTextures[1].isValid()) {
+ return;
+ }
context->resetContext();
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 0864e32380..a07b3361ef 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -592,7 +592,7 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture(
*outTexture = context->getGpu()->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -617,7 +617,7 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
*outTexture = context->getGpu()->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -889,7 +889,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter,
GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
nullptr, kSize, kSize, config, true, GrMipMapped::kNo);
- if (!context->getGpu()->isTestingOnlyBackendTexture(backendTex)) {
+ if (!backendTex.isValid() ||
+ !context->getGpu()->isTestingOnlyBackendTexture(backendTex)) {
return sk_sp<SkSurface>(nullptr);
}
backendTextures.push_back(backendTex);