blob: 787f16c983c02b90c873c8ea70f56155e8f5df37 [file] [log] [blame]
keyar@chromium.org5bdef292012-08-14 22:02:48 +00001/*
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
halcanary96fcdcc2015-08-27 07:41:13 -07008#include "SkTypes.h"
9
keyar@chromium.org5bdef292012-08-14 22:02:48 +000010#if SK_SUPPORT_GPU
keyar@chromium.org5bdef292012-08-14 22:02:48 +000011
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000012#include "GrContextFactory.h"
13#include "Test.h"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000014
tfarina9ea53f92014-06-24 06:50:39 -070015DEF_GPUTEST(GrContextFactory, reporter, factory) {
commit-bot@chromium.org197845a2013-04-19 13:24:28 +000016 // Reset in case some other test has been using it first.
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000017 factory->destroyContexts();
keyar@chromium.org5bdef292012-08-14 22:02:48 +000018
19 // Before we ask for a context, we expect the GL context to not be there.
20 REPORTER_ASSERT(reporter,
halcanary96fcdcc2015-08-27 07:41:13 -070021 nullptr == factory->getGLContext(GrContextFactory::kNull_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000022
23 // After we ask for a context, we expect that the GL context to be there.
bsalomone904c092014-07-17 10:50:59 -070024 factory->get(GrContextFactory::kNull_GLContextType);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000025 REPORTER_ASSERT(reporter,
halcanary96fcdcc2015-08-27 07:41:13 -070026 factory->getGLContext(GrContextFactory::kNull_GLContextType) != nullptr);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000027
28 // If we did not ask for a context with the particular GL context, we would
29 // expect the particular GL context to not be there.
30 REPORTER_ASSERT(reporter,
halcanary96fcdcc2015-08-27 07:41:13 -070031 nullptr == factory->getGLContext(GrContextFactory::kDebug_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000032}
33
keyar@chromium.org5bdef292012-08-14 22:02:48 +000034#endif