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

Unified 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, 8 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+
« 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