| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
| 8 #include <GLES3/gl3.h> | 8 #include <GLES3/gl3.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/strings/string_split.h" |
| 11 #include "gpu/command_buffer/tests/gl_manager.h" | 12 #include "gpu/command_buffer/tests/gl_manager.h" |
| 12 #include "gpu/command_buffer/tests/gl_test_utils.h" | 13 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/gl/gl_switches.h" | 16 #include "ui/gl/gl_switches.h" |
| 16 | 17 |
| 17 #define SHADER_VERSION_300(Src) "#version 300 es\n" #Src | 18 #define SHADER_VERSION_300(Src) "#version 300 es\n" #Src |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 | 21 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 location = glGetFragDataLocation(program, "FragColor"); | 81 location = glGetFragDataLocation(program, "FragColor"); |
| 81 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 82 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 82 EXPECT_EQ(0, location); | 83 EXPECT_EQ(0, location); |
| 83 location = glGetFragDataLocation(program, "Unknown"); | 84 location = glGetFragDataLocation(program, "Unknown"); |
| 84 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 85 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 85 EXPECT_EQ(-1, location); | 86 EXPECT_EQ(-1, location); |
| 86 | 87 |
| 87 glDeleteProgram(program); | 88 glDeleteProgram(program); |
| 88 } | 89 } |
| 89 | 90 |
| 91 TEST_F(OpenGLES3FunctionTest, GetStringiTest) { |
| 92 if (!IsApplicable()) { |
| 93 return; |
| 94 } |
| 95 std::string extensionString = |
| 96 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); |
| 97 std::vector<std::string> extensions = |
| 98 base::SplitString(extensionString, base::kWhitespaceASCII, |
| 99 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 100 int num_extensions = 0; |
| 101 glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); |
| 102 EXPECT_EQ(extensions.size(), static_cast<size_t>(num_extensions)); |
| 103 std::set<std::string> extensions_from_string(extensions.begin(), |
| 104 extensions.end()); |
| 105 std::set<std::string> extensions_from_stringi; |
| 106 for (int i = 0; i < num_extensions; ++i) { |
| 107 extensions_from_stringi.insert( |
| 108 reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))); |
| 109 } |
| 110 EXPECT_EQ(extensions_from_string, extensions_from_stringi); |
| 111 } |
| 112 |
| 90 } // namespace gpu | 113 } // namespace gpu |
| OLD | NEW |