Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: ui/gfx/gl_api_unittest.cc

Issue 1114263002: For dyen: add ui/gl unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/gfx_tests.gyp ('k') | ui/gl/gl_gl_api_implementation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ui/gfx/gfx_tests.gyp ('k') | ui/gl/gl_gl_api_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698