5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
7 * This library is free software; you can redistribute it and/or modify it under
\r
8 * the terms of the GNU Lesser General Public License as published by the
\r
9 * Free Software Foundation; either version 2.1 of the License, or (at your option)
\r
10 * any later version.
\r
12 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
\r
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
\r
15 * License for more details.
\r
17 * You should have received a copy of the GNU Lesser General Public License
\r
18 * along with this library; if not, write to the Free Software Foundation, Inc., 51
\r
19 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
23 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
\r
25 #define TESTED_FUN_NAME ewk_view_javascript_confirm_reply
\r
26 #define POSITIVE_TEST_FUN_NUM 1
\r
27 #define NEGATIVE_TEST_FUN_NUM 1
\r
29 #include "utc_webkit2_ewk.h"
\r
31 Eina_Bool g_result = EINA_FALSE;
\r
33 #define SAMPLE_HTML_FILE ("/ewk_view/confirm_test.html")
\r
35 /* Load specified url */
\r
36 static void loadURL(const char* url)
\r
38 char* full_path = generate_full_resource_path(url);
\r
42 Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);
\r
49 /* Callback for load finished */
\r
50 static void loadFinished(void* data, Evas_Object* webview, void* event_info)
\r
52 utc_message("[loadFinished] :: \n");
\r
53 utc_webkit2_main_loop_quit();
\r
56 /* Callback for load error */
\r
57 static void loadError(void* data, Evas_Object* webview, void* event_info)
\r
59 utc_message("[loadError] :: \n");
\r
60 utc_webkit2_main_loop_quit();
\r
63 /* Callback for script confirm */
\r
64 static Eina_Bool confirmCallback(Evas_Object* webview ,const char* message,const char* default_value ,void* user_data)
\r
66 utc_message("[confirmCallback] :: xc\n");
\r
68 const char* result = "confirm_reply";
\r
69 ewk_view_javascript_confirm_reply(webview, result);
\r
71 g_result = EINA_TRUE;
\r
72 utc_webkit2_main_loop_quit();
\r
75 /* Startup function */
\r
76 static void startup(void)
\r
78 utc_webkit2_ewk_test_init();
\r
80 evas_object_smart_callback_add(test_view.webview, "load,finished", loadFinished, NULL);
\r
81 evas_object_smart_callback_add(test_view.webview, "load,error", loadError, NULL);
\r
84 /* Cleanup function */
\r
85 static void cleanup(void)
\r
87 evas_object_smart_callback_del(test_view.webview, "load,finished", loadFinished);
\r
88 evas_object_smart_callback_del(test_view.webview, "load,error", loadError);
\r
90 utc_webkit2_ewk_test_end();
\r
95 * @brief Positive test case of ewk_view_javascript_confirm_reply()
\r
96 * ewk_view_javascript_confirm_reply() should be performed without any problem.
\r
100 ewk_view_javascript_confirm_callback_set(test_view.webview, confirmCallback, 0);
\r
102 loadURL(SAMPLE_HTML_FILE);
\r
103 utc_webkit2_main_loop_begin();
\r
105 utc_check_eq(g_result, EINA_TRUE);
\r
109 * @brief Checking whether function works properly in case of NULL of a webview.
\r
113 ewk_view_javascript_confirm_reply(NULL, NULL);
\r