4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
\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
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
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
22 /* Define those macros _before_ you include the utc_webkit_ewk.h header file. */
\r
23 #define TESTED_FUN_NAME ewk_view_inspector_server_start
\r
24 #define POSITIVE_TEST_FUN_NUM 2
\r
25 #define NEGATIVE_TEST_FUN_NUM 2
\r
27 #include "utc_webkit2_ewk.h"
\r
29 #define SAMPLE_HTML_FILE ("/common/sample.html")
\r
31 /* Load URL function */
\r
32 static void loadURL(const char* url)
\r
34 char* full_path = generate_full_resource_path(url);
\r
38 Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);
\r
45 /*Load Finished Callback */
\r
46 static void loadFinished(void *data, Evas_Object *webview, void *arg)
\r
48 utc_message("[loadFinished] :: \n");
\r
49 utc_webkit2_main_loop_quit();
\r
52 /*Load Error Callback */
\r
53 static void loadError(void *data, Evas_Object *webview, void *arg)
\r
55 utc_message("[loadError] :: \n");
\r
56 utc_webkit2_main_loop_quit();
\r
62 /* Startup and cleanup functions */
\r
63 static void startup(void)
\r
65 utc_webkit2_ewk_test_init();
\r
66 evas_object_smart_callback_add(test_view.webview, "load,finished", loadFinished, NULL);
\r
67 evas_object_smart_callback_add(test_view.webview, "load,error", loadError, NULL);
\r
70 static void cleanup(void)
\r
72 evas_object_smart_callback_del(test_view.webview, "load,finished", loadFinished);
\r
73 evas_object_smart_callback_del(test_view.webview, "load,error", loadError);
\r
74 utc_webkit2_ewk_test_end();
\r
75 ewk_view_inspector_server_stop(test_view.webview);
\r
79 * @brief Positive test case checking if server can be started on a free port.
\r
84 port = ewk_view_inspector_server_start(test_view.webview,0);
\r
85 utc_check_eq(port, 0);
\r
90 * @brief Positive test case checking if a new port can be assigned
\r
94 ewk_view_inspector_server_stop(test_view.webview);
\r
96 loadURL(SAMPLE_HTML_FILE);
\r
97 utc_webkit2_main_loop_begin();
\r
100 int test_port = 11259;
\r
101 port = ewk_view_inspector_server_start(test_view.webview,test_port);
\r
102 utc_check_eq(port, test_port);
\r
107 * @brief Negative test case checking if a server can be started on the same port.
\r
112 ewk_view_inspector_server_stop(test_view.webview);
\r
113 port = ewk_view_inspector_server_start(test_view.webview,0);
\r
114 port = ewk_view_inspector_server_start(test_view.webview,port);
\r
115 utc_check_eq(port, 0);
\r
119 * @brief Negative test case checking if a server can be started while one is running.
\r
124 port = ewk_view_inspector_server_start(test_view.webview,0);
\r
125 utc_check_eq(port, 0);
\r