| 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 |
| 72 namespace gles2 { | 86 namespace gles2 { |
| 73 | 87 |
| 74 class MockShaderTranslator : public ShaderTranslatorInterface { | 88 class MockShaderTranslator : public ShaderTranslatorInterface { |
| 75 public: | 89 public: |
| 76 MockShaderTranslator(); | 90 MockShaderTranslator(); |
| 77 virtual ~MockShaderTranslator(); | 91 virtual ~MockShaderTranslator(); |
| 78 | 92 |
| 79 MOCK_METHOD4(Init, bool( | 93 MOCK_METHOD4(Init, bool( |
| 80 ShShaderType shader_type, | 94 ShShaderType shader_type, |
| 81 ShShaderSpec shader_spec, | 95 ShShaderSpec shader_spec, |
| 82 const ShBuiltInResources* resources, | 96 const ShBuiltInResources* resources, |
| 83 bool implementation_is_glsl_es)); | 97 bool implementation_is_glsl_es)); |
| 84 MOCK_METHOD1(Translate, bool(const char* shader)); | 98 MOCK_METHOD1(Translate, bool(const char* shader)); |
| 85 MOCK_CONST_METHOD0(translated_shader, const char*()); | 99 MOCK_CONST_METHOD0(translated_shader, const char*()); |
| 86 MOCK_CONST_METHOD0(info_log, const char*()); | 100 MOCK_CONST_METHOD0(info_log, const char*()); |
| 87 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); | 101 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); |
| 88 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); | 102 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); |
| 89 }; | 103 }; |
| 90 | 104 |
| 91 } // namespace gles2 | 105 } // namespace gles2 |
| 92 } // namespace gpu | 106 } // namespace gpu |
| 93 | 107 |
| 94 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ | 108 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
| OLD | NEW |