2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "net_nfc_typedef.h"
21 #include "net_nfc_util_private.h"
23 #ifdef SECURITY_SERVER
24 #include <security-server.h>
29 POSITIVE_TC_IDX = 0x01,
32 static void startup(void);
33 static void cleanup(void);
35 void (*tet_startup)(void) = startup;
36 void (*tet_cleanup)(void) = cleanup;
38 static void utc_net_nfc_initialize_p(void);
39 static void utc_net_nfc_initialize_n(void);
40 static void utc_net_nfc_deinitialize_p(void);
41 static void utc_net_nfc_deinitialize_n(void);
42 static void utc_net_nfc_set_response_callback_p(void);
43 static void utc_net_nfc_set_response_callback_n(void);
44 static void utc_net_nfc_unset_response_callback_p(void);
45 static void utc_net_nfc_unset_response_callback_n(void);
47 static void net_nfc_test_client_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data )
53 struct tet_testlist tet_testlist[] = {
54 { utc_net_nfc_initialize_p , POSITIVE_TC_IDX },
55 { utc_net_nfc_initialize_n , NEGATIVE_TC_IDX },
56 { utc_net_nfc_deinitialize_p, POSITIVE_TC_IDX },
57 { utc_net_nfc_deinitialize_n , NEGATIVE_TC_IDX},
58 { utc_net_nfc_set_response_callback_p, 1},
59 { utc_net_nfc_set_response_callback_n, 2 },
60 { utc_net_nfc_unset_response_callback_p, 1},
61 { utc_net_nfc_unset_response_callback_n, 2},
65 //this method is called only once in start
66 static void startup(void)
71 static void cleanup(void)
75 static void utc_net_nfc_initialize_p(void)
79 ret = net_nfc_initialize();
80 net_nfc_deinitialize();
82 dts_pass(__func__, "PASS");
85 static void utc_net_nfc_initialize_n(void)
89 ret = net_nfc_initialize();
90 net_nfc_deinitialize();
92 dts_pass(__func__, "PASS");
95 static void utc_net_nfc_deinitialize_p(void)
100 ret = net_nfc_deinitialize();
102 dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize is failed");
105 static void utc_net_nfc_deinitialize_n(void)
109 ret = net_nfc_deinitialize();
111 dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize not allow null");
114 static void utc_net_nfc_set_response_callback_p(void)
117 //net_nfc_response_cb cb;
119 net_nfc_initialize();
121 ret = net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
123 net_nfc_unset_response_callback();
125 dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback is failed");
128 static void utc_net_nfc_set_response_callback_n(void)
132 ret = net_nfc_set_response_callback(NULL, NULL);
134 dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback not allow null");
137 static void utc_net_nfc_unset_response_callback_p(void)
140 //net_nfc_response_cb cb;
142 net_nfc_initialize();
144 net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
146 ret = net_nfc_unset_response_callback();
148 net_nfc_deinitialize();
150 dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback is failed");
153 static void utc_net_nfc_unset_response_callback_n(void)
157 ret = net_nfc_unset_response_callback();
159 dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback not allow null");