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 |