Fixed a problem that remember popup does not disappear
[framework/web/webkit-efl.git] / TC / unit_test / webkit2 / utc_webkit2_ewk_view_reload_bypass_cache_func.c
1 /*\r
2  * WebKit 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_view_reload_bypass_cache\r
24 #define POSITIVE_TEST_FUN_NUM 1\r
25 #define NEGATIVE_TEST_FUN_NUM 1\r
26 \r
27 #include "utc_webkit2_ewk.h"\r
28 \r
29 #define SAMPLE_HTML_FILE        ("/common/sample.html")\r
30 \r
31 static void loadFinished(void* data, Evas_Object* webview, void* event_info)\r
32 {\r
33     utc_message("[loadFinished] :: \n");\r
34     utc_webkit2_main_loop_quit();\r
35 }\r
36 \r
37 /* Callback for load error */\r
38 static void loadError(void* data, Evas_Object* webview, void* event_info)\r
39 {\r
40     utc_message("[load_error] :: \n");\r
41     utc_webkit2_main_loop_quit();\r
42 \r
43     utc_fail();\r
44 }\r
45 \r
46 /* Startup and cleanup functions */\r
47 static void startup(void)\r
48 {\r
49     utc_webkit2_ewk_test_init();\r
50     evas_object_smart_callback_add(test_view.webview, "load,finished", loadFinished, NULL);\r
51     evas_object_smart_callback_add(test_view.webview, "load,error", loadError, NULL);\r
52 }\r
53 \r
54 static void cleanup(void)\r
55 {\r
56     evas_object_smart_callback_del(test_view.webview, "load,finished", loadFinished);\r
57     evas_object_smart_callback_del(test_view.webview, "load,error", loadError);\r
58     utc_webkit2_ewk_test_end();\r
59 }\r
60 \r
61 static void loadURL(const char* url)\r
62 {\r
63     char* full_path = generate_full_resource_path(url);\r
64     if (!full_path)\r
65         utc_fail();\r
66 \r
67     Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);\r
68     free(full_path);\r
69 \r
70     if (!result)\r
71         utc_fail();\r
72 }\r
73 \r
74 /**\r
75  * @brief Tests if returns TRUE when initiated with a correct webview.\r
76  */\r
77 POS_TEST_FUN(1)\r
78 {\r
79     loadURL(SAMPLE_HTML_FILE);\r
80     utc_webkit2_main_loop_begin();\r
81 \r
82     Eina_Bool result = ewk_view_reload_bypass_cache(test_view.webview);\r
83     utc_webkit2_main_loop_begin();\r
84 \r
85     utc_check_eq(result, EINA_TRUE);\r
86 }\r
87 \r
88 /**\r
89  * @brief Tests if returns FALSE when not initiated with NULL webview.\r
90  */\r
91 NEG_TEST_FUN(1)\r
92 {\r
93     Eina_Bool result = ewk_view_reload_bypass_cache(NULL);\r
94     utc_check_eq(result, EINA_FALSE);\r
95 }\r