[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_notification_title_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 /* Define those macros _before_ you include the utc_blink_ewk.h header file. */
6 #include "utc_blink_ewk_notification_test_base.h"
7
8 class utc_blink_ewk_notification_title_get : public utc_blink_ewk_notification_test_base {
9  protected:
10   utc_blink_ewk_notification_title_get()
11     : title(NULL)
12     , notification_title_ref("Notification Title")
13   {}
14
15   ~utc_blink_ewk_notification_title_get() override {
16     eina_stringshare_del(title);
17   }
18
19   void NotificationShow(Ewk_Notification* notification) override {
20     title = eina_stringshare_add(ewk_notification_title_get(notification));
21     EventLoopStop(Success);
22   }
23
24  protected:
25   Eina_Stringshare* title;
26   const char* const notification_title_ref;
27 };
28
29 /**
30 * @brief Positive test case for ewk_notification_title_get(). Text returned by api is compared against expected text and result is set in notificationShow()
31 */
32 TEST_F(utc_blink_ewk_notification_title_get, POS_TEST)
33 {
34   ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), notification_sample_1.c_str()));
35   ASSERT_EQ(Success, EventLoopStart());
36   ASSERT_STREQ(notification_title_ref, title);
37 }
38
39 /**
40 * @brief Checking whether function works properly in case of nullptr of a webview.
41 */
42 TEST_F(utc_blink_ewk_notification_title_get, NEG_TEST)
43 {
44   ASSERT_FALSE(ewk_notification_title_get(nullptr));
45 }