keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 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 | |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 8 | #if SK_SUPPORT_GPU |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 9 | |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 10 | #include "GrContextFactory.h" |
| 11 | #include "Test.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 12 | |
| 13 | DEF_GPUTEST(GrContextFactoryTest, reporter, factory) { |
commit-bot@chromium.org | 197845a | 2013-04-19 13:24:28 +0000 | [diff] [blame] | 14 | // Reset in case some other test has been using it first. |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 15 | factory->destroyContexts(); |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 16 | |
| 17 | // Before we ask for a context, we expect the GL context to not be there. |
| 18 | REPORTER_ASSERT(reporter, |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 19 | NULL == factory->getGLContext(GrContextFactory::kNative_GLContextType)); |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 20 | |
| 21 | // After we ask for a context, we expect that the GL context to be there. |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 22 | factory->get(GrContextFactory::kNative_GLContextType); |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 23 | REPORTER_ASSERT(reporter, |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 24 | factory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL); |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 25 | |
| 26 | // If we did not ask for a context with the particular GL context, we would |
| 27 | // expect the particular GL context to not be there. |
| 28 | REPORTER_ASSERT(reporter, |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 29 | NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType)); |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 30 | } |
| 31 | |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 32 | #endif |