Mir
stub_platform_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 or 3 as
6  * 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_FRAMEWORK_STUB_PLATFORM_HELPERS_H_
20 #define MIR_TEST_FRAMEWORK_STUB_PLATFORM_HELPERS_H_
21 
22 #include "mir/graphics/platform_ipc_package.h"
24 
25 #include <gmock/gmock.h>
26 
27 namespace mir_test_framework
28 {
29 constexpr int stub_data_size{21};
30 constexpr int stub_data_guard{0x0eadbeef};
31 
32 static inline void pack_stub_ipc_package(mir::graphics::PlatformIPCPackage& package)
33 {
34  package.ipc_data = std::vector<int32_t>(stub_data_size, -1);
35  package.ipc_data[0] = stub_data_guard;
36 }
37 
38 static inline void create_stub_platform_package(MirPlatformPackage& package)
39 {
40  ::memset(&package, 0, sizeof(package));
41  package.data_items = stub_data_size;
42  package.data[0] = stub_data_guard;
43 }
44 
45 MATCHER(IsStubPlatformPackage, "")
46 {
47  return (arg.data_items == stub_data_size) &&
48  (arg.data[0] == stub_data_guard) &&
49  (arg.fd_items == 0);
50 }
51 }
52 
53 #endif // MIR_TEST_FRAMEWORK_STUB_PLATFORM_HELPERS_H_
Definition: client_types.h:237
int data[mir_platform_package_max]
Definition: client_types.h:242
MATCHER(IsStubPlatformPackage, "")
Definition: stub_platform_helpers.h:45
constexpr int stub_data_size
Definition: stub_platform_helpers.h:29
constexpr int stub_data_guard
Definition: stub_platform_helpers.h:30
int data_items
Definition: client_types.h:239
Definition: any_surface.h:25

Copyright © 2012-2018 Canonical Ltd.
Generated on Sun Jun 17 06:26:29 UTC 2018