blob: dcd18e2fb7a9ab4e45c086abbdade742d69d01a4 [file] [log] [blame]
bsalomon6e2aad42016-04-01 11:54:31 -07001/*
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
bsalomon6e2aad42016-04-01 11:54:31 -070010#include "GrContextFactory.h"
11#include "Test.h"
12
bsalomonf2f1c172016-04-05 12:59:06 -070013using namespace sk_gpu_test;
bsalomon6e2aad42016-04-01 11:54:31 -070014
Brian Salomondcfca432017-11-15 15:48:03 -050015DEF_GPUTEST(GrContext_abandonContext, reporter, options) {
bsalomon6e2aad42016-04-01 11:54:31 -070016 for (int testType = 0; testType < 6; ++testType) {
bsalomon85b4b532016-04-05 11:06:27 -070017 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) {
Brian Salomondcfca432017-11-15 15:48:03 -050018 GrContextFactory testFactory(options);
bsalomon85b4b532016-04-05 11:06:27 -070019 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
bsalomonf2f1c172016-04-05 12:59:06 -070020 ContextInfo info = testFactory.getContextInfo(ctxType);
bsalomon8b7451a2016-05-11 06:33:06 -070021 if (GrContext* context = info.grContext()) {
bsalomon6e2aad42016-04-01 11:54:31 -070022 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}