1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "include/core/SkTypes.h" 9 #include "include/gpu/GrDirectContext.h" 10 #include "tests/CtsEnforcement.h" 11 #include "tests/Test.h" 12 #include "tools/gpu/FenceSync.h" 13 14 struct GrContextOptions; 15 16 using namespace sk_gpu_test; 17 DEF_GANESH_TEST(GrContext_abandonContext,reporter,options,CtsEnforcement::kApiLevel_T)18DEF_GANESH_TEST(GrContext_abandonContext, reporter, options, CtsEnforcement::kApiLevel_T) { 19 for (int testType = 0; testType < 6; ++testType) { 20 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { 21 GrContextFactory testFactory(options); 22 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; 23 ContextInfo info = testFactory.getContextInfo(ctxType); 24 if (auto context = info.directContext()) { 25 switch (testType) { 26 case 0: 27 context->abandonContext(); 28 break; 29 case 1: 30 context->releaseResourcesAndAbandonContext(); 31 break; 32 case 2: 33 context->abandonContext(); 34 context->abandonContext(); 35 break; 36 case 3: 37 context->abandonContext(); 38 context->releaseResourcesAndAbandonContext(); 39 break; 40 case 4: 41 context->releaseResourcesAndAbandonContext(); 42 context->abandonContext(); 43 break; 44 case 5: 45 context->releaseResourcesAndAbandonContext(); 46 context->releaseResourcesAndAbandonContext(); 47 break; 48 } 49 } 50 } 51 } 52 } 53