diff options
Diffstat (limited to 'tests/GrContextFactoryTest.cpp')
-rw-r--r-- | tests/GrContextFactoryTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index 098b2d61a9..a6291cf42d 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -10,7 +10,9 @@ #if SK_SUPPORT_GPU #include "GrContextFactory.h" +#include "GrContextPriv.h" #include "GrCaps.h" +#include "SkExecutor.h" #include "Test.h" using namespace sk_gpu_test; @@ -139,6 +141,30 @@ DEF_GPUTEST(GrContextFactory_sharedContexts, reporter, /*factory*/) { } } +DEF_GPUTEST(GrContextFactory_executorAndTaskGroup, reporter, /*factory*/) { + // Verify that contexts have a task group iff we supply an executor with context options + GrContextOptions contextOptions; + contextOptions.fExecutor = nullptr; + GrContextFactory serialFactory(contextOptions); + + std::unique_ptr<SkExecutor> threadPool = SkExecutor::MakeThreadPool(1); + contextOptions.fExecutor = threadPool.get(); + GrContextFactory threadedFactory(contextOptions); + + for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { + GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i); + ContextInfo serialInfo = serialFactory.getContextInfo(ctxType); + if (GrContext* serialContext = serialInfo.grContext()) { + REPORTER_ASSERT(reporter, nullptr == serialContext->contextPriv().getTaskGroup()); + } + + ContextInfo threadedInfo = threadedFactory.getContextInfo(ctxType); + if (GrContext* threadedContext = threadedInfo.grContext()) { + REPORTER_ASSERT(reporter, nullptr != threadedContext->contextPriv().getTaskGroup()); + } + } +} + DEF_GPUTEST_FOR_ALL_CONTEXTS(GrContextDump, reporter, ctxInfo) { // Ensure that GrContext::dump doesn't assert (which is possible, if the JSON code is wrong) SkString result = ctxInfo.grContext()->dump(); |