blob: 9ffbd64f9b05a4fe69e17f6460029877b85262da [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
keyar@chromium.org5bdef292012-08-14 22:02:48 +00008#if SK_SUPPORT_GPU
keyar@chromium.org5bdef292012-08-14 22:02:48 +00009
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000010#include "GrContextFactory.h"
11#include "Test.h"
12#include "TestClassDef.h"
13
14DEF_GPUTEST(GrContextFactoryTest, reporter, factory) {
commit-bot@chromium.org197845a2013-04-19 13:24:28 +000015 // Reset in case some other test has been using it first.
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000016 factory->destroyContexts();
keyar@chromium.org5bdef292012-08-14 22:02:48 +000017
18 // Before we ask for a context, we expect the GL context to not be there.
19 REPORTER_ASSERT(reporter,
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000020 NULL == factory->getGLContext(GrContextFactory::kNative_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000021
22 // After we ask for a context, we expect that the GL context to be there.
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000023 factory->get(GrContextFactory::kNative_GLContextType);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000024 REPORTER_ASSERT(reporter,
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000025 factory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000026
27 // If we did not ask for a context with the particular GL context, we would
28 // expect the particular GL context to not be there.
29 REPORTER_ASSERT(reporter,
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000030 NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000031}
32
keyar@chromium.org5bdef292012-08-14 22:02:48 +000033#endif