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
26 * @file utc_webkit2_ewk_view_stop_func.c
\r
27 * @author Rashmi Kulakarni <rashmi.vijay@samsung.com>
\r
29 * @brief Tests EWK function ewk_view_stop()
\r
32 #define TESTED_FUN_NAME ewk_view_stop
\r
33 #define POSITIVE_TEST_FUN_NUM 1
\r
34 #define NEGATIVE_TEST_FUN_NUM 1
\r
36 #include "utc_webkit2_ewk.h"
\r
42 #define SAMPLE_HTML_FILE ("/common/sample.html")
\r
43 #define SAMPLE1_HTML_FILE ("/common/sample_1.html")
\r
45 static void loadFinished(void* data, Evas_Object* evas_object, void* event_info)
\r
47 utc_message("[loadFinished] :: \n");
\r
48 utc_webkit2_main_loop_quit();
\r
50 /* Callback for load error */
\r
51 static void loadError(void* data, Evas_Object* webview, void* event_info)
\r
53 utc_message("[load_error] :: \n");
\r
54 utc_webkit2_main_loop_quit();
\r
59 static void startup(void)
\r
61 utc_webkit2_ewk_test_init();
\r
63 evas_object_smart_callback_add(test_view.webview, "load,finished", loadFinished, NULL);
\r
64 evas_object_smart_callback_add(test_view.webview, "load,error", loadError, NULL);
\r
67 static void cleanup(void)
\r
69 evas_object_smart_callback_del(test_view.webview, "load,finished", loadFinished);
\r
70 evas_object_smart_callback_del(test_view.webview, "load,error", loadError);
\r
71 utc_webkit2_ewk_test_end();
\r
74 static void loadURL(const char* url)
\r
76 char* full_path = generate_full_resource_path(url);
\r
80 Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);
\r
88 * @brief Positive test case of ewk_view_stop()
\r
89 * ewk_view_stop should return TRUE as we are stopping the load with a valid url
\r
93 loadURL(SAMPLE_HTML_FILE);
\r
94 utc_webkit2_main_loop_begin();
\r
96 Eina_Bool result = ewk_view_stop(test_view.webview);
\r
97 utc_check_eq(result, EINA_TRUE);
\r
101 * @brief Negative test case of ewk_view_stop()
\r
102 * ewk_view_stop should return FALSE as we are stopping the load with NULL
\r
106 Eina_Bool result = ewk_view_stop(NULL);
\r
107 utc_check_eq(result, EINA_FALSE);
\r