Merge "[Cherry-pick] Refactor WrapShape classes to BasicShape" into tizen_2.1
[framework/web/webkit-efl.git] / TC / unit_test / webkit2 / utc_webkit2_ewk_context_cookies_policy_set_func.c
1 /*
2  * WebKit2 EFL
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your option)
9  * any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21
22 /**
23  * @file utc_webkit2_ewk_context_cookies_policy_set_func.c
24  * @author Yuni Jeong <yhnet.jung@samsung.com>
25  * @date 2012-06-04
26  * @brief Tests EWK function ewk_context_cookies_policy_set()
27  */
28
29 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
30 #define TESTED_FUN_NAME ewk_context_cookies_policy_set
31 #define POSITIVE_TEST_FUN_NUM 3
32 #define NEGATIVE_TEST_FUN_NUM 3
33
34 #include "utc_webkit2_ewk.h"
35
36 /* Startup and cleanup functions */
37 static void startup(void)
38 {
39     utc_webkit2_ewk_test_init();
40 }
41
42 static void cleanup(void)
43 {
44     utc_webkit2_ewk_test_end();
45 }
46
47 /**
48  * @brief Checking whether cookies's policy is set to EWK_COOKIE_JAR_ACCEPT_NEVER.
49  */
50 POS_TEST_FUN(1)
51 {
52     Eina_Bool result = ewk_context_cookies_policy_set(ewk_context_default_get(), EWK_COOKIE_JAR_ACCEPT_NEVER);
53     if (!result)
54         utc_fail();
55
56     utc_check_eq(result, EINA_TRUE);
57 }
58
59 /**
60  * @brief Checking whether cookies's policy is set to EWK_COOKIE_JAR_ACCEPT_ALWAYS.
61  */
62 POS_TEST_FUN(2)
63 {
64     Eina_Bool result = ewk_context_cookies_policy_set(ewk_context_default_get(), EWK_COOKIE_JAR_ACCEPT_ALWAYS);
65     if (!result)
66         utc_fail();
67
68     utc_check_eq(result, EINA_TRUE);
69 }
70
71 /**
72  * @brief Checking whether cookies's policy is set to EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY.
73  */
74 POS_TEST_FUN(3)
75 {
76     Eina_Bool result = ewk_context_cookies_policy_set(ewk_context_default_get(), EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY);
77     if (!result)
78         utc_fail();
79
80     utc_check_eq(result, EINA_TRUE);
81 }
82
83 /**
84  * @brief Checking whether function works properly in case of NULL of a context.
85  */
86 NEG_TEST_FUN(1)
87 {
88     Eina_Bool result = ewk_context_cookies_policy_set(NULL, EWK_COOKIE_JAR_ACCEPT_NEVER);
89     if (result)
90         utc_fail();
91
92     utc_check_ne(result, EINA_TRUE);
93 }
94
95 /**
96  * @brief Checking whether function works properly in case of NULL of a context.
97  */
98 NEG_TEST_FUN(2)
99 {
100     Eina_Bool result = ewk_context_cookies_policy_set(NULL, EWK_COOKIE_JAR_ACCEPT_ALWAYS);
101     if (result)
102         utc_fail();
103
104     utc_check_ne(result, EINA_TRUE);}
105
106 /**
107  * @brief Checking whether function works properly in case of NULL of a context.
108  */
109 NEG_TEST_FUN(3)
110 {
111     Eina_Bool result = ewk_context_cookies_policy_set(NULL, EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY);
112     if (result)
113         utc_fail();
114
115     utc_check_ne(result, EINA_TRUE);
116 }