blob: 461a57a6d6b4cac9aba841c5ded166ec800f4380 [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"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000012
13DEF_GPUTEST(GrContextFactoryTest, reporter, factory) {
commit-bot@chromium.org197845a2013-04-19 13:24:28 +000014 // Reset in case some other test has been using it first.
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000015 factory->destroyContexts();
keyar@chromium.org5bdef292012-08-14 22:02:48 +000016
17 // Before we ask for a context, we expect the GL context to not be there.
18 REPORTER_ASSERT(reporter,
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000019 NULL == factory->getGLContext(GrContextFactory::kNative_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000020
21 // After we ask for a context, we expect that the GL context to be there.
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000022 factory->get(GrContextFactory::kNative_GLContextType);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000023 REPORTER_ASSERT(reporter,
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000024 factory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
keyar@chromium.org5bdef292012-08-14 22:02:48 +000025
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.org4ee16bf2014-01-10 22:08:27 +000029 NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
keyar@chromium.org5bdef292012-08-14 22:02:48 +000030}
31
keyar@chromium.org5bdef292012-08-14 22:02:48 +000032#endif