4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * This library is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by the
8 * Free Software Foundation; either version 2.1 of the License, or (at your option)
11 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 * License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * @file utc_webkit2_ewk_auth_challenge_credential_cancel_func.c
24 * @author Yuni Jeong <yhnet.jung@samsung.com>
26 * @brief Tests EWK function ewk_auth_challenge_credential_cancel()
29 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
30 #define TESTED_FUN_NAME ewk_auth_challenge_credential_cancel
31 #define POSITIVE_TEST_FUN_NUM 1
32 #define NEGATIVE_TEST_FUN_NUM 1
34 #include "utc_webkit2_ewk.h"
35 static Eina_Bool is_failed;
36 static Eina_Bool is_Authenticated;
38 #define URL "http://reference.vodafone.com/widgets/"
40 static void load_finished(void* data, Evas_Object* webview, void* event_info)
42 utc_message("[load_finished] :: \n");
43 if (!is_Authenticated)
44 is_failed = EINA_TRUE;
46 utc_webkit2_main_loop_quit();
49 static void load_error(void* data, Evas_Object* webview, void* event_info)
51 utc_message("[load_error] :: \n");
52 is_failed = EINA_TRUE;
53 utc_webkit2_main_loop_quit();
56 static void authentication_challenge(void* data, Evas_Object* webview, void* event_info)
58 utc_message("[authentication_challenge] :: \n");
59 is_Authenticated = EINA_TRUE;
61 Ewk_Auth_Challenge* auth_challenge = (Ewk_Auth_Challenge*)event_info;
62 if (!auth_challenge) {
63 is_failed = EINA_TRUE;
64 utc_webkit2_main_loop_quit();
68 char* realm = ewk_auth_challenge_realm_get(auth_challenge);
69 char* url = ewk_auth_challenge_url_get(auth_challenge);
71 is_failed = EINA_TRUE;
72 utc_webkit2_main_loop_quit();
76 ewk_auth_challenge_credential_cancel(auth_challenge);
79 /* Startup and cleanup functions */
80 static void startup(void)
82 utc_webkit2_ewk_test_init();
84 evas_object_smart_callback_add(test_view.webview, "load,finished", load_finished, NULL);
85 evas_object_smart_callback_add(test_view.webview, "load,error", load_error, NULL);
86 evas_object_smart_callback_add(test_view.webview, "authentication,challenge", authentication_challenge, NULL);
89 static void cleanup(void)
91 evas_object_smart_callback_del(test_view.webview, "load,finished", load_finished);
92 evas_object_smart_callback_del(test_view.webview, "load,error", load_error);
93 evas_object_smart_callback_del(test_view.webview, "authentication,challenge", authentication_challenge);
95 utc_webkit2_ewk_test_end();
99 * @brief Checking whether sending cancellation notification for authentication challenge works properly.
103 is_failed = EINA_FALSE;
104 is_Authenticated = EINA_FALSE;
106 Eina_Bool result = ewk_view_url_set(test_view.webview, URL);
109 utc_webkit2_main_loop_begin();
114 result = is_Authenticated;
116 evas_object_show(test_view.webview);
117 evas_object_show(test_view.window);
118 utc_check_eq(result, EINA_TRUE);
122 * @brief Checking whether function works properly in case of NULL of a webview.
126 is_failed = EINA_FALSE;
127 is_Authenticated = EINA_FALSE;
129 Eina_Bool result = ewk_view_url_set(NULL, URL);
133 result = is_Authenticated;
135 evas_object_show(test_view.webview);
136 evas_object_show(test_view.window);
137 utc_check_ne(result, EINA_TRUE);