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 10 #include "include/gpu/GrDirectContext.h" 11 #include "tests/Test.h" 12 #include "tools/gpu/GrContextFactory.h" 13 14 using namespace sk_gpu_test; 15 DEF_GPUTEST(GrContext_abandonContext,reporter,options)16DEF_GPUTEST(GrContext_abandonContext, reporter, options) { 17 for (int testType = 0; testType < 6; ++testType) { 18 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { 19 GrContextFactory testFactory(options); 20 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; 21 ContextInfo info = testFactory.getContextInfo(ctxType); 22 if (auto context = info.directContext()) { 23 switch (testType) { 24 case 0: 25 context->abandonContext(); 26 break; 27 case 1: 28 context->releaseResourcesAndAbandonContext(); 29 break; 30 case 2: 31 context->abandonContext(); 32 context->abandonContext(); 33 break; 34 case 3: 35 context->abandonContext(); 36 context->releaseResourcesAndAbandonContext(); 37 break; 38 case 4: 39 context->releaseResourcesAndAbandonContext(); 40 context->abandonContext(); 41 break; 42 case 5: 43 context->releaseResourcesAndAbandonContext(); 44 context->releaseResourcesAndAbandonContext(); 45 break; 46 } 47 } 48 } 49 } 50 } 51