diff options
author | 2017-07-06 10:51:32 -0400 | |
---|---|---|
committer | 2017-07-06 15:25:35 +0000 | |
commit | 993e7e25217df05d63c3354c817e8bd18ea3738b (patch) | |
tree | cd1e0979409546c96d5ebfa55e1f62f77c4dc352 /tools/gpu/GrContextFactory.cpp | |
parent | 0c26a9dbd0b6546731df63c01411cb2aaa5ba236 (diff) |
Make mock GrContext unit testable.
Bug: skia:
Change-Id: I959122f1f2c390832ab1033bcdbdd2ca6cfc0419
Reviewed-on: https://skia-review.googlesource.com/20699
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tools/gpu/GrContextFactory.cpp')
-rw-r--r-- | tools/gpu/GrContextFactory.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index 23ffad155f..d614b0643e 100644 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -22,6 +22,7 @@ #endif #include "gl/null/NullGLTestContext.h" #include "gl/GrGLGpu.h" +#include "mock/MockTestContext.h" #include "GrCaps.h" #if defined(SK_BUILD_FOR_WIN32) && defined(SK_ENABLE_DISCRETE_GPU) @@ -220,6 +221,19 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv break; } #endif + case kMock_GrBackend: { + TestContext* sharedContext = masterContext ? masterContext->fTestContext : nullptr; + SkASSERT(kMock_ContextType == type); + if (ContextOverrides::kRequireNVPRSupport & overrides) { + return ContextInfo(); + } + testCtx.reset(CreateMockTestContext(sharedContext)); + if (!testCtx) { + return ContextInfo(); + } + backendContext = testCtx->backendContext(); + break; + } default: return ContextInfo(); } |