Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: tests/GrContextFactoryTest.cpp

Issue 1971613003: Make unit tests use generic testcontext rather than glcontext (Closed) Base URL: https://chromium.googlesource.com/skia.git@vknano
Patch Set: run deferredimage test on vk Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/ImageTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { 73 DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) {
74 GrContextFactory testFactory; 74 GrContextFactory testFactory;
75 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { 75 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) {
76 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; 76 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
77 ContextInfo info1 = testFactory.getContextInfo(ctxType); 77 ContextInfo info1 = testFactory.getContextInfo(ctxType);
78 if (!info1.grContext()) { 78 if (!info1.grContext()) {
79 continue; 79 continue;
80 } 80 }
81 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { 81 REPORTER_ASSERT(reporter, info1.testContext());
82 REPORTER_ASSERT(reporter, info1.glContext());
83 }
84 // Ref for comparison. The API does not explicitly say that this stays alive. 82 // Ref for comparison. The API does not explicitly say that this stays alive.
85 info1.grContext()->ref(); 83 info1.grContext()->ref();
86 testFactory.abandonContexts(); 84 testFactory.abandonContexts();
87 85
88 // Test that we get different context after abandon. 86 // Test that we get different context after abandon.
89 ContextInfo info2 = testFactory.getContextInfo(ctxType); 87 ContextInfo info2 = testFactory.getContextInfo(ctxType);
90 REPORTER_ASSERT(reporter, info2.grContext()); 88 REPORTER_ASSERT(reporter, info2.grContext());
91 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { 89 REPORTER_ASSERT(reporter, info2.testContext());
92 REPORTER_ASSERT(reporter, info2.glContext()); 90
93 }
94 REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext()); 91 REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext());
95 // The GL context should also change, but it also could get the same add ress. 92 // The GL context should also change, but it also could get the same add ress.
96 93
97 info1.grContext()->unref(); 94 info1.grContext()->unref();
98 } 95 }
99 } 96 }
100 97
101 #endif 98 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698