bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 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 | #if SK_SUPPORT_GPU |
| 11 | |
| 12 | #include "GrContextFactory.h" |
| 13 | #include "Test.h" |
| 14 | |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 15 | using namespace sk_gpu_test; |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 16 | |
| 17 | DEF_GPUTEST(GrContext_abandonContext, reporter, /*factory*/) { |
| 18 | for (int testType = 0; testType < 6; ++testType) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 19 | for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { |
| 20 | GrContextFactory testFactory; |
| 21 | GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 22 | ContextInfo info = testFactory.getContextInfo(ctxType); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 23 | if (GrContext* context = info.grContext()) { |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 24 | switch (testType) { |
| 25 | case 0: |
| 26 | context->abandonContext(); |
| 27 | break; |
| 28 | case 1: |
| 29 | context->releaseResourcesAndAbandonContext(); |
| 30 | break; |
| 31 | case 2: |
| 32 | context->abandonContext(); |
| 33 | context->abandonContext(); |
| 34 | break; |
| 35 | case 3: |
| 36 | context->abandonContext(); |
| 37 | context->releaseResourcesAndAbandonContext(); |
| 38 | break; |
| 39 | case 4: |
| 40 | context->releaseResourcesAndAbandonContext(); |
| 41 | context->abandonContext(); |
| 42 | break; |
| 43 | case 5: |
| 44 | context->releaseResourcesAndAbandonContext(); |
| 45 | context->releaseResourcesAndAbandonContext(); |
| 46 | break; |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | #endif |