<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193721] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193721">193721</a></dd>
<dt>Author</dt> <dd>gns@gnome.org</dd>
<dt>Date</dt> <dd>2015-12-08 00:26:16 -0800 (Tue, 08 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Notify WebCore when notification is clicked
https://bugs.webkit.org/show_bug.cgi?id=151951

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

* UIProcess/API/gtk/WebKitNotification.cpp:
(webkit_notification_class_init): new clicked signal.
(webkit_notification_clicked): method to emit the clicked signal.
* UIProcess/API/gtk/WebKitNotification.h:
* UIProcess/API/gtk/WebKitNotificationProvider.cpp:
(WebKitNotificationProvider::notificationClickedCallback): handle the clicked signal and tell WebProcess about the click.
(WebKitNotificationProvider::show): connect to the clicked signal in addition to closed.
* UIProcess/API/gtk/WebKitNotificationProvider.h:
* UIProcess/API/gtk/WebKitWebView.cpp:
(notifyNotificationClicked): handle the click on our libnotify notification.
(webkitWebViewShowNotification): add the &quot;default&quot; action to our libnotify notification to be notified of the click.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(testWebViewNotification): test the new API.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProvidercpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProviderh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/ChangeLog        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-12-07  Gustavo Noronha Silva  &lt;gns@gnome.org&gt;
+
+        [GTK] Notify WebCore when notification is clicked
+        https://bugs.webkit.org/show_bug.cgi?id=151951
+
+        Reviewed by Carlos Garcia Campos.
+
+        * UIProcess/API/gtk/WebKitNotification.cpp:
+        (webkit_notification_class_init): new clicked signal.
+        (webkit_notification_clicked): method to emit the clicked signal.
+        * UIProcess/API/gtk/WebKitNotification.h:
+        * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
+        (WebKitNotificationProvider::notificationClickedCallback): handle the clicked signal and tell WebProcess about the click.
+        (WebKitNotificationProvider::show): connect to the clicked signal in addition to closed.
+        * UIProcess/API/gtk/WebKitNotificationProvider.h:
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (notifyNotificationClicked): handle the click on our libnotify notification.
+        (webkitWebViewShowNotification): add the &quot;default&quot; action to our libnotify notification to be notified of the click.
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+
</ins><span class="cx"> 2015-12-07  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r193655.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum {
</span><span class="cx">     CLOSED,
</span><ins>+    CLICKED,
</ins><span class="cx"> 
</span><span class="cx">     LAST_SIGNAL
</span><span class="cx"> };
</span><span class="lines">@@ -149,6 +150,24 @@
</span><span class="cx">             nullptr,
</span><span class="cx">             g_cclosure_marshal_VOID__VOID,
</span><span class="cx">             G_TYPE_NONE, 0);
</span><ins>+
+    /**
+     * WebKitNotification::clicked:
+     * @notification: the #WebKitNotification on which the signal is emitted
+     *
+     * Emitted when a notification has been clicked. See webkit_notification_clicked().
+     *
+     * Since: 2.12
+     */
+    signals[CLICKED] =
+        g_signal_new(
+            &quot;clicked&quot;,
+            G_TYPE_FROM_CLASS(notificationClass),
+            G_SIGNAL_RUN_LAST,
+            0, 0,
+            nullptr,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebKitNotification* webkitNotificationCreate(WebKitWebView* webView, const WebKit::WebNotification&amp; webNotification)
</span><span class="lines">@@ -231,3 +250,19 @@
</span><span class="cx"> 
</span><span class="cx">     g_signal_emit(notification, signals[CLOSED], 0);
</span><span class="cx"> }
</span><ins>+
+/**
+ * webkit_notification_clicked:
+ * @notification: a #WebKitNotification
+ *
+ * Tells WebKit the notification has been clicked. This will emit the
+ * #WebKitNotification::clicked signal.
+ *
+ * Since: 2.12
+ */
+void webkit_notification_clicked(WebKitNotification* notification)
+{
+    g_return_if_fail(WEBKIT_IS_NOTIFICATION(notification));
+
+    g_signal_emit(notification, signals[CLICKED], 0);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -71,8 +71,11 @@
</span><span class="cx"> webkit_notification_get_body                 (WebKitNotification *notification);
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API void
</span><del>-webkit_notification_close                    (WebKitNotification* notification);
</del><ins>+webkit_notification_close                    (WebKitNotification *notification);
</ins><span class="cx"> 
</span><ins>+WEBKIT_API void
+webkit_notification_clicked                  (WebKitNotification *notification);
+
</ins><span class="cx"> G_END_DECLS
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -97,6 +97,11 @@
</span><span class="cx">     provider-&gt;m_notifications.remove(notificationID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebKitNotificationProvider::notificationClickedCallback(WebKitNotification* notification, WebKitNotificationProvider* provider)
+{
+    provider-&gt;m_notificationManager-&gt;providerDidClickNotification(webkit_notification_get_id(notification));
+}
+
</ins><span class="cx"> void WebKitNotificationProvider::show(WebPageProxy* page, const WebNotification&amp; webNotification)
</span><span class="cx"> {
</span><span class="cx">     GRefPtr&lt;WebKitNotification&gt; notification = m_notifications.get(webNotification.notificationID());
</span><span class="lines">@@ -104,6 +109,7 @@
</span><span class="cx">     if (!notification) {
</span><span class="cx">         notification = adoptGRef(webkitNotificationCreate(WEBKIT_WEB_VIEW(page-&gt;viewWidget()), webNotification));
</span><span class="cx">         g_signal_connect(notification.get(), &quot;closed&quot;, G_CALLBACK(notificationCloseCallback), this);
</span><ins>+        g_signal_connect(notification.get(), &quot;clicked&quot;, G_CALLBACK(notificationClickedCallback), this);
</ins><span class="cx">         m_notifications.set(webNotification.notificationID(), notification);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> 
</span><span class="cx">     void cancelNotificationByID(uint64_t);
</span><span class="cx">     static void notificationCloseCallback(WebKitNotification*, WebKitNotificationProvider*);
</span><ins>+    static void notificationClickedCallback(WebKitNotification*, WebKitNotificationProvider*);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebNotificationManagerProxy&gt; m_notificationManager;
</span><span class="cx">     HashMap&lt;uint64_t, GRefPtr&lt;WebKitNotification&gt;&gt; m_notifications;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -594,6 +594,11 @@
</span><span class="cx">     webkit_notification_close(webNotification);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void notifyNotificationClicked(NotifyNotification*, char*, WebKitNotification* webNotification)
+{
+    webkit_notification_clicked(webNotification);
+}
+
</ins><span class="cx"> static void webNotificationClosed(WebKitNotification* webNotification)
</span><span class="cx"> {
</span><span class="cx">     NotifyNotification* notification = NOTIFY_NOTIFICATION(g_object_get_data(G_OBJECT(webNotification), gNotifyNotificationID));
</span><span class="lines">@@ -616,6 +621,8 @@
</span><span class="cx">         notification = notify_notification_new(webkit_notification_get_title(webNotification),
</span><span class="cx">             webkit_notification_get_body(webNotification), nullptr);
</span><span class="cx"> 
</span><ins>+        notify_notification_add_action(notification, &quot;default&quot;, _(&quot;Acknowledge&quot;), NOTIFY_ACTION_CALLBACK(notifyNotificationClicked), webNotification, nullptr);
+
</ins><span class="cx">         g_signal_connect_object(notification, &quot;closed&quot;, G_CALLBACK(notifyNotificationClosed), webNotification, static_cast&lt;GConnectFlags&gt;(0));
</span><span class="cx">         g_signal_connect(webNotification, &quot;closed&quot;, G_CALLBACK(webNotificationClosed), nullptr);
</span><span class="cx">         g_object_set_data_full(G_OBJECT(webNotification), gNotifyNotificationID, notification, static_cast&lt;GDestroyNotify&gt;(g_object_unref));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -657,6 +657,7 @@
</span><span class="cx"> webkit_notification_get_title
</span><span class="cx"> webkit_notification_get_body
</span><span class="cx"> webkit_notification_close
</span><ins>+webkit_notification_clicked
</ins><span class="cx"> 
</span><span class="cx"> &lt;SUBSECTION Standard&gt;
</span><span class="cx"> WebKitNotificationClass
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Tools/ChangeLog        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-12-07  Gustavo Noronha Silva  &lt;gns@gnome.org&gt;
+
+        [GTK] Notify WebCore when notification is clicked
+        https://bugs.webkit.org/show_bug.cgi?id=151951
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
+        (testWebViewNotification): test the new API.
+
</ins><span class="cx"> 2015-12-07  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         'jhbuild build' should fail immediately when building any module fails
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp (193720 => 193721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2015-12-08 08:17:53 UTC (rev 193720)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2015-12-08 08:26:16 UTC (rev 193721)
</span><span class="lines">@@ -638,6 +638,8 @@
</span><span class="cx">         None,
</span><span class="cx">         Permission,
</span><span class="cx">         Shown,
</span><ins>+        Clicked,
+        OnClicked,
</ins><span class="cx">         Closed,
</span><span class="cx">         OnClosed,
</span><span class="cx">     };
</span><span class="lines">@@ -666,19 +668,33 @@
</span><span class="cx">         return TRUE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static gboolean notificationClickedCallback(WebKitNotification* notification, NotificationWebViewTest* test)
+    {
+        g_assert(test-&gt;m_notification == notification);
+        test-&gt;m_event = Clicked;
+        return TRUE;
+    }
+
</ins><span class="cx">     static gboolean showNotificationCallback(WebKitWebView*, WebKitNotification* notification, NotificationWebViewTest* test)
</span><span class="cx">     {
</span><span class="cx">         test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(notification));
</span><span class="cx">         test-&gt;m_notification = notification;
</span><span class="cx">         g_signal_connect(notification, &quot;closed&quot;, G_CALLBACK(notificationClosedCallback), test);
</span><ins>+        g_signal_connect(notification, &quot;clicked&quot;, G_CALLBACK(notificationClickedCallback), test);
</ins><span class="cx">         test-&gt;m_event = Shown;
</span><span class="cx">         g_main_loop_quit(test-&gt;m_mainLoop);
</span><span class="cx">         return TRUE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static void notificationsMessageReceivedCallback(WebKitUserContentManager* userContentManager, WebKitJavascriptResult*, NotificationWebViewTest* test)
</del><ins>+    static void notificationsMessageReceivedCallback(WebKitUserContentManager* userContentManager, WebKitJavascriptResult* javascriptResult, NotificationWebViewTest* test)
</ins><span class="cx">     {
</span><del>-        test-&gt;m_event = OnClosed;
</del><ins>+        GUniquePtr&lt;char&gt; valueString(WebViewTest::javascriptResultToCString(javascriptResult));
+
+        if (g_str_equal(valueString.get(), &quot;clicked&quot;))
+            test-&gt;m_event = OnClicked;
+        else if (g_str_equal(valueString.get(), &quot;closed&quot;))
+            test-&gt;m_event = OnClosed;
+
</ins><span class="cx">         g_main_loop_quit(test-&gt;m_mainLoop);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -719,6 +735,15 @@
</span><span class="cx">         g_main_loop_run(m_mainLoop);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void clickNotificationAndWaitUntilClicked()
+    {
+        m_event = None;
+        runJavaScriptAndWaitUntilFinished(&quot;n.onclick = function() { window.webkit.messageHandlers.notifications.postMessage('clicked'); }&quot;, nullptr);
+        webkit_notification_clicked(m_notification);
+        g_assert(m_event == Clicked);
+        g_main_loop_run(m_mainLoop);
+    }
+
</ins><span class="cx">     void closeNotificationAndWaitUntilClosed()
</span><span class="cx">     {
</span><span class="cx">         m_event = None;
</span><span class="lines">@@ -758,6 +783,9 @@
</span><span class="cx">     g_assert_cmpstr(webkit_notification_get_title(test-&gt;m_notification), ==, title);
</span><span class="cx">     g_assert_cmpstr(webkit_notification_get_body(test-&gt;m_notification), ==, body);
</span><span class="cx"> 
</span><ins>+    test-&gt;clickNotificationAndWaitUntilClicked();
+    g_assert(test-&gt;m_event == NotificationWebViewTest::OnClicked);
+
</ins><span class="cx">     test-&gt;closeNotificationAndWaitUntilClosed();
</span><span class="cx">     g_assert(test-&gt;m_event == NotificationWebViewTest::Closed);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>