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

Unified Diff: ui/gl/gl_surface_egl_unittest.cc

Issue 2775633006: Add unittests for gl_surface_egl to cover the changes in crrev.com/2698573002. (Closed)
Patch Set: Fix test failure on linux_chromium_chromeos_ozone_rel_ng 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_egl_unittest.cc
diff --git a/ui/gl/gl_surface_egl_unittest.cc b/ui/gl/gl_surface_egl_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bb7c63c60ea16f8ca7305a400150878a3f49aa5a
--- /dev/null
+++ b/ui/gl/gl_surface_egl_unittest.cc
@@ -0,0 +1,40 @@
+// 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 "ui/gl/gl_surface_egl.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/init/gl_factory.h"
+#include "ui/gl/test/gl_surface_test_support.h"
+
+namespace gl {
+
+class GLSurfaceEGLTest : public testing::Test {};
+
+TEST(GLSurfaceEGLTest, SurfaceFormatTest) {
+ GLSurfaceTestSupport::InitializeOneOffImplementation(
+ GLImplementation::kGLImplementationEGLGLES2, true);
+
+ GLSurfaceFormat surface_format = GLSurfaceFormat();
+ surface_format.SetDepthBits(24);
+ surface_format.SetStencilBits(8);
+ surface_format.SetSamples(0);
+ scoped_refptr<GLSurface> surface =
+ 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_LE(24, attrib);
+
+ eglGetConfigAttrib(surface->GetDisplay(), config, EGL_STENCIL_SIZE, &attrib);
+ EXPECT_LE(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