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 | |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 10 | #include "GrContextFactory.h" |
| 11 | #include "Test.h" |
| 12 | |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 13 | using namespace sk_gpu_test; |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 14 | |
Brian Salomon | dcfca43 | 2017-11-15 15:48:03 -0500 | [diff] [blame] | 15 | DEF_GPUTEST(GrContext_abandonContext, reporter, options) { |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 16 | for (int testType = 0; testType < 6; ++testType) { |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 17 | for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { |
Brian Salomon | dcfca43 | 2017-11-15 15:48:03 -0500 | [diff] [blame] | 18 | GrContextFactory testFactory(options); |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 19 | GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 20 | ContextInfo info = testFactory.getContextInfo(ctxType); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 21 | if (GrContext* context = info.grContext()) { |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 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 | } |