[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_security_origin_host_get_func.cpp
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.
4
5 #include "utc_blink_ewk_notification_test_base.h"
6
7 class utc_blink_ewk_security_origin_host_get : public utc_blink_ewk_notification_test_base
8 {
9  protected:
10   void NotificationShow(Ewk_Notification* notification) override {
11     const Ewk_Security_Origin* org = ewk_notification_security_origin_get(notification);
12     MainLoopResult result = Failure;
13     if (org) {
14       const char* host = ewk_security_origin_host_get(org);
15       if (host && !strcmp(host, ""))
16         result = Success;
17     }
18     EventLoopStop(result);
19   }
20 };
21
22 /**
23  * @brief Positive test case for ewk_security_origin_protocol_get().
24  */
25 TEST_F(utc_blink_ewk_security_origin_host_get, POS_TEST)
26 {
27   ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), notification_sample_1.c_str()));
28   ASSERT_EQ(Success, EventLoopStart());
29 }
30
31 /**
32  * @brief Checking whether function works properly in case of nullptr as origin.
33  */
34 TEST_F(utc_blink_ewk_security_origin_host_get, NEG_TEST)
35 {
36   ASSERT_FALSE(ewk_security_origin_host_get(nullptr));
37 }