<!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>[177496] 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/177496">177496</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-12-18 06:57:36 -0800 (Thu, 18 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Implement webkit_web_view_is_playing_audio()
https://bugs.webkit.org/show_bug.cgi?id=138918
Patch by Adrian Perez de Castro <aperez@igalia.com> on 2014-12-18
Reviewed by Carlos Garcia Campos.
Source/WebKit2:
Implements webkit_web_view_is_playing_audio(), and overrides
UIClient::isPlayingAudioDidChange() to be able to emit change
notification signals for the new WebKitWebView::is-playing-audio
property.
* UIProcess/API/gtk/WebKitUIClient.cpp:
(isPlayingAudioDidChange): Added.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewIsPlayingAudioChanged): Helper function to emit the
emit the notify::is-playing-audio signal when needed.
(webkitWebViewGetProperty): Handle the WebKitWebView::is-playing-audio
property.
(webkit_web_view_class_init): Install the
WebKitWebView::is-playing-audio property.
(webkit_web_view_is_playing_audio): Added.
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add
webkit_web_view_is_playing_audio() to the list of public API
functions.
Tools:
Add test case case for webkit_web_view_is_playing_audio() and the
WebKitWebView::is-playing-audio property.
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(urlForResource): Utility function to get URLs pointing to resources
under the Tools/TestWebKitAPI/Tests/WebKit2/ directory.
(testWebViewIsPlayingAudio): Added.
(beforeAll):
* TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
(getResourcesDir): Allow passing a flag to choose from the WebKit2 GTK
API tests resources directory, or the WebKit2 C API tests resources
directory. The default value of the flag is to use the WebKit2 GTK
one, to avoid having to change existing tests.
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(isPlayingAudioChanged): Added.
(WebViewTest::waitUntilIsPlayingAudioChanged): Added.
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-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>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkTestMainh">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-12-18 Adrian Perez de Castro <aperez@igalia.com>
+
+ [GTK] Implement webkit_web_view_is_playing_audio()
+ https://bugs.webkit.org/show_bug.cgi?id=138918
+
+ Reviewed by Carlos Garcia Campos.
+
+ Implements webkit_web_view_is_playing_audio(), and overrides
+ UIClient::isPlayingAudioDidChange() to be able to emit change
+ notification signals for the new WebKitWebView::is-playing-audio
+ property.
+
+ * UIProcess/API/gtk/WebKitUIClient.cpp:
+ (isPlayingAudioDidChange): Added.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewIsPlayingAudioChanged): Helper function to emit the
+ emit the notify::is-playing-audio signal when needed.
+ (webkitWebViewGetProperty): Handle the WebKitWebView::is-playing-audio
+ property.
+ (webkit_web_view_class_init): Install the
+ WebKitWebView::is-playing-audio property.
+ (webkit_web_view_is_playing_audio): Added.
+ * UIProcess/API/gtk/WebKitWebView.h:
+ * UIProcess/API/gtk/WebKitWebViewPrivate.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add
+ webkit_web_view_is_playing_audio() to the list of public API
+ functions.
+
</ins><span class="cx"> 2014-12-18 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Allow to build with ENABLE_NETWORK_CACHE
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -186,6 +186,11 @@
</span><span class="cx"> webkitWebViewRunAsModal(m_webView);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ virtual void isPlayingAudioDidChange(WebPageProxy& page) override
+ {
+ webkitWebViewIsPlayingAudioChanged(m_webView);
+ }
+
</ins><span class="cx"> WebKitWebView* m_webView;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -148,7 +148,8 @@
</span><span class="cx"> PROP_FAVICON,
</span><span class="cx"> PROP_URI,
</span><span class="cx"> PROP_ZOOM_LEVEL,
</span><del>- PROP_IS_LOADING
</del><ins>+ PROP_IS_LOADING,
+ PROP_IS_PLAYING_AUDIO
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap;
</span><span class="lines">@@ -230,6 +231,11 @@
</span><span class="cx"> g_object_notify(G_OBJECT(webView), "is-loading");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void webkitWebViewIsPlayingAudioChanged(WebKitWebView* webView)
+{
+ g_object_notify(G_OBJECT(webView), "is-playing-audio");
+}
+
</ins><span class="cx"> class PageLoadStateObserver final : public PageLoadState::Observer {
</span><span class="cx"> public:
</span><span class="cx"> PageLoadStateObserver(WebKitWebView* webView)
</span><span class="lines">@@ -721,6 +727,9 @@
</span><span class="cx"> case PROP_IS_LOADING:
</span><span class="cx"> g_value_set_boolean(value, webkit_web_view_is_loading(webView));
</span><span class="cx"> break;
</span><ins>+ case PROP_IS_PLAYING_AUDIO:
+ g_value_set_boolean(value, webkit_web_view_is_playing_audio(webView));
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
</span><span class="cx"> }
</span><span class="lines">@@ -932,6 +941,26 @@
</span><span class="cx"> WEBKIT_PARAM_READABLE));
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * WebKitWebView::is-playing-audio:
+ *
+ * Whether the #WebKitWebView is currently playing audio from a page.
+ * This property becomes %TRUE as soon as web content starts playing any
+ * kind of audio. When a page is no longer playing any kind of sound,
+ * the property is set back to %FALSE.
+ *
+ * Since: 2.8
+ */
+ g_object_class_install_property(
+ gObjectClass,
+ PROP_IS_PLAYING_AUDIO,
+ g_param_spec_boolean(
+ "is-playing-audio",
+ "Is Playing Audio",
+ _("Whether the view is playing audio"),
+ FALSE,
+ WEBKIT_PARAM_READABLE));
+
+ /**
</ins><span class="cx"> * WebKitWebView::load-changed:
</span><span class="cx"> * @web_view: the #WebKitWebView on which the signal is emitted
</span><span class="cx"> * @load_event: the #WebKitLoadEvent
</span><span class="lines">@@ -2454,6 +2483,27 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_web_view_is_playing_audio:
+ * @web_view: a #WebKitWebView
+ *
+ * Gets the value of the #WebKitWebView::is-playing-audio property.
+ * You can monitor when a page in a #WebKitWebView is playing audio by
+ * connecting to the notify::is-playing-audio signal of @web_view. This
+ * is useful when the application wants to provide visual feedback when a
+ * page is producing sound.
+ *
+ * Returns: %TRUE if a page in @web_view is playing audio or %FALSE otherwise.
+ *
+ * Since: 2.8
+ */
+gboolean webkit_web_view_is_playing_audio(WebKitWebView* webView)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
+
+ return getPage(webView)->isPlayingAudio();
+}
+
+/**
</ins><span class="cx"> * webkit_web_view_go_back:
</span><span class="cx"> * @web_view: a #WebKitWebView
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -305,6 +305,9 @@
</span><span class="cx"> WEBKIT_API gboolean
</span><span class="cx"> webkit_web_view_is_loading (WebKitWebView *web_view);
</span><span class="cx">
</span><ins>+WEBKIT_API gboolean
+webkit_web_view_is_playing_audio (WebKitWebView *web_view);
+
</ins><span class="cx"> WEBKIT_API guint64
</span><span class="cx"> webkit_web_view_get_page_id (WebKitWebView *web_view);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -60,5 +60,6 @@
</span><span class="cx"> bool webkitWebViewEmitShowNotification(WebKitWebView*, WebKitNotification*);
</span><span class="cx"> void webkitWebViewEmitCloseNotification(WebKitWebView*, WebKitNotification*);
</span><span class="cx"> void webkitWebViewWebProcessCrashed(WebKitWebView*);
</span><ins>+void webkitWebViewIsPlayingAudioChanged(WebKitWebView*);
</ins><span class="cx">
</span><span class="cx"> #endif // WebKitWebViewPrivate_h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -167,6 +167,7 @@
</span><span class="cx"> webkit_web_view_reload_bypass_cache
</span><span class="cx"> webkit_web_view_stop_loading
</span><span class="cx"> webkit_web_view_is_loading
</span><ins>+webkit_web_view_is_playing_audio
</ins><span class="cx"> webkit_web_view_get_estimated_load_progress
</span><span class="cx"> webkit_web_view_get_custom_charset
</span><span class="cx"> webkit_web_view_set_custom_charset
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Tools/ChangeLog        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-12-18 Adrian Perez de Castro <aperez@igalia.com>
+
+ [GTK] Implement webkit_web_view_is_playing_audio()
+ https://bugs.webkit.org/show_bug.cgi?id=138918
+
+ Reviewed by Carlos Garcia Campos.
+
+ Add test case case for webkit_web_view_is_playing_audio() and the
+ WebKitWebView::is-playing-audio property.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
+ (urlForResource): Utility function to get URLs pointing to resources
+ under the Tools/TestWebKitAPI/Tests/WebKit2/ directory.
+ (testWebViewIsPlayingAudio): Added.
+ (beforeAll):
+ * TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
+ (getResourcesDir): Allow passing a flag to choose from the WebKit2 GTK
+ API tests resources directory, or the WebKit2 C API tests resources
+ directory. The default value of the flag is to use the WebKit2 GTK
+ one, to avoid having to change existing tests.
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+ (isPlayingAudioChanged): Added.
+ (WebViewTest::waitUntilIsPlayingAudioChanged): Added.
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:
+
</ins><span class="cx"> 2014-12-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] [EFL] Enable per_test_timeout
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -26,6 +26,23 @@
</span><span class="cx"> #include <glib/gstdio.h>
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx">
</span><ins>+class IsPlayingAudioWebViewTest : public WebViewTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(IsPlayingAudioWebViewTest);
+
+ static void isPlayingAudioChanged(GObject*, GParamSpec*, IsPlayingAudioWebViewTest* test)
+ {
+ g_signal_handlers_disconnect_by_func(test->m_webView, reinterpret_cast<void*>(isPlayingAudioChanged), test);
+ g_main_loop_quit(test->m_mainLoop);
+ }
+
+ void waitUntilIsPlayingAudioChanged()
+ {
+ g_signal_connect(m_webView, "notify::is-playing-audio", G_CALLBACK(isPlayingAudioChanged), this);
+ g_main_loop_run(m_mainLoop);
+ }
+};
+
</ins><span class="cx"> static WebKitTestServer* gServer;
</span><span class="cx">
</span><span class="cx"> static void testWebViewWebContext(WebViewTest* test, gconstpointer)
</span><span class="lines">@@ -702,6 +719,31 @@
</span><span class="cx"> g_assert(test->m_event == NotificationWebViewTest::Cancelled);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void testWebViewIsPlayingAudio(IsPlayingAudioWebViewTest* test, gconstpointer)
+{
+ // The web view must be realized for the video to start playback and
+ // trigger changes in WebKitWebView::is-playing-audio.
+ test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+
+ // Initially, web views should always report no audio being played.
+ g_assert(!webkit_web_view_is_playing_audio(test->m_webView));
+
+ GUniquePtr<char> resourcePath(g_build_filename(Test::getResourcesDir(Test::WebKit2Resources).data(), "file-with-video.html", nullptr));
+ GUniquePtr<char> resourceURL(g_filename_to_uri(resourcePath.get(), nullptr, nullptr));
+ webkit_web_view_load_uri(test->m_webView, resourceURL.get());
+ test->waitUntilLoadFinished();
+ g_assert(!webkit_web_view_is_playing_audio(test->m_webView));
+
+ webkit_web_view_run_javascript(test->m_webView, "playVideo();", nullptr, nullptr, nullptr);
+ test->waitUntilIsPlayingAudioChanged();
+ g_assert(webkit_web_view_is_playing_audio(test->m_webView));
+
+ // Pause the video, and check again.
+ webkit_web_view_run_javascript(test->m_webView, "document.getElementById('test-video').pause();", nullptr, nullptr, nullptr);
+ test->waitUntilIsPlayingAudioChanged();
+ g_assert(!webkit_web_view_is_playing_audio(test->m_webView));
+}
+
</ins><span class="cx"> static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
</span><span class="cx"> {
</span><span class="cx"> if (message->method != SOUP_METHOD_GET) {
</span><span class="lines">@@ -733,6 +775,7 @@
</span><span class="cx"> SnapshotWebViewTest::add("WebKitWebView", "snapshot", testWebViewSnapshot);
</span><span class="cx"> WebViewTest::add("WebKitWebView", "page-visibility", testWebViewPageVisibility);
</span><span class="cx"> NotificationWebViewTest::add("WebKitWebView", "notification", testWebViewNotification);
</span><ins>+ IsPlayingAudioWebViewTest::add("WebKitWebView", "is-playing-audio", testWebViewIsPlayingAudio);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void afterAll()
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkTestMainh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h (177495 => 177496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h        2014-12-18 14:41:44 UTC (rev 177495)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h        2014-12-18 14:57:36 UTC (rev 177496)
</span><span class="lines">@@ -107,10 +107,24 @@
</span><span class="cx"> g_object_weak_ref(object, reinterpret_cast<GWeakNotify>(objectFinalized), this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static CString getResourcesDir()
</del><ins>+
+ enum ResourcesDir {
+ WebKit2GTKResources,
+ WebKit2Resources,
+ };
+
+ static CString getResourcesDir(ResourcesDir resourcesDir = WebKit2GTKResources)
</ins><span class="cx"> {
</span><del>- GUniquePtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Tools", "TestWebKitAPI", "Tests", "WebKit2Gtk", "resources", nullptr));
- return resourcesDir.get();
</del><ins>+ switch (resourcesDir) {
+ case WebKit2GTKResources: {
+ GUniquePtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Tools", "TestWebKitAPI", "Tests", "WebKit2Gtk", "resources", nullptr));
+ return resourcesDir.get();
+ }
+ case WebKit2Resources: {
+ GUniquePtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Tools", "TestWebKitAPI", "Tests", "WebKit2", nullptr));
+ return resourcesDir.get();
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void addLogFatalFlag(unsigned flag)
</span></span></pre>
</div>
</div>
</body>
</html>