| 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 "gpu/command_buffer/service/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 const UniformMap empty_uniform_map; | 754 const UniformMap empty_uniform_map; |
| 755 const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ? | 755 const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ? |
| 756 expected_uniform_map : &empty_uniform_map; | 756 expected_uniform_map : &empty_uniform_map; |
| 757 const VaryingMap empty_varying_map; | 757 const VaryingMap empty_varying_map; |
| 758 const VaryingMap* varying_map = (expected_varying_map && expected_valid) ? | 758 const VaryingMap* varying_map = (expected_varying_map && expected_valid) ? |
| 759 expected_varying_map : &empty_varying_map; | 759 expected_varying_map : &empty_varying_map; |
| 760 const NameMap empty_name_map; | 760 const NameMap empty_name_map; |
| 761 const NameMap* name_map = (expected_name_map && expected_valid) ? | 761 const NameMap* name_map = (expected_name_map && expected_valid) ? |
| 762 expected_name_map : &empty_name_map; | 762 expected_name_map : &empty_name_map; |
| 763 | 763 |
| 764 MockShaderTranslator translator; | 764 MockShaderTranslator* mock_translator = new MockShaderTranslator; |
| 765 EXPECT_CALL(translator, Translate(_, | 765 scoped_refptr<ShaderTranslatorInterface> translator(mock_translator); |
| 766 NotNull(), // log_info | 766 EXPECT_CALL(*mock_translator, Translate(_, |
| 767 NotNull(), // translated_source | 767 NotNull(), // log_info |
| 768 NotNull(), // attrib_map | 768 NotNull(), // translated_source |
| 769 NotNull(), // uniform_map | 769 NotNull(), // attrib_map |
| 770 NotNull(), // varying_map | 770 NotNull(), // uniform_map |
| 771 NotNull())) // name_map | 771 NotNull(), // varying_map |
| 772 NotNull())) // name_map |
| 772 .WillOnce(DoAll(SetArgumentPointee<1>(*log_info), | 773 .WillOnce(DoAll(SetArgumentPointee<1>(*log_info), |
| 773 SetArgumentPointee<2>(*translated_source), | 774 SetArgumentPointee<2>(*translated_source), |
| 774 SetArgumentPointee<3>(*attrib_map), | 775 SetArgumentPointee<3>(*attrib_map), |
| 775 SetArgumentPointee<4>(*uniform_map), | 776 SetArgumentPointee<4>(*uniform_map), |
| 776 SetArgumentPointee<5>(*varying_map), | 777 SetArgumentPointee<5>(*varying_map), |
| 777 SetArgumentPointee<6>(*name_map), | 778 SetArgumentPointee<6>(*name_map), |
| 778 Return(expected_valid))) | 779 Return(expected_valid))) |
| 779 .RetiresOnSaturation(); | 780 .RetiresOnSaturation(); |
| 780 if (expected_valid) { | 781 if (expected_valid) { |
| 781 EXPECT_CALL(*gl, ShaderSource(shader->service_id(), 1, _, NULL)) | 782 EXPECT_CALL(*gl, ShaderSource(shader->service_id(), 1, _, NULL)) |
| 782 .Times(1) | 783 .Times(1) |
| 783 .RetiresOnSaturation(); | 784 .RetiresOnSaturation(); |
| 784 EXPECT_CALL(*gl, CompileShader(shader->service_id())) | 785 EXPECT_CALL(*gl, CompileShader(shader->service_id())) |
| 785 .Times(1) | 786 .Times(1) |
| 786 .RetiresOnSaturation(); | 787 .RetiresOnSaturation(); |
| 787 EXPECT_CALL(*gl, GetShaderiv(shader->service_id(), | 788 EXPECT_CALL(*gl, GetShaderiv(shader->service_id(), |
| 788 GL_COMPILE_STATUS, | 789 GL_COMPILE_STATUS, |
| 789 NotNull())) // status | 790 NotNull())) // status |
| 790 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) | 791 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) |
| 791 .RetiresOnSaturation(); | 792 .RetiresOnSaturation(); |
| 792 } | 793 } |
| 793 shader->RequestCompile(); | 794 shader->RequestCompile(translator, Shader::kGL); |
| 794 shader->DoCompile(&translator, Shader::kGL); | 795 shader->DoCompile(); |
| 795 } | 796 } |
| 796 | 797 |
| 797 // static | 798 // static |
| 798 void TestHelper::SetShaderStates( | 799 void TestHelper::SetShaderStates( |
| 799 ::gfx::MockGLInterface* gl, Shader* shader, bool valid) { | 800 ::gfx::MockGLInterface* gl, Shader* shader, bool valid) { |
| 800 SetShaderStates(gl, shader, valid, NULL, NULL, NULL, NULL, NULL, NULL); | 801 SetShaderStates(gl, shader, valid, NULL, NULL, NULL, NULL, NULL, NULL); |
| 801 } | 802 } |
| 802 | 803 |
| 803 // static | 804 // static |
| 804 sh::Attribute TestHelper::ConstructAttribute( | 805 sh::Attribute TestHelper::ConstructAttribute( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 830 gfx::SetGLImplementation(implementation); | 831 gfx::SetGLImplementation(implementation); |
| 831 } | 832 } |
| 832 | 833 |
| 833 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 834 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
| 834 gfx::SetGLImplementation(old_implementation_); | 835 gfx::SetGLImplementation(old_implementation_); |
| 835 } | 836 } |
| 836 | 837 |
| 837 } // namespace gles2 | 838 } // namespace gles2 |
| 838 } // namespace gpu | 839 } // namespace gpu |
| 839 | 840 |
| OLD | NEW |