Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: tests/ImageTest.cpp

Issue 1971613003: Make unit tests use generic testcontext rather than glcontext (Closed) Base URL: https://chromium.googlesource.com/skia.git@vknano
Patch Set: run deferredimage test on vk Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/GrContextFactoryTest.cpp ('k') | tools/gpu/GrContextFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 88f4d7f237ad53bf6fa517b198ca260b0aff8e18..0922364d0fda07742188528c36c1c4ee9a028a3a 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -404,14 +404,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
}
}
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInfo) {
GrContext* context = contextInfo.grContext();
- sk_gpu_test::GLTestContext* glContext = contextInfo.glContext();
+ sk_gpu_test::TestContext* testContext = contextInfo.testContext();
GrContextFactory otherFactory;
- ContextInfo otherContextInfo =
- otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType);
- glContext->makeCurrent();
+ GrContextFactory::ContextType otherContextType =
+ GrContextFactory::NativeContextTypeForBackend(testContext->backend());
+ ContextInfo otherContextInfo = otherFactory.getContextInfo(otherContextType);
+ testContext->makeCurrent();
std::function<sk_sp<SkImage>()> imageFactories[] = {
create_image,
@@ -422,10 +423,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, context
// Create a texture image.
[context] { return create_gpu_image(context); },
// Create a texture image in a another GrContext.
- [glContext, otherContextInfo] {
- otherContextInfo.glContext()->makeCurrent();
+ [testContext, otherContextInfo] {
+ otherContextInfo.testContext()->makeCurrent();
sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext());
- glContext->makeCurrent();
+ testContext->makeCurrent();
return otherContextImage;
}
};
@@ -824,16 +825,16 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) {
}
}
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- sk_gpu_test::GLTestContext* glContext = ctxInfo.glContext();
+ sk_gpu_test::TestContext* testContext = ctxInfo.testContext();
SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
GrContextFactory otherFactory;
ContextInfo otherContextInfo =
otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType);
- glContext->makeCurrent();
+ testContext->makeCurrent();
REPORTER_ASSERT(reporter, proxy);
struct {
std::function<sk_sp<SkImage> ()> fImageFactory;
@@ -845,10 +846,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
{ create_picture_image, false },
{ [context] { return create_gpu_image(context); }, false },
// Create a texture image in a another GrContext.
- { [glContext, otherContextInfo] {
- otherContextInfo.glContext()->makeCurrent();
+ { [testContext, otherContextInfo] {
+ otherContextInfo.testContext()->makeCurrent();
sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext());
- glContext->makeCurrent();
+ testContext->makeCurrent();
return otherContextImage;
}, false },
};
@@ -890,7 +891,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
sk_sp<SkImage> newImage2(SkImage::MakeFromDeferredTextureImageData(
otherContextInfo.grContext(), buffer, budgeted));
REPORTER_ASSERT(reporter, !newImage2);
- glContext->makeCurrent();
+ testContext->makeCurrent();
}
}
sk_free(buffer);
« no previous file with comments | « tests/GrContextFactoryTest.cpp ('k') | tools/gpu/GrContextFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698