[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_notification_icon_get_func.cpp
1 // Copyright 2015 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_notification_icon_get : public utc_blink_ewk_notification_test_base {
8  protected:
9   utc_blink_ewk_notification_icon_get()
10     : notification_icon(NULL)
11   {}
12
13   void NotificationShow(Ewk_Notification* notification) override
14   {
15     notification_icon = ewk_notification_icon_get(notification, GetEwkEvas());
16     EventLoopStop(Success);
17   }
18
19  protected:
20   Evas_Object* notification_icon;
21 };
22
23 /**
24 * @brief Positive test case for ewk_notification_icon_get()
25 */
26 TEST_F(utc_blink_ewk_notification_icon_get, POS_TEST)
27 {
28   ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), notification_sample_1.c_str()));
29   ASSERT_EQ(Success, EventLoopStart());
30   ASSERT_TRUE(notification_icon);
31   // Skia and Efl may decode png in different way, we add fuzziness of 3 points
32   // difference between pixel values
33   ASSERT_TRUE(CompareEvasImageWithResource(notification_icon, "/common/logo.png", 3));
34   evas_object_del(notification_icon);
35 }
36
37 /**
38 * @brief Checking whether function works properly in case of nullptr value pass
39 */
40 TEST_F(utc_blink_ewk_notification_icon_get, NEG_TEST)
41 {
42   ASSERT_FALSE(ewk_notification_icon_get(nullptr, nullptr));
43   ASSERT_FALSE(ewk_notification_icon_get(nullptr, GetEwkEvas()));
44 }