| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains definitions for mock objects, used for testing. | 5 // This file contains definitions for mock objects, used for testing. |
| 6 | 6 |
| 7 // TODO(apatrick): This file "manually" defines some mock objects. Using gMock | 7 // TODO(apatrick): This file "manually" defines some mock objects. Using gMock |
| 8 // would be definitely preferable, unfortunately it doesn't work on Windows yet. | 8 // would be definitely preferable, unfortunately it doesn't work on Windows yet. |
| 9 | 9 |
| 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ | 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Forwards the SetToken commands to the engine. | 63 // Forwards the SetToken commands to the engine. |
| 64 void SetToken(unsigned int command, | 64 void SetToken(unsigned int command, |
| 65 unsigned int arg_count, | 65 unsigned int arg_count, |
| 66 const void* _args); | 66 const void* _args); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 CommandBufferEngine *engine_; | 69 CommandBufferEngine *engine_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Allows specialized behavior per command in DoCommand. | |
| 73 class SpecializedDoCommandAsyncAPIMock : public AsyncAPIMock { | |
| 74 public: | |
| 75 // Cause DoCommand to sleep more than the GpuScheduler time quantum. | |
| 76 static const unsigned int kTestQuantumCommand = 333; | |
| 77 | |
| 78 SpecializedDoCommandAsyncAPIMock(); | |
| 79 virtual ~SpecializedDoCommandAsyncAPIMock(); | |
| 80 | |
| 81 virtual error::Error DoCommand(unsigned int command, | |
| 82 unsigned int arg_count, | |
| 83 const void* cmd_data); | |
| 84 }; | |
| 85 | |
| 86 namespace gles2 { | 72 namespace gles2 { |
| 87 | 73 |
| 88 class MockShaderTranslator : public ShaderTranslatorInterface { | 74 class MockShaderTranslator : public ShaderTranslatorInterface { |
| 89 public: | 75 public: |
| 90 MockShaderTranslator(); | 76 MockShaderTranslator(); |
| 91 virtual ~MockShaderTranslator(); | 77 virtual ~MockShaderTranslator(); |
| 92 | 78 |
| 93 MOCK_METHOD4(Init, bool( | 79 MOCK_METHOD4(Init, bool( |
| 94 ShShaderType shader_type, | 80 ShShaderType shader_type, |
| 95 ShShaderSpec shader_spec, | 81 ShShaderSpec shader_spec, |
| 96 const ShBuiltInResources* resources, | 82 const ShBuiltInResources* resources, |
| 97 bool implementation_is_glsl_es)); | 83 bool implementation_is_glsl_es)); |
| 98 MOCK_METHOD1(Translate, bool(const char* shader)); | 84 MOCK_METHOD1(Translate, bool(const char* shader)); |
| 99 MOCK_CONST_METHOD0(translated_shader, const char*()); | 85 MOCK_CONST_METHOD0(translated_shader, const char*()); |
| 100 MOCK_CONST_METHOD0(info_log, const char*()); | 86 MOCK_CONST_METHOD0(info_log, const char*()); |
| 101 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); | 87 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); |
| 102 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); | 88 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); |
| 103 }; | 89 }; |
| 104 | 90 |
| 105 } // namespace gles2 | 91 } // namespace gles2 |
| 106 } // namespace gpu | 92 } // namespace gpu |
| 107 | 93 |
| 108 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ | 94 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
| OLD | NEW |