skia2/tests/GrGLExtensionsTest.cpp
Robert Phillips 0efc01d540 Revert "Fully delineate GL usage w/ skia_use_gl"
This reverts commit 078cf3e3b2.

Reason for revert: Appears to be blocking the Chrome roll due to Fuchsia build failures

Original change's description:
> Fully delineate GL usage w/ skia_use_gl
> 
> Change-Id: I17424d2235c7a54c4cda036f01a0b99dadc4b632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252085
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=mtklein@google.com,bsalomon@google.com,halcanary@google.com,rosasco@google.com

Change-Id: I17ba79bfe6e7f81c126eddbd50ca5384cfa4179c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253098
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-06 17:19:48 +00:00

49 lines
1.4 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/core/SkTypes.h"
#include "include/gpu/gl/GrGLExtensions.h"
#include "src/gpu/gl/GrGLDefines.h"
#include "tests/Test.h"
const GrGLubyte* simpleGetString(GrGLenum name) {
return (const GrGLubyte*)(name == GR_GL_VERSION ? "3.0" : "");
}
void simpleGetIntegerv(GrGLenum name, GrGLint* params) {
if (name == GR_GL_NUM_EXTENSIONS) {
*params = 2;
} else {
*params = 0;
}
}
const GrGLubyte* simpleGetStringi(GrGLenum name, GrGLuint index) {
if (name != GR_GL_EXTENSIONS || index >= 2)
return (const GrGLubyte*)"";
return (const GrGLubyte*)(index == 0 ? "test_extension_1" : "test_extension_2");
}
DEF_TEST(GrGLExtensionsTest_remove, reporter) {
GrGLExtensions ext;
ext.init(kGL_GrGLStandard,
&simpleGetString,
&simpleGetStringi,
&simpleGetIntegerv,
nullptr,
nullptr);
REPORTER_ASSERT(reporter, ext.isInitialized());
REPORTER_ASSERT(reporter, ext.has("test_extension_1"));
REPORTER_ASSERT(reporter, ext.has("test_extension_2"));
REPORTER_ASSERT(reporter, ext.remove("test_extension_2"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_2"));
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
}