OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_OMX_MOCK_OMX_H_ | |
6 #define MEDIA_OMX_MOCK_OMX_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "testing/gmock/include/gmock/gmock.h" | |
11 #include "third_party/openmax/il/OMX_Component.h" | |
12 #include "third_party/openmax/il/OMX_Core.h" | |
13 | |
14 namespace media { | |
15 | |
16 class MockOmx { | |
17 public: | |
18 MockOmx(); | |
19 virtual ~MockOmx(); | |
20 | |
21 // The following mock methods are component specific. | |
22 MOCK_METHOD3(SendCommand, OMX_ERRORTYPE( | |
23 OMX_COMMANDTYPE command, | |
24 OMX_U32 param1, | |
25 OMX_PTR command_data)); | |
26 | |
27 MOCK_METHOD2(GetParameter, OMX_ERRORTYPE( | |
28 OMX_INDEXTYPE param_index, | |
29 OMX_PTR structure)); | |
30 | |
31 MOCK_METHOD2(SetParameter, OMX_ERRORTYPE( | |
32 OMX_INDEXTYPE param_index, | |
33 OMX_PTR structure)); | |
34 | |
35 MOCK_METHOD2(GetConfig, OMX_ERRORTYPE( | |
36 OMX_INDEXTYPE index, | |
37 OMX_PTR structure)); | |
38 | |
39 MOCK_METHOD2(SetConfig, OMX_ERRORTYPE( | |
40 OMX_INDEXTYPE index, | |
41 OMX_PTR structure)); | |
42 | |
43 MOCK_METHOD4(AllocateBuffer, OMX_ERRORTYPE( | |
44 OMX_BUFFERHEADERTYPE** buffer, | |
45 OMX_U32 port_index, | |
46 OMX_PTR app_private, | |
47 OMX_U32 size_bytes)); | |
48 | |
49 MOCK_METHOD5(UseBuffer, OMX_ERRORTYPE( | |
50 OMX_BUFFERHEADERTYPE** buffer, | |
51 OMX_U32 port_index, | |
52 OMX_PTR app_private, | |
53 OMX_U32 size_bytes, | |
54 OMX_U8* pBuffer)); | |
55 | |
56 MOCK_METHOD2(FreeBuffer, OMX_ERRORTYPE( | |
57 OMX_U32 port_index, | |
58 OMX_BUFFERHEADERTYPE* buffer)); | |
59 | |
60 MOCK_METHOD1(EmptyThisBuffer, OMX_ERRORTYPE( | |
61 OMX_BUFFERHEADERTYPE* buffer)); | |
62 | |
63 MOCK_METHOD1(FillThisBuffer, OMX_ERRORTYPE( | |
64 OMX_BUFFERHEADERTYPE* buffer)); | |
65 | |
66 // The following mock methods are defined global. | |
67 MOCK_METHOD0(Init, OMX_ERRORTYPE()); | |
68 MOCK_METHOD0(Deinit, OMX_ERRORTYPE()); | |
69 | |
70 MOCK_METHOD4(GetHandle, OMX_ERRORTYPE( | |
71 OMX_HANDLETYPE* handle, | |
72 OMX_STRING name, | |
73 OMX_PTR app_private, | |
74 OMX_CALLBACKTYPE* callbacks)); | |
75 | |
76 MOCK_METHOD1(FreeHandle, OMX_ERRORTYPE( | |
77 OMX_HANDLETYPE handle)); | |
78 | |
79 MOCK_METHOD3(GetComponentsOfRole, OMX_ERRORTYPE( | |
80 OMX_STRING name, | |
81 OMX_U32* roles, | |
82 OMX_U8** component_names)); | |
83 | |
84 OMX_CALLBACKTYPE* callbacks() { return &callbacks_; } | |
85 OMX_COMPONENTTYPE* component() { return &component_; } | |
86 | |
87 // Getter for the global instance of MockOmx. | |
88 static MockOmx* get(); | |
89 | |
90 private: | |
91 static MockOmx* instance_; | |
92 | |
93 OMX_CALLBACKTYPE callbacks_; | |
94 OMX_COMPONENTTYPE component_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(MockOmx); | |
97 }; | |
98 | |
99 } // namespace media | |
100 | |
101 #endif // MEDIA_OMX_MOCK_OMX_H_ | |
OLD | NEW |