Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mock_hwc_composer_device_1.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_
20 #define MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_
21 
22 #include <hardware/hwcomposer.h>
23 #include <gmock/gmock.h>
24 
25 namespace mir
26 {
27 namespace test
28 {
29 namespace doubles
30 {
31 
32 class MockHWCComposerDevice1 : public hwc_composer_device_1
33 {
34 public:
36  {
37  using namespace testing;
38  common.version = HWC_DEVICE_API_VERSION_1_1;
39 
40  registerProcs = hook_registerProcs;
41  eventControl = hook_eventControl;
42  set = hook_set;
43  prepare = hook_prepare;
44  blank = hook_blank;
45  getDisplayConfigs = hook_getDisplayConfigs;
46  getDisplayAttributes = hook_getDisplayAttributes;
47  }
48 
49  static void hook_registerProcs(struct hwc_composer_device_1* mock_hwc, hwc_procs_t const* procs)
50  {
51  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
52  return mocker->registerProcs_interface(mock_hwc, procs);
53  }
54  static int hook_eventControl(struct hwc_composer_device_1* mock_hwc, int disp, int event, int enabled)
55  {
56  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
57  return mocker->eventControl_interface(mock_hwc, disp, event, enabled);
58  }
59  static int hook_set(struct hwc_composer_device_1 *mock_hwc, size_t numDisplays, hwc_display_contents_1_t** displays)
60  {
61  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
62  return mocker->set_interface(mock_hwc, numDisplays, displays);
63  }
64  static int hook_prepare(struct hwc_composer_device_1 *mock_hwc, size_t numDisplays, hwc_display_contents_1_t** displays)
65  {
66  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
67  return mocker->prepare_interface(mock_hwc, numDisplays, displays);
68  }
69  static int hook_blank(struct hwc_composer_device_1 *mock_hwc, int disp, int blank)
70  {
71  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
72  return mocker->blank_interface(mock_hwc, disp, blank);
73  }
74 
75  static int hook_getDisplayConfigs(struct hwc_composer_device_1* mock_hwc, int disp, uint32_t* configs, size_t* numConfigs)
76  {
77  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
78  return mocker->getDisplayConfigs_interface(mock_hwc, disp, configs, numConfigs);
79  }
80 
81  static int hook_getDisplayAttributes(struct hwc_composer_device_1* mock_hwc, int disp, uint32_t config, const uint32_t* attributes, int32_t* values)
82  {
83  MockHWCComposerDevice1* mocker = static_cast<MockHWCComposerDevice1*>(mock_hwc);
84  return mocker->getDisplayAttributes_interface(mock_hwc, disp, config, attributes, values);
85  }
86 
87  MOCK_METHOD2(registerProcs_interface, void(struct hwc_composer_device_1*, hwc_procs_t const*));
88  MOCK_METHOD4(eventControl_interface, int(struct hwc_composer_device_1* dev, int disp, int event, int enabled));
89  MOCK_METHOD3(set_interface, int(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t**));
90  MOCK_METHOD3(prepare_interface, int(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t**));
91  MOCK_METHOD3(blank_interface, int(struct hwc_composer_device_1 *, int, int));
92  MOCK_METHOD4(getDisplayConfigs_interface, int(struct hwc_composer_device_1*, int, uint32_t*, size_t*));
93  MOCK_METHOD5(getDisplayAttributes_interface, int(struct hwc_composer_device_1*, int, uint32_t, const uint32_t*, int32_t*));
94 };
95 
96 }
97 }
98 }
99 
100 #endif /* MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_ */
Definition: mock_hwc_composer_device_1.h:32
static int hook_set(struct hwc_composer_device_1 *mock_hwc, size_t numDisplays, hwc_display_contents_1_t **displays)
Definition: mock_hwc_composer_device_1.h:59
MOCK_METHOD2(registerProcs_interface, void(struct hwc_composer_device_1 *, hwc_procs_t const *))
MOCK_METHOD5(getDisplayAttributes_interface, int(struct hwc_composer_device_1 *, int, uint32_t, const uint32_t *, int32_t *))
static int hook_eventControl(struct hwc_composer_device_1 *mock_hwc, int disp, int event, int enabled)
Definition: mock_hwc_composer_device_1.h:54
MockHWCComposerDevice1()
Definition: mock_hwc_composer_device_1.h:35
static int hook_blank(struct hwc_composer_device_1 *mock_hwc, int disp, int blank)
Definition: mock_hwc_composer_device_1.h:69
static void hook_registerProcs(struct hwc_composer_device_1 *mock_hwc, hwc_procs_t const *procs)
Definition: mock_hwc_composer_device_1.h:49
static int hook_getDisplayAttributes(struct hwc_composer_device_1 *mock_hwc, int disp, uint32_t config, const uint32_t *attributes, int32_t *values)
Definition: mock_hwc_composer_device_1.h:81
static int hook_prepare(struct hwc_composer_device_1 *mock_hwc, size_t numDisplays, hwc_display_contents_1_t **displays)
Definition: mock_hwc_composer_device_1.h:64
MOCK_METHOD3(set_interface, int(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t **))
MOCK_METHOD4(eventControl_interface, int(struct hwc_composer_device_1 *dev, int disp, int event, int enabled))
static int hook_getDisplayConfigs(struct hwc_composer_device_1 *mock_hwc, int disp, uint32_t *configs, size_t *numConfigs)
Definition: mock_hwc_composer_device_1.h:75

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014