1 /**************************************************************************
3 * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
5 * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
6 * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
7 * Contact: Roman Marchenko <r.marchenko@samsung.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the
11 * "Software"), to deal in the Software without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sub license, and/or sell copies of the Software, and to
14 * permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
17 * The above copyright notice and this permission notice (including the
18 * next paragraph) shall be included in all copies or substantial portions
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 **************************************************************************/
38 #include <gmock/gmock.h>
40 #include <tbm_bufmgr_int.h>
41 #include <wayland-server-protocol.h>
48 #define TBM_DBG(fmt, args...) tbm_log_print(TBM_LOG_LEVEL_DBG, fmt, ##args)
49 #define TBM_INFO(fmt, args...) tbm_log_print(TBM_LOG_LEVEL_INFO, fmt, ##args)
50 #define TBM_WRN(fmt, args...) tbm_log_print(TBM_LOG_LEVEL_WRN, fmt, ##args)
51 #define TBM_ERR(fmt, args...) tbm_log_print(TBM_LOG_LEVEL_ERR, fmt, ##args)
53 #define TBM_UT_INFO(fmt, args...) tbm_log_print_stdout(TBM_LOG_LEVEL_INFO, fmt, ##args)
54 #define TBM_UT_WRN(fmt, args...) tbm_log_print_stdout(TBM_LOG_LEVEL_WRN, fmt, ##args)
55 #define TBM_UT_ERR(fmt, args...) tbm_log_print_stdout(TBM_LOG_LEVEL_ERR, fmt, ##args)
57 #define TBM_UT_ENTRY() \
58 TBM_INFO("--------------------------------------------- %s", typeid(*this).name())
60 #define TBM_UT_CHECK_FLAG(FLAG) \
63 TBM_UT_INFO(" [ ] not supported");\
67 #define TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error) \
69 if((error == TBM_ERROR_NOT_SUPPORTED)) {\
70 TBM_UT_WRN(" [ SKIPPED ] not supported");\
76 #define TBM_UT_NEVER_GET_HERE() \
78 TBM_UT_INFO("!!! TBM UT NEVER GET HERE !!!");\
80 #define TBM_UT_RETURN_IF_FAIL(cond) { \
82 TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
86 #define TBM_UT_RETURN_FALSE_IF_FAIL(cond) { \
88 TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
92 #define TBM_UT_GOTO_IF_FAIL(cond, dst) { \
94 TBM_UT_ERR("[%s,%d] '%s' failed", __FUNCTION__, __LINE__, #cond); \
99 #define TBM_UT_DUMP_DIR "/tmp/tbm_dump"
100 #define TBM_UT_INVALID_VALUE -42
101 #define TBM_UT_INVALID_UINT_VALUE 99999
102 #define TBM_UT_BO_SIZE 1024
103 #define TBM_UT_SURFACE_QUEUE_SIZE 4
105 using ::testing::Test;
106 using ::testing::TestWithParam;
107 using ::testing::Bool;
108 using ::testing::Values;
109 using ::testing::Combine;
111 class TBMEnv : public Test
118 class TBMBufmgr : public TBMEnv