OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
7 | 7 |
| 8 #include "gpu/command_buffer/service/feature_info.h" |
8 #include "gpu/command_buffer/tests/gl_manager.h" | 9 #include "gpu/command_buffer/tests/gl_manager.h" |
9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 10 #include "gpu/command_buffer/tests/gl_test_utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace gpu { | 14 namespace gpu { |
14 | 15 |
15 class GLTest : public testing::Test { | 16 class GLTest : public testing::Test { |
16 protected: | 17 protected: |
17 void SetUp() override { gl_.Initialize(GLManager::Options()); } | 18 void SetUp() override { gl_.Initialize(GLManager::Options()); } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 uint8 expected_clear[] = { 127, 0, 255, 0, }; | 83 uint8 expected_clear[] = { 127, 0, 255, 0, }; |
83 glClearColor(0.5f, 0.0f, 1.0f, 0.0f); | 84 glClearColor(0.5f, 0.0f, 1.0f, 0.0f); |
84 glClear(GL_COLOR_BUFFER_BIT); | 85 glClear(GL_COLOR_BUFFER_BIT); |
85 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1, expected_clear)); | 86 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1, expected_clear)); |
86 uint8 expected_draw[] = { 0, 255, 0, 255, }; | 87 uint8 expected_draw[] = { 0, 255, 0, 255, }; |
87 glDrawArrays(GL_TRIANGLES, 0, 6); | 88 glDrawArrays(GL_TRIANGLES, 0, 6); |
88 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_draw)); | 89 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_draw)); |
89 } | 90 } |
90 | 91 |
| 92 TEST_F(GLTest, FeatureFlagsMatchCapabilities) { |
| 93 scoped_refptr<gles2::FeatureInfo> features = new gles2::FeatureInfo; |
| 94 EXPECT_TRUE(features->Initialize()); |
| 95 const auto& caps = gl_.GetCapabilities(); |
| 96 const auto& flags = features->feature_flags(); |
| 97 EXPECT_EQ(caps.egl_image_external, flags.oes_egl_image_external); |
| 98 EXPECT_EQ(caps.texture_format_bgra8888, flags.ext_texture_format_bgra8888); |
| 99 EXPECT_EQ(caps.texture_format_etc1, flags.oes_compressed_etc1_rgb8_texture); |
| 100 EXPECT_EQ(caps.texture_rectangle, flags.arb_texture_rectangle); |
| 101 EXPECT_EQ(caps.texture_usage, flags.angle_texture_usage); |
| 102 EXPECT_EQ(caps.texture_storage, flags.ext_texture_storage); |
| 103 EXPECT_EQ(caps.discard_framebuffer, flags.ext_discard_framebuffer); |
| 104 EXPECT_EQ(caps.sync_query, flags.chromium_sync_query); |
| 105 EXPECT_EQ(caps.blend_equation_advanced, flags.blend_equation_advanced); |
| 106 EXPECT_EQ(caps.blend_equation_advanced_coherent, |
| 107 flags.blend_equation_advanced_coherent); |
| 108 EXPECT_EQ(caps.texture_rg, flags.ext_texture_rg); |
| 109 } |
| 110 |
91 TEST_F(GLTest, GetString) { | 111 TEST_F(GLTest, GetString) { |
92 EXPECT_STREQ( | 112 EXPECT_STREQ( |
93 "OpenGL ES 2.0 Chromium", | 113 "OpenGL ES 2.0 Chromium", |
94 reinterpret_cast<const char*>(glGetString(GL_VERSION))); | 114 reinterpret_cast<const char*>(glGetString(GL_VERSION))); |
95 EXPECT_STREQ( | 115 EXPECT_STREQ( |
96 "OpenGL ES GLSL ES 1.0 Chromium", | 116 "OpenGL ES GLSL ES 1.0 Chromium", |
97 reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION))); | 117 reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION))); |
98 EXPECT_STREQ( | 118 EXPECT_STREQ( |
99 "Chromium", | 119 "Chromium", |
100 reinterpret_cast<const char*>(glGetString(GL_RENDERER))); | 120 reinterpret_cast<const char*>(glGetString(GL_RENDERER))); |
101 EXPECT_STREQ( | 121 EXPECT_STREQ( |
102 "Chromium", | 122 "Chromium", |
103 reinterpret_cast<const char*>(glGetString(GL_VENDOR))); | 123 reinterpret_cast<const char*>(glGetString(GL_VENDOR))); |
104 } | 124 } |
105 | 125 |
106 } // namespace gpu | 126 } // namespace gpu |
107 | 127 |
OLD | NEW |