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