Fixed a problem that remember popup does not disappear
[framework/web/webkit-efl.git] / TC / unit_test / webkit2 / utc_webkit2_ewk_settings_private_browsing_enabled_get_func.c
1 /*\r
2  * WebKit2 EFL\r
3  *\r
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
5  *\r
6  * This library is free software; you can redistribute it and/or modify it under\r
7  * the terms of the GNU Lesser General Public License as published by the\r
8  * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
9  * any later version.\r
10  *\r
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
14  * License for more details.\r
15  *\r
16  * You should have received a copy of the GNU Lesser General Public License\r
17  * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
19  *\r
20  */\r
21 \r
22 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */\r
23 #define TESTED_FUN_NAME ewk_settings_private_browsing_enabled_get\r
24 #define POSITIVE_TEST_FUN_NUM 2\r
25 #define NEGATIVE_TEST_FUN_NUM 1\r
26 \r
27 #include "utc_webkit2_ewk.h"\r
28 \r
29 /* Startup and cleanup functions */\r
30 static void startup(void)\r
31 {\r
32     utc_webkit2_ewk_test_init();\r
33 }\r
34 \r
35 static void cleanup(void)\r
36 {\r
37     utc_webkit2_ewk_test_end();\r
38 }\r
39 \r
40 /**\r
41  * @brief Tests if returns TRUE when initiated with a correct webview and set to TRUE.\r
42  */\r
43 POS_TEST_FUN(1)\r
44 {\r
45     Ewk_Settings* settings = ewk_view_settings_get(test_view.webview);\r
46     if (!settings)\r
47         utc_fail();\r
48 \r
49     Eina_Bool result = ewk_settings_private_browsing_enabled_set(settings, EINA_TRUE);\r
50     if (!result)\r
51         utc_fail();\r
52 \r
53     result = ewk_settings_private_browsing_enabled_get(settings);\r
54 \r
55     utc_check_eq(result, EINA_TRUE);\r
56 }\r
57 \r
58 /**\r
59  * @brief Tests if returns FALSE when initiated with a correct webview and set to FALSE.\r
60  */\r
61 POS_TEST_FUN(2)\r
62 {\r
63     Ewk_Settings* settings = ewk_view_settings_get(test_view.webview);\r
64     if (!settings)\r
65         utc_fail();\r
66 \r
67     Eina_Bool result = ewk_settings_private_browsing_enabled_set(settings, EINA_FALSE);\r
68     if (!result)\r
69         utc_fail();\r
70 \r
71     result = ewk_settings_private_browsing_enabled_get(settings);\r
72 \r
73     utc_check_eq(result, EINA_FALSE);\r
74 }\r
75 \r
76 /**\r
77  * @brief Tests if returns FALSE when initiated with NULL webview.\r
78  */\r
79 NEG_TEST_FUN(1)\r
80 {\r
81     Eina_Bool result = ewk_settings_private_browsing_enabled_get(NULL);\r
82     utc_check_eq(result, EINA_FALSE);\r
83 }\r