OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_split.h" |
| 7 #include "base/strings/string_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gl/gl_gl_api_implementation.h" |
| 10 #include "ui/gl/gl_surface.h" |
| 11 #include "ui/gl/gl_switches.h" |
| 12 |
| 13 namespace gfx { |
| 14 |
| 15 const GLubyte* FakeGetString(GLenum name) { |
| 16 return reinterpret_cast<const GLubyte*>("GL_EXT_foo1 GL_EXT_foo2 GL_EXT_foo3")
; |
| 17 } |
| 18 |
| 19 class GLApiTest : public testing::Test { |
| 20 public: |
| 21 void SetUp() override { |
| 22 SetGLImplementation(kGLImplementationEGLGLES2); |
| 23 driver_.fn.glGetStringFn = &FakeGetString; |
| 24 } |
| 25 |
| 26 void TearDown() override { |
| 27 SetGLImplementation(kGLImplementationNone); |
| 28 } |
| 29 |
| 30 const char* GetExtensions() { |
| 31 return reinterpret_cast<const char*>(api_.glGetStringFn(GL_EXTENSIONS)); |
| 32 } |
| 33 |
| 34 protected: |
| 35 DriverGL driver_; |
| 36 RealGLApi api_; |
| 37 }; |
| 38 |
| 39 TEST_F(GLApiTest, DisabledExtensionsTest) { |
| 40 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 41 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, "GL_EXT_foo2"); |
| 42 api_.Initialize(&driver_, &command_line); |
| 43 const std::string expected("GL_EXT_foo1 GL_EXT_foo3"); |
| 44 EXPECT_EQ(expected, GetExtensions()); |
| 45 } |
| 46 |
| 47 } // namespace gfx |
| 48 |
OLD | NEW |