diff options
Diffstat (limited to 'gpu/command_buffer/service/program_manager_unittest.cc')
-rw-r--r-- | gpu/command_buffer/service/program_manager_unittest.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc index 3faf14e..4acb7b1 100644 --- a/gpu/command_buffer/service/program_manager_unittest.cc +++ b/gpu/command_buffer/service/program_manager_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "gpu/command_buffer/service/program_manager.h" +#include <algorithm> #include "app/gfx/gl/gl_mock.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -237,9 +238,14 @@ class ProgramManagerWithShaderTest : public testing::Test { .WillOnce(Return(info.location)) .RetiresOnSaturation(); if (info.size > 1) { + std::string base_name = info.name; + size_t array_pos = base_name.rfind("[0]"); + if (base_name.size() > 3 && array_pos == base_name.size() - 3) { + base_name = base_name.substr(0, base_name.size() - 3); + } for (GLsizei jj = 1; jj < info.size; ++jj) { std::string element_name( - std::string(info.name) + "[" + IntToString(jj) + "]"); + std::string(base_name) + "[" + IntToString(jj) + "]"); EXPECT_CALL(*gl_, GetUniformLocation(service_id, StrEq(element_name))) .WillOnce(Return(info.location + jj * 2)) |