base::UTF16ToUTF8(notification_data.tag),
base::UTF16ToUTF8(notification_data.title),
icon,
+ notification_data.silent,
notificationUniqueId,
origin);
const std::string& replaceID,
const std::string& title,
const SkBitmap& icon,
+ bool silent,
uint64_t notificationID,
const GURL& origin)
: body_(body)
, icon_(icon)
, replaceID_(replaceID)
, title_(title)
+ , silent_(silent)
, notificationID_(notificationID)
, origin_(new _Ewk_Security_Origin(origin)) {
}
return title_.c_str();
}
+bool Ewk_Notification::IsSilent() const {
+ return silent_;
+}
+
Evas_Object* Ewk_Notification::GetIcon(Evas* evas) const {
if (icon_.isNull()) {
return nullptr;
const std::string& replaceID,
const std::string& title,
const SkBitmap& icon,
+ bool silent,
uint64_t notificationID,
const GURL& securityOrigin);
~Ewk_Notification();
const char* GetBody() const;
const char* GetReplaceId() const;
const char* GetTitle() const;
+ bool IsSilent() const;
Evas_Object* GetIcon(Evas* evas) const;
int GetID() const;
const _Ewk_Security_Origin* GetSecurityOrigin() const;
SkBitmap icon_;
std::string replaceID_;
std::string title_;
+ bool silent_;
uint64_t notificationID_;
scoped_ptr<_Ewk_Security_Origin> origin_;
EINA_SAFETY_ON_NULL_RETURN_VAL(ewk_notification, 0);
return ewk_notification->GetTitle();
}
+
+Eina_Bool ewk_notification_silent_get(const Ewk_Notification* ewk_notification)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewk_notification, EINA_FALSE);
+ return ewk_notification->IsSilent();
+}
*/
EAPI const char* ewk_notification_title_get(const Ewk_Notification* ewk_notification);
+/**
+ * Query if the notification is silent
+ *
+ * @param ewk_notification pointer of notification data
+ *
+ * @return @c EINA_TRUE if the notification must be silent, @c EINA_FALSE
+ * otherwise
+ */
+EAPI Eina_Bool ewk_notification_silent_get(const Ewk_Notification* ewk_notification);
+
#ifdef __cplusplus
}
#endif
'utc_blink_ewk_notification_policies_removed_func.cpp',
'utc_blink_ewk_notification_security_origin_get_func.cpp',
'utc_blink_ewk_notification_showed_func.cpp',
+ 'utc_blink_ewk_notification_silent_get_func.cpp',
'utc_blink_ewk_notification_title_get_func.cpp',
'utc_blink_ewk_policy_decision_cookie_get_func.cpp',
'utc_blink_ewk_policy_decision_frame_get_func.cpp',
body: 'Notification body content',
icon: 'logo.png',
tag: 'replace_tag',
+ silent: true
});
notification.onshow = function() { console.log('notification.show'); }
notification.onclick = function() { console.log('notification.click'); }
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/* Define those macros _before_ you include the utc_blink_ewk.h header file. */
+#include "utc_blink_ewk_notification_test_base.h"
+
+class utc_blink_ewk_notification_silent_get : public utc_blink_ewk_notification_test_base {
+ protected:
+ utc_blink_ewk_notification_silent_get()
+ : silent(NULL)
+ , notification_silent_ref(true)
+ {}
+
+ ~utc_blink_ewk_notification_silent_get()
+ {
+ }
+
+ virtual void NotificationShow(Ewk_Notification* notification) override
+ {
+ silent = ewk_notification_silent_get(notification);
+ EventLoopStop(Success);
+ }
+
+ protected:
+ bool silent;
+ const bool notification_silent_ref;
+};
+
+/**
+* @brief Positive test case for ewk_notification_silent_get(). Text returned by api is compared against expected text and result is set in notificationShow()
+*/
+TEST_F(utc_blink_ewk_notification_silent_get, POS_TEST)
+{
+ ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), notification_sample_1.c_str()));
+ ASSERT_EQ(Success, EventLoopStart());
+ ASSERT_EQ(notification_silent_ref, silent);
+}
+
+/**
+* @brief Checking whether function works properly in case of nullptr of a webview.
+*/
+TEST_F(utc_blink_ewk_notification_silent_get, NEG_TEST)
+{
+ ASSERT_FALSE(ewk_notification_silent_get(nullptr));
+}