| Index: ui/gfx/gl_api_unittest.cc
|
| diff --git a/ui/gfx/gl_api_unittest.cc b/ui/gfx/gl_api_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6674df8d5fb220ded5e937f7e61d0053ca097471
|
| --- /dev/null
|
| +++ b/ui/gfx/gl_api_unittest.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/command_line.h"
|
| +#include "base/strings/string_split.h"
|
| +#include "base/strings/string_util.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/gl/gl_gl_api_implementation.h"
|
| +#include "ui/gl/gl_surface.h"
|
| +#include "ui/gl/gl_switches.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +const GLubyte* FakeGetString(GLenum name) {
|
| + return reinterpret_cast<const GLubyte*>("GL_EXT_foo1 GL_EXT_foo2 GL_EXT_foo3");
|
| +}
|
| +
|
| +class GLApiTest : public testing::Test {
|
| + public:
|
| + void SetUp() override {
|
| + SetGLImplementation(kGLImplementationEGLGLES2);
|
| + driver_.fn.glGetStringFn = &FakeGetString;
|
| + }
|
| +
|
| + void TearDown() override {
|
| + SetGLImplementation(kGLImplementationNone);
|
| + }
|
| +
|
| + const char* GetExtensions() {
|
| + return reinterpret_cast<const char*>(api_.glGetStringFn(GL_EXTENSIONS));
|
| + }
|
| +
|
| + protected:
|
| + DriverGL driver_;
|
| + RealGLApi api_;
|
| +};
|
| +
|
| +TEST_F(GLApiTest, DisabledExtensionsTest) {
|
| + base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
| + command_line.AppendSwitchASCII(switches::kDisableGLExtensions, "GL_EXT_foo2");
|
| + api_.Initialize(&driver_, &command_line);
|
| + const std::string expected("GL_EXT_foo1 GL_EXT_foo3");
|
| + EXPECT_EQ(expected, GetExtensions());
|
| +}
|
| +
|
| +} // namespace gfx
|
| +
|
|
|