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

Unified Diff: ui/gl/gl_surface_unittest.cc

Issue 2775633006: Add unittests for gl_surface_egl to cover the changes in crrev.com/2698573002. (Closed)
Patch Set: Created 3 years, 9 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/gl/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_unittest.cc
diff --git a/ui/gl/gl_surface_unittest.cc b/ui/gl/gl_surface_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c2b7675c88ddba86379ba63bd8259163f2004e88
--- /dev/null
+++ b/ui/gl/gl_surface_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2017 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 "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface_egl.h"
+#include "ui/gl/init/gl_factory.h"
+#include "ui/gl/test/gl_surface_test_support.h"
+
+namespace gl {
+
+class GLSurfaceTest : public testing::Test {};
+
+TEST_F(GLSurfaceTest, SurfaceFormatTest) {
jbauman 2017/03/24 23:48:48 Use TEST instead of TEST_F.
Lei Lei 2017/03/28 00:40:36 Done.
+ gl::GLSurfaceTestSupport::InitializeOneOffImplementation(
jbauman 2017/03/24 23:48:48 Don't use gl:: in the gl namespace.
Lei Lei 2017/03/28 00:40:36 Done.
+ gl::GLImplementation::kGLImplementationEGLGLES2, true);
+
+ gl::GLSurfaceFormat surface_format = gl::GLSurfaceFormat();
+ surface_format.SetDepthBits(24);
+ surface_format.SetStencilBits(8);
+ surface_format.SetSamples(0);
+ scoped_refptr<gl::GLSurface> surface =
+ gl::init::CreateOffscreenGLSurfaceWithFormat(gfx::Size(1, 1),
+ surface_format);
+ EGLConfig config = surface->GetConfig();
+ EXPECT_TRUE(config);
+
+ EGLint attrib;
+ eglGetConfigAttrib(surface->GetDisplay(), config, EGL_DEPTH_SIZE, &attrib);
+ EXPECT_EQ(24, attrib);
jbauman 2017/03/24 23:48:48 I think these should be EXPECT_LE, as it's possibl
Lei Lei 2017/03/28 00:40:36 Done.
+
+ eglGetConfigAttrib(surface->GetDisplay(), config, EGL_STENCIL_SIZE, &attrib);
+ EXPECT_EQ(8, attrib);
+
+ eglGetConfigAttrib(surface->GetDisplay(), config, EGL_SAMPLES, &attrib);
+ EXPECT_EQ(0, attrib);
+}
+
+} // namespace gl
« no previous file with comments | « ui/gl/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698