| OLD | NEW |
| 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/shader_translator.h" | 7 #include "gpu/command_buffer/service/shader_translator.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 &info_log, | 62 &info_log, |
| 63 &translated_source, | 63 &translated_source, |
| 64 &attrib_map, | 64 &attrib_map, |
| 65 &uniform_map, | 65 &uniform_map, |
| 66 &varying_map, | 66 &varying_map, |
| 67 &name_map)); | 67 &name_map)); |
| 68 // Info log must be NULL. | 68 // Info log must be NULL. |
| 69 EXPECT_TRUE(info_log.empty()); | 69 EXPECT_TRUE(info_log.empty()); |
| 70 // Translated shader must be valid and non-empty. | 70 // Translated shader must be valid and non-empty. |
| 71 ASSERT_FALSE(translated_source.empty()); | 71 ASSERT_FALSE(translated_source.empty()); |
| 72 // There should be no attributes, uniforms, varyings. | 72 // There should be no attributes, uniforms, and only one built-in |
| 73 // varying: gl_Position. |
| 73 EXPECT_TRUE(attrib_map.empty()); | 74 EXPECT_TRUE(attrib_map.empty()); |
| 74 EXPECT_TRUE(uniform_map.empty()); | 75 EXPECT_TRUE(uniform_map.empty()); |
| 75 EXPECT_TRUE(varying_map.empty()); | 76 EXPECT_EQ(1u, varying_map.size()); |
| 76 // There should be no name mapping. | 77 // There should be no name mapping. |
| 77 EXPECT_TRUE(name_map.empty()); | 78 EXPECT_TRUE(name_map.empty()); |
| 78 } | 79 } |
| 79 | 80 |
| 80 TEST_F(ShaderTranslatorTest, InvalidVertexShader) { | 81 TEST_F(ShaderTranslatorTest, InvalidVertexShader) { |
| 81 const char* bad_shader = "foo-bar"; | 82 const char* bad_shader = "foo-bar"; |
| 82 const char* good_shader = | 83 const char* good_shader = |
| 83 "void main() {\n" | 84 "void main() {\n" |
| 84 " gl_Position = vec4(1.0);\n" | 85 " gl_Position = vec4(1.0);\n" |
| 85 "}"; | 86 "}"; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 334 |
| 334 EXPECT_EQ(options_1, options_2); | 335 EXPECT_EQ(options_1, options_2); |
| 335 EXPECT_NE(options_1, options_3); | 336 EXPECT_NE(options_1, options_3); |
| 336 EXPECT_NE(options_1, options_4); | 337 EXPECT_NE(options_1, options_4); |
| 337 EXPECT_NE(options_3, options_4); | 338 EXPECT_NE(options_3, options_4); |
| 338 } | 339 } |
| 339 | 340 |
| 340 } // namespace gles2 | 341 } // namespace gles2 |
| 341 } // namespace gpu | 342 } // namespace gpu |
| 342 | 343 |
| OLD | NEW |