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

Side by Side Diff: gpu/command_buffer/service/feature_info_unittest.cc

Issue 11791032: Refactor FeatureInfo so you can't request features. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/feature_info.h" 5 #include "gpu/command_buffer/service/feature_info.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/service/test_helper.h" 8 #include "gpu/command_buffer/service/test_helper.h"
9 #include "gpu/command_buffer/service/texture_manager.h" 9 #include "gpu/command_buffer/service/texture_manager.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 } // anonymous namespace. 71 } // anonymous namespace.
72 72
73 TEST_F(FeatureInfoTest, Basic) { 73 TEST_F(FeatureInfoTest, Basic) {
74 // Test it starts off uninitialized. 74 // Test it starts off uninitialized.
75 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample); 75 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
76 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives); 76 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives);
77 EXPECT_FALSE(info_->feature_flags().npot_ok); 77 EXPECT_FALSE(info_->feature_flags().npot_ok);
78 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); 78 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
79 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); 79 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
80 EXPECT_FALSE(info_->feature_flags().chromium_webglsl);
81 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external); 80 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external);
82 EXPECT_FALSE(info_->feature_flags().chromium_stream_texture); 81 EXPECT_FALSE(info_->feature_flags().chromium_stream_texture);
83 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source); 82 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source);
84 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order); 83 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order);
85 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle); 84 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle);
86 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays); 85 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays);
87 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean); 86 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean);
88 EXPECT_FALSE(info_->feature_flags( 87 EXPECT_FALSE(info_->feature_flags(
89 ).use_arb_occlusion_query2_for_occlusion_query_boolean); 88 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
90 EXPECT_FALSE(info_->feature_flags( 89 EXPECT_FALSE(info_->feature_flags(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 TEST_F(FeatureInfoTest, InitializeNoExtensions) { 191 TEST_F(FeatureInfoTest, InitializeNoExtensions) {
193 SetupInitExpectations(""); 192 SetupInitExpectations("");
194 info_->Initialize(NULL); 193 info_->Initialize(NULL);
195 // Check default extensions are there 194 // Check default extensions are there
196 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_resource_safe")); 195 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
197 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs")); 196 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
198 EXPECT_THAT(info_->extensions(), 197 EXPECT_THAT(info_->extensions(),
199 HasSubstr("GL_ANGLE_translated_shader_source")); 198 HasSubstr("GL_ANGLE_translated_shader_source"));
200 199
201 // Check a couple of random extensions that should not be there. 200 // Check a couple of random extensions that should not be there.
202 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_CHROMIUM_webglsl")));
203 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_npot"))); 201 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
204 EXPECT_THAT(info_->extensions(), 202 EXPECT_THAT(info_->extensions(),
205 Not(HasSubstr("GL_EXT_texture_compression_dxt1"))); 203 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
206 EXPECT_THAT(info_->extensions(), 204 EXPECT_THAT(info_->extensions(),
207 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3"))); 205 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
208 EXPECT_THAT(info_->extensions(), 206 EXPECT_THAT(info_->extensions(),
209 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5"))); 207 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
210 EXPECT_THAT(info_->extensions(), 208 EXPECT_THAT(info_->extensions(),
211 Not(HasSubstr("GL_ANGLE_texture_usage"))); 209 Not(HasSubstr("GL_ANGLE_texture_usage")));
212 EXPECT_THAT(info_->extensions(), 210 EXPECT_THAT(info_->extensions(),
213 Not(HasSubstr("GL_EXT_texture_storage"))); 211 Not(HasSubstr("GL_EXT_texture_storage")));
214 EXPECT_THAT(info_->extensions(), 212 EXPECT_THAT(info_->extensions(),
215 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"))); 213 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
216 EXPECT_FALSE(info_->feature_flags().npot_ok); 214 EXPECT_FALSE(info_->feature_flags().npot_ok);
217 EXPECT_FALSE(info_->feature_flags().chromium_webglsl);
218 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( 215 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
219 GL_COMPRESSED_RGB_S3TC_DXT1_EXT)); 216 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
220 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( 217 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
221 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)); 218 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
222 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( 219 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
223 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)); 220 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
224 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( 221 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
225 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)); 222 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
226 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( 223 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
227 GL_ETC1_RGB8_OES)); 224 GL_ETC1_RGB8_OES));
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 SetupInitExpectations("GL_OES_standard_derivatives"); 667 SetupInitExpectations("GL_OES_standard_derivatives");
671 info_->Initialize(NULL); 668 info_->Initialize(NULL);
672 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives")); 669 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives"));
673 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives); 670 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives);
674 EXPECT_TRUE(info_->validators()->hint_target.IsValid( 671 EXPECT_TRUE(info_->validators()->hint_target.IsValid(
675 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES)); 672 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
676 EXPECT_TRUE(info_->validators()->g_l_state.IsValid( 673 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
677 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES)); 674 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
678 } 675 }
679 676
680 TEST_F(FeatureInfoTest, InitializeCHROMIUM_webglsl) {
681 SetupInitExpectations("");
682 info_->Initialize("GL_CHROMIUM_webglsl");
683 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_webglsl"));
684 EXPECT_TRUE(info_->feature_flags().chromium_webglsl);
685 }
686
687 TEST_F(FeatureInfoTest, InitializeOES_rgb8_rgba8) { 677 TEST_F(FeatureInfoTest, InitializeOES_rgb8_rgba8) {
688 SetupInitExpectations("GL_OES_rgb8_rgba8"); 678 SetupInitExpectations("GL_OES_rgb8_rgba8");
689 info_->Initialize(NULL); 679 info_->Initialize(NULL);
690 EXPECT_THAT(info_->extensions(), 680 EXPECT_THAT(info_->extensions(),
691 HasSubstr("GL_OES_rgb8_rgba8")); 681 HasSubstr("GL_OES_rgb8_rgba8"));
692 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( 682 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
693 GL_RGB8_OES)); 683 GL_RGB8_OES));
694 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( 684 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
695 GL_RGBA8_OES)); 685 GL_RGBA8_OES));
696 } 686 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) { 794 TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) {
805 SetupInitExpectations("GL_OES_element_index_uint"); 795 SetupInitExpectations("GL_OES_element_index_uint");
806 info_->Initialize(NULL); 796 info_->Initialize(NULL);
807 EXPECT_THAT(info_->extensions(), 797 EXPECT_THAT(info_->extensions(),
808 HasSubstr("GL_OES_element_index_uint")); 798 HasSubstr("GL_OES_element_index_uint"));
809 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT)); 799 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT));
810 } 800 }
811 801
812 } // namespace gles2 802 } // namespace gles2
813 } // namespace gpu 803 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698