OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 18 matching lines...) Expand all Loading... |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 // This file contains definitions for mock objects, used for testing. | 33 // This file contains definitions for mock objects, used for testing. |
34 | 34 |
35 // TODO: This file "manually" defines some mock objects. Using gMock | 35 // TODO: This file "manually" defines some mock objects. Using gMock |
36 // would be definitely preferable, unfortunately it doesn't work on Windows | 36 // would be definitely preferable, unfortunately it doesn't work on Windows |
37 // yet. | 37 // yet. |
38 | 38 |
39 #ifndef GPU_COMMAND_BUFFER_SERVICE_CROSS_MOCKS_H_ | 39 #ifndef GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
40 #define GPU_COMMAND_BUFFER_SERVICE_CROSS_MOCKS_H_ | 40 #define GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
41 | 41 |
42 #include <vector> | 42 #include <vector> |
43 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
44 #include "gpu/command_buffer/service/cmd_parser.h" | 44 #include "gpu/command_buffer/service/cmd_parser.h" |
45 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 45 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
46 | 46 |
47 namespace command_buffer { | 47 namespace gpu { |
48 | 48 |
49 // Mocks an AsyncAPIInterface, using GMock. | 49 // Mocks an AsyncAPIInterface, using GMock. |
50 class AsyncAPIMock : public AsyncAPIInterface { | 50 class AsyncAPIMock : public AsyncAPIInterface { |
51 public: | 51 public: |
52 AsyncAPIMock() { | 52 AsyncAPIMock() { |
53 testing::DefaultValue<parse_error::ParseError>::Set( | 53 testing::DefaultValue<parse_error::ParseError>::Set( |
54 parse_error::kParseNoError); | 54 parse_error::kParseNoError); |
55 } | 55 } |
56 | 56 |
57 // Predicate that matches args passed to DoCommand, by looking at the values. | 57 // Predicate that matches args passed to DoCommand, by looking at the values. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK_EQ(1u, command); | 96 DCHECK_EQ(1u, command); |
97 DCHECK_EQ(1u, arg_count); | 97 DCHECK_EQ(1u, arg_count); |
98 const CommandBufferEntry* args = | 98 const CommandBufferEntry* args = |
99 static_cast<const CommandBufferEntry*>(_args); | 99 static_cast<const CommandBufferEntry*>(_args); |
100 engine_->set_token(args[0].value_uint32); | 100 engine_->set_token(args[0].value_uint32); |
101 } | 101 } |
102 private: | 102 private: |
103 CommandBufferEngine *engine_; | 103 CommandBufferEngine *engine_; |
104 }; | 104 }; |
105 | 105 |
106 } // namespace command_buffer | 106 } // namespace gpu |
107 | 107 |
108 #endif // GPU_COMMAND_BUFFER_SERVICE_CROSS_MOCKS_H_ | 108 #endif // GPU_COMMAND_BUFFER_SERVICE_MOCKS_H_ |
OLD | NEW |