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

Unified Diff: tests/ResourceCacheTest.cpp

Issue 1448873002: Generate list of GPU contexts outside tests (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-01-gpu-test-context-support
Patch Set: make blurtest for all rendering contexts Created 5 years 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/RecordReplaceDrawTest.cpp ('k') | tests/SRGBReadWritePixelsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ResourceCacheTest.cpp
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 08d36780733afa4ee9ce2f0771bcd2878a9c6b98..ee8d7c7eea7bbe39cdba373b7e9fa1d42b75c4fd 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -30,7 +30,17 @@ static const int gWidth = 640;
static const int gHeight = 480;
////////////////////////////////////////////////////////////////////////////////
-static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanvas* canvas) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, context) {
+ GrSurfaceDesc desc;
+ desc.fConfig = kSkia8888_GrPixelConfig;
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fWidth = gWidth;
+ desc.fHeight = gHeight;
+ SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context,
+ SkSurface::kNo_Budgeted, info));
+ SkCanvas* canvas = surface->getCanvas();
+
const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
SkBitmap src;
@@ -70,7 +80,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanva
context->setResourceCacheLimits(oldMaxNum, oldMaxBytes);
}
-static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* context) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, context) {
GrSurfaceDesc smallDesc;
smallDesc.fFlags = kRenderTarget_GrSurfaceFlag;
smallDesc.fConfig = kSkia8888_GrPixelConfig;
@@ -176,7 +186,7 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
}
}
-static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* context) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, context) {
const GrGpu* gpu = context->getGpu();
// this test is only valid for GL
if (!gpu || !gpu->glContextForTesting()) {
@@ -1284,30 +1294,7 @@ static void test_abandoned(skiatest::Reporter* reporter) {
resource->resourcePriv().removeUniqueKey();
}
-////////////////////////////////////////////////////////////////////////////////
-DEF_GPUTEST(ResourceCache, reporter, factory) {
- for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
- GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
- if (!GrContextFactory::IsRenderingGLContext(glType)) {
- continue;
- }
- GrContext* context = factory->get(glType);
- if (nullptr == context) {
- continue;
- }
- GrSurfaceDesc desc;
- desc.fConfig = kSkia8888_GrPixelConfig;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = gWidth;
- desc.fHeight = gHeight;
- SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context,
- SkSurface::kNo_Budgeted, info));
- test_cache(reporter, context, surface->getCanvas());
- test_stencil_buffers(reporter, context);
- test_wrapped_resources(reporter, context);
- }
-
+DEF_GPUTEST(ResourceCacheMisc, reporter, factory) {
// The below tests create their own mock contexts.
test_no_key(reporter);
test_budgeting(reporter);
« no previous file with comments | « tests/RecordReplaceDrawTest.cpp ('k') | tests/SRGBReadWritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698