1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "utc_blink_ewk_base.h"
7 #define URL "https://review.tizen.org/gerrit/#/"
9 class utc_blink_ewk_auth_challenge_credential_use : public utc_blink_ewk_base
12 void PostSetUp() override
14 ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this);
17 void PreTearDown() override
19 evas_object_smart_callback_del( GetEwkWebView(), "authentication,challenge", authentication_challenge);
20 ewk_view_authentication_callback_set(GetEwkWebView(), nullptr, nullptr);
23 void LoadFinished(Evas_Object* webview) override {
24 EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called
27 static void AuthenticationChallenge(Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* data)
29 utc_message("[authentication_challenge] :: ");
30 utc_blink_ewk_auth_challenge_credential_use *owner = static_cast<utc_blink_ewk_auth_challenge_credential_use*>(data);
32 if (!auth_challenge) {
33 owner->EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called
37 const char* realm = ewk_auth_challenge_realm_get(auth_challenge);
38 const char* url = ewk_auth_challenge_url_get(auth_challenge);
40 owner->EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called
44 const char* user = "access";
45 const char* password = "early";
46 ewk_auth_challenge_credential_use(auth_challenge, user, password);
47 owner->EventLoopStop( utc_blink_ewk_base::Success );
49 // Here is a logical error because success is called a question about authorization,
50 // not about the result of the authorization.
51 // In the casete of re-call up the callback should be return failuare
56 * @brief Checking whether sending cancellation notification for authentication challenge works properly.
58 TEST_F(utc_blink_ewk_auth_challenge_credential_use, POS_TEST)
60 utc_check_true( ewk_view_url_set( GetEwkWebView(), URL));
62 utc_check_eq( EventLoopStart(), utc_blink_ewk_base::Success);
64 evas_object_show( GetEwkWebView());
65 evas_object_show( GetEwkWindow());
69 * @brief Checking whether function works properly in case of NULL of a webview.
71 TEST_F(utc_blink_ewk_auth_challenge_credential_use, NEG_TEST)
73 Eina_Bool result = ewk_view_url_set( NULL, URL);
79 evas_object_show( GetEwkWebView());
80 evas_object_show( GetEwkWindow());