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 static const char* const kUrl = "https://review.tizen.org/gerrit/#/";
9 class utc_blink_ewk_auth_challenge_realm_get : public utc_blink_ewk_base
13 void PostSetUp() override
15 ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this);
18 void PreTearDown() override
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 ASSERT_TRUE(data != NULL);
31 utc_blink_ewk_auth_challenge_realm_get *owner = static_cast<utc_blink_ewk_auth_challenge_realm_get*>(data);
35 std::string realm = ewk_auth_challenge_realm_get(auth_challenge);
36 if (realm == "Tizen.org ACCOUNT") {
37 owner->EventLoopStop(utc_blink_ewk_base::Success);
41 owner->EventLoopStop(utc_blink_ewk_base::Failure);
46 * @brief Checking whether the realm of authentication challenge is returned properly.
48 TEST_F(utc_blink_ewk_auth_challenge_realm_get, POS_TEST)
50 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), kUrl));
51 EXPECT_EQ(Success, EventLoopStart());
55 * @brief Checking whether function works properly in case of NULL of a webview.
57 TEST_F(utc_blink_ewk_auth_challenge_realm_get, NEG_TEST)
59 ASSERT_FALSE(ewk_view_url_set(NULL, kUrl));