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_ |
11 #define GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ | 11 #define GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "gpu/command_buffer/service/cmd_parser.h" | 16 #include "gpu/command_buffer/service/cmd_parser.h" |
17 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 17 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 18 #include "gpu/command_buffer/service/program_cache.h" |
18 #include "gpu/command_buffer/service/shader_translator.h" | 19 #include "gpu/command_buffer/service/shader_translator.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
20 | 21 |
21 namespace gpu { | 22 namespace gpu { |
22 | 23 |
23 // Mocks an AsyncAPIInterface, using GMock. | 24 // Mocks an AsyncAPIInterface, using GMock. |
24 class AsyncAPIMock : public AsyncAPIInterface { | 25 class AsyncAPIMock : public AsyncAPIInterface { |
25 public: | 26 public: |
26 AsyncAPIMock(); | 27 AsyncAPIMock(); |
27 virtual ~AsyncAPIMock(); | 28 virtual ~AsyncAPIMock(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const ShBuiltInResources* resources, | 83 const ShBuiltInResources* resources, |
83 GlslImplementationType glsl_implementation_type, | 84 GlslImplementationType glsl_implementation_type, |
84 GlslBuiltInFunctionBehavior glsl_built_in_function_behavior)); | 85 GlslBuiltInFunctionBehavior glsl_built_in_function_behavior)); |
85 MOCK_METHOD1(Translate, bool(const char* shader)); | 86 MOCK_METHOD1(Translate, bool(const char* shader)); |
86 MOCK_CONST_METHOD0(translated_shader, const char*()); | 87 MOCK_CONST_METHOD0(translated_shader, const char*()); |
87 MOCK_CONST_METHOD0(info_log, const char*()); | 88 MOCK_CONST_METHOD0(info_log, const char*()); |
88 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); | 89 MOCK_CONST_METHOD0(attrib_map, const VariableMap&()); |
89 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); | 90 MOCK_CONST_METHOD0(uniform_map, const VariableMap&()); |
90 }; | 91 }; |
91 | 92 |
| 93 class MockProgramCache : public ProgramCache { |
| 94 public: |
| 95 MockProgramCache(); |
| 96 virtual ~MockProgramCache(); |
| 97 |
| 98 MOCK_CONST_METHOD4(LoadLinkedProgram, ProgramLoadResult( |
| 99 GLuint program, |
| 100 ShaderManager::ShaderInfo* shader_a, |
| 101 ShaderManager::ShaderInfo* shader_b, |
| 102 const LocationMap* bind_attrib_location_map)); |
| 103 |
| 104 MOCK_METHOD4(SaveLinkedProgram, void( |
| 105 GLuint program, |
| 106 const ShaderManager::ShaderInfo* shader_a, |
| 107 const ShaderManager::ShaderInfo* shader_b, |
| 108 const LocationMap* bind_attrib_location_map)); |
| 109 private: |
| 110 MOCK_METHOD0(ClearBackend, void()); |
| 111 }; |
| 112 |
92 } // namespace gles2 | 113 } // namespace gles2 |
93 } // namespace gpu | 114 } // namespace gpu |
94 | 115 |
95 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ | 116 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
OLD | NEW |