Initialize Tizen 2.3
[framework/system/deviced.git] / test / testcase / utc_system_deviced_control.c
1 /*
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of SAMSUNG
7  * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
8  * this software is owned by Samsung and you shall not disclose such
9  * Confidential Information and shall use it only in accordance with the terms
10  * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
11  * make no representations or warranties about the suitability of the software,
12  * either express or implied, including but not limited to the implied
13  * warranties of merchantability, fitness for a particular purpose, or
14  * non-infringement. SAMSUNG shall not be liable for any damages suffered by
15  * licensee arising out of or related to this software.
16  *
17  */
18 #include <tet_api.h>
19 #include <dd-control.h>
20
21 #define API_NAME_DEVICED_MMC_CONTROL "deviced_mmc_control"
22 #define API_NAME_DEVICED_USB_CONTROL "deviced_usb_control"
23 #define API_NAME_DEVICED_GET_USB_CONTROL "deviced_get_usb_control"
24 #define API_NAME_DEVICED_RGBLED_CONTROL "deviced_rgbled_control"
25
26 static void startup(void);
27 static void cleanup(void);
28
29 void (*tet_startup)(void) = startup;
30 void (*tet_cleanup)(void) = cleanup;
31
32
33 static void utc_system_deviced_deviced_mmc_control_p_1(void);
34 static void utc_system_deviced_deviced_mmc_control_p_2(void);
35 static void utc_system_deviced_deviced_usb_control_p_1(void);
36 static void utc_system_deviced_deviced_usb_control_p_2(void);
37 static void utc_system_deviced_deviced_get_usb_control_p(void);
38 static void utc_system_deviced_deviced_rgbled_control_p_1(void);
39 static void utc_system_deviced_deviced_rgbled_control_p_2(void);
40 static void utc_system_deviced_deviced_rgbled_control_n(void);
41
42 enum {
43         POSITIVE_TC_IDX = 0x01,
44         NEGATIVE_TC_IDX,
45 };
46
47 struct tet_testlist tet_testlist[] = {
48         { utc_system_deviced_deviced_mmc_control_p_1, POSITIVE_TC_IDX },
49         { utc_system_deviced_deviced_mmc_control_p_2, POSITIVE_TC_IDX },
50 //      { utc_system_deviced_deviced_usb_control_p_1, POSITIVE_TC_IDX },
51 //      { utc_system_deviced_deviced_usb_control_p_2, POSITIVE_TC_IDX },
52         { utc_system_deviced_deviced_get_usb_control_p, POSITIVE_TC_IDX },
53         { utc_system_deviced_deviced_rgbled_control_p_1, POSITIVE_TC_IDX },
54         { utc_system_deviced_deviced_rgbled_control_p_2, POSITIVE_TC_IDX },
55         { NULL, 0 },
56 };
57
58 static void startup(void)
59 {
60 }
61
62 static void cleanup(void)
63 {
64 }
65
66 /**
67  * @brief Positive test case of deviced_mmc_control()
68  */
69 static void utc_system_deviced_deviced_mmc_control_p_1(void)
70 {
71         int ret;
72
73         ret = deviced_mmc_control(false);
74         dts_check_eq(API_NAME_DEVICED_MMC_CONTROL, ret, 0, "Disable MMC");
75 }
76
77 /**
78  * @brief Positive test case of deviced_mmc_control()
79  */
80 static void utc_system_deviced_deviced_mmc_control_p_2(void)
81 {
82         int ret;
83
84         ret = deviced_mmc_control(true);
85         dts_check_eq(API_NAME_DEVICED_MMC_CONTROL, ret, 0, "Enable MMC");
86 }
87
88 /**
89  * @brief Positive test case of deviced_usb_control()
90  */
91 static void utc_system_deviced_deviced_usb_control_p_1(void)
92 {
93         int ret;
94
95         ret = deviced_usb_control(false);
96         dts_check_eq(API_NAME_DEVICED_USB_CONTROL, ret, 0, "Disable USB");
97 }
98
99 /**
100  * @brief Positive test case of deviced_usb_control()
101  */
102 static void utc_system_deviced_deviced_usb_control_p_2(void)
103 {
104         int ret;
105
106         ret = deviced_usb_control(true);
107         dts_check_eq(API_NAME_DEVICED_USB_CONTROL, ret, 0, "Enable USB");
108 }
109
110 /**
111  * @brief Positive test case of deviced_get_usb_control()
112  */
113 static void utc_system_deviced_deviced_get_usb_control_p(void)
114 {
115         int ret;
116
117         ret = deviced_get_usb_control();
118         dts_check_ge(API_NAME_DEVICED_GET_USB_CONTROL, ret, 0);
119 }
120
121 /**
122  * @brief Positive test case of deviced_rgbled_control()
123  */
124 static void utc_system_deviced_deviced_rgbled_control_p_1(void)
125 {
126         int ret;
127
128         ret = deviced_rgbled_control(false);
129         dts_check_eq(API_NAME_DEVICED_RGBLED_CONTROL, ret, 0, "Disable RGB led");
130 }
131
132 /**
133  * @brief Positive test case of deviced_rgbled_control()
134  */
135 static void utc_system_deviced_deviced_rgbled_control_p_2(void)
136 {
137         int ret;
138
139         ret = deviced_rgbled_control(true);
140         dts_check_eq(API_NAME_DEVICED_USB_CONTROL, ret, 0, "Enable RGB led");
141 }