<!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>[174463] 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/174463">174463</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2014-10-08 11:20:12 -0700 (Wed, 08 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Source/WebKit2:
Implement WKPageIsPlayingAudio().
https://bugs.webkit.org/show_bug.cgi?id=137048
Reviewed by Darin Adler.
* UIProcess/API/C/WKPage.cpp:
(WKPageIsPlayingAudio):
Tools:
Add a test for WKPageIsPlayingAudio().
https://bugs.webkit.org/show_bug.cgi?id=137048
Reviewed by Darin Adler.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add file-with-video.html, test.mp4, and WKPageIsPlayingAudio.cpp to the project.
* TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp: Added.
(TestWebKitAPI::nullJavaScriptCallback):
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::isPlayingAudioDidChangeCallback):
(TestWebKitAPI::setUpClients):
(TestWebKitAPI::TEST):
This test loads a page with a video in it. When the page is loaded, we first check that
WKPageIsPlayingAudio() returns false for the page. Then we call a method to start the video.
When the WKPageUIClient::isPlayingAudioDidChange callback gets called, check that WKPageIsPlayingAudio()
now returns true for the page.
* TestWebKitAPI/Tests/WebKit2/file-with-video.html: Added.
* TestWebKitAPI/Tests/WebKit2/test.mp4: Added.
This is a video copied from LayoutTests/media/content.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2WKPageIsPlayingAudiocpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2filewithvideohtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/file-with-video.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2testmp4">trunk/Tools/TestWebKitAPI/Tests/WebKit2/test.mp4</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (174462 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-10-08 17:56:49 UTC (rev 174462)
+++ trunk/Source/WebKit2/ChangeLog        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-10-08 Ada Chan <adachan@apple.com>
+
+ Implement WKPageIsPlayingAudio().
+ https://bugs.webkit.org/show_bug.cgi?id=137048
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageIsPlayingAudio):
+
</ins><span class="cx"> 2014-10-08 Gyuyoung Kim <gyuyoung.kim@samsung.com>
</span><span class="cx">
</span><span class="cx"> [EFL][CoordinatedGraphics] All EFL layout tests are broken since r174231
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (174462 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-10-08 17:56:49 UTC (rev 174462)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -1887,10 +1887,9 @@
</span><span class="cx"> toImpl(page)->setAddsVisitedLinks(addsVisitedLinks);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WKPageIsPlayingAudio(WKPageRef)
</del><ins>+bool WKPageIsPlayingAudio(WKPageRef page)
</ins><span class="cx"> {
</span><del>- // FIXME: To be implemented (https://bugs.webkit.org/show_bug.cgi?id=137048).
- return false;
</del><ins>+ return toImpl(page)->isPlayingAudio();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (174462 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-08 17:56:49 UTC (rev 174462)
+++ trunk/Tools/ChangeLog        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-10-08 Ada Chan <adachan@apple.com>
+
+ Add a test for WKPageIsPlayingAudio().
+ https://bugs.webkit.org/show_bug.cgi?id=137048
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ Add file-with-video.html, test.mp4, and WKPageIsPlayingAudio.cpp to the project.
+ * TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp: Added.
+ (TestWebKitAPI::nullJavaScriptCallback):
+ (TestWebKitAPI::didFinishLoadForFrame):
+ (TestWebKitAPI::isPlayingAudioDidChangeCallback):
+ (TestWebKitAPI::setUpClients):
+ (TestWebKitAPI::TEST):
+ This test loads a page with a video in it. When the page is loaded, we first check that
+ WKPageIsPlayingAudio() returns false for the page. Then we call a method to start the video.
+ When the WKPageUIClient::isPlayingAudioDidChange callback gets called, check that WKPageIsPlayingAudio()
+ now returns true for the page.
+ * TestWebKitAPI/Tests/WebKit2/file-with-video.html: Added.
+ * TestWebKitAPI/Tests/WebKit2/test.mp4: Added.
+ This is a video copied from LayoutTests/media/content.
+
</ins><span class="cx"> 2014-10-08 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> [webkitpy] Use python-irclib-0.4.8.tar.gz instead of zip in AutoInstaller
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (174462 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-10-08 17:56:49 UTC (rev 174462)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -107,6 +107,9 @@
</span><span class="cx">                 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */; };
</span><span class="cx">                 520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */; };
</span><span class="cx">                 520BCF4D141EB09E00937EA8 /* WebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4B141EB09E00937EA8 /* WebArchive.cpp */; };
</span><ins>+                524BBC9D19DF377A002F1AF1 /* WKPageIsPlayingAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 524BBC9C19DF377A002F1AF1 /* WKPageIsPlayingAudio.cpp */; };
+                524BBC9E19DF72C0002F1AF1 /* file-with-video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 524BBC9B19DF3714002F1AF1 /* file-with-video.html */; };
+                524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 524BBCA019E30C63002F1AF1 /* test.mp4 */; };
</ins><span class="cx">                 52B8CF9615868CF000281053 /* SetDocumentURI.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52B8CF9515868CF000281053 /* SetDocumentURI.mm */; };
</span><span class="cx">                 52B8CF9815868D9100281053 /* SetDocumentURI.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 52B8CF9415868CF000281053 /* SetDocumentURI.html */; };
</span><span class="cx">                 52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */; };
</span><span class="lines">@@ -316,6 +319,7 @@
</span><span class="cx">                                 C5E1AFFE16B221F1006CC1F2 /* execCopy.html in Copy Resources */,
</span><span class="cx">                                 1A7E8B3618120B2F00AEB74A /* FragmentNavigation.html in Copy Resources */,
</span><span class="cx">                                 BC2D006412AA04CE00E732A3 /* file-with-anchor.html in Copy Resources */,
</span><ins>+                                524BBC9E19DF72C0002F1AF1 /* file-with-video.html in Copy Resources */,
</ins><span class="cx">                                 C5101C4F176B8D9200EE9B15 /* findRanges.html in Copy Resources */,
</span><span class="cx">                                 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */,
</span><span class="cx">                                 26F52EB218288F240023D412 /* geolocationWatchPosition.html in Copy Resources */,
</span><span class="lines">@@ -345,6 +349,7 @@
</span><span class="cx">                                 BC909784125571CF00083756 /* simple.html in Copy Resources */,
</span><span class="cx">                                 C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */,
</span><span class="cx">                                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */,
</span><ins>+                                524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */,
</ins><span class="cx">                                 C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */,
</span><span class="cx">                                 A5E2027515B21F6E00C13E14 /* WindowlessWebViewWithMedia.html in Copy Resources */,
</span><span class="cx">                         );
</span><span class="lines">@@ -455,6 +460,9 @@
</span><span class="cx">                 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 520BCF4B141EB09E00937EA8 /* WebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive.cpp; sourceTree = "<group>"; };
</span><ins>+                524BBC9B19DF3714002F1AF1 /* file-with-video.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "file-with-video.html"; sourceTree = "<group>"; };
+                524BBC9C19DF377A002F1AF1 /* WKPageIsPlayingAudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageIsPlayingAudio.cpp; sourceTree = "<group>"; };
+                524BBCA019E30C63002F1AF1 /* test.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.mp4; sourceTree = "<group>"; };
</ins><span class="cx">                 52B8CF9415868CF000281053 /* SetDocumentURI.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = SetDocumentURI.html; sourceTree = "<group>"; };
</span><span class="cx">                 52B8CF9515868CF000281053 /* SetDocumentURI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetDocumentURI.mm; sourceTree = "<group>"; };
</span><span class="cx">                 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadAlternateHTMLStringWithNonDirectoryURL.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -906,6 +914,7 @@
</span><span class="cx">                                 A1FDFD2E19C288BB005148A4 /* WKImageCreateCGImageCrash.cpp */,
</span><span class="cx">                                 BC9099931256ACF100083756 /* WKStringJSString.cpp */,
</span><span class="cx">                                 51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */,
</span><ins>+                                524BBC9C19DF377A002F1AF1 /* WKPageIsPlayingAudio.cpp */,
</ins><span class="cx">                                 BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
</span><span class="cx">                                 BC90995D12567BC100083756 /* WKString.cpp */,
</span><span class="cx">                         );
</span><span class="lines">@@ -960,6 +969,7 @@
</span><span class="cx">                                 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
</span><span class="cx">                                 C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
</span><span class="cx">                                 BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
</span><ins>+                                524BBC9B19DF3714002F1AF1 /* file-with-video.html */,
</ins><span class="cx">                                 1A02C84B125D4A5E00E3F4BD /* find.html */,
</span><span class="cx">                                 C5101C4E176B8BB900EE9B15 /* findRanges.html */,
</span><span class="cx">                                 26F52EAC1828820E0023D412 /* geolocationGetCurrentPosition.html */,
</span><span class="lines">@@ -984,6 +994,7 @@
</span><span class="cx">                                 51E780361919AFF8001829A2 /* simple2.html */,
</span><span class="cx">                                 51E780371919AFF8001829A2 /* simple3.html */,
</span><span class="cx">                                 C02B7882126615410026BF0F /* spacebar-scrolling.html */,
</span><ins>+                                524BBCA019E30C63002F1AF1 /* test.mp4 */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Resources;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -1274,6 +1285,7 @@
</span><span class="cx">                                 BCBD3710125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp in Sources */,
</span><span class="cx">                                 BCBD3761125ABCFE00D2C29F /* FrameMIMETypePNG.cpp in Sources */,
</span><span class="cx">                                 CE32C7C818184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm in Sources */,
</span><ins>+                                524BBC9D19DF377A002F1AF1 /* WKPageIsPlayingAudio.cpp in Sources */,
</ins><span class="cx">                                 290F427B172A23A500939FF0 /* TestProtocol.mm in Sources */,
</span><span class="cx">                                 1AA9E55914980A9900001A8A /* Functional.cpp in Sources */,
</span><span class="cx">                                 C0C5D3BE14598B6F00A802A6 /* GetBackingScaleFactor.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2WKPageIsPlayingAudiocpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp (0 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKPagePrivate.h>
+
+// This test loads file-with-video.html. It first checks to make sure WKPageIsPlayingAudio() returns
+// false for the page. Then it calls a JavaScript method to play the video, waits for
+// WKPageUIClient::isPlayingAudioDidChange() to get called, and checks that WKPageIsPlayingAudio() now
+// returns true for the page.
+
+namespace TestWebKitAPI {
+
+static bool didFinishLoad;
+static bool isPlayingAudioChanged;
+
+static void nullJavaScriptCallback(WKSerializedScriptValueRef, WKErrorRef error, void*)
+{
+}
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef, WKTypeRef, const void*)
+{
+ didFinishLoad = true;
+}
+
+static void isPlayingAudioDidChangeCallback(WKPageRef page, const void*)
+{
+ isPlayingAudioChanged = true;
+}
+
+static void setUpClients(WKPageRef page)
+{
+ WKPageLoaderClientV0 loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+
+ loaderClient.base.version = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+
+ WKPageSetPageLoaderClient(page, &loaderClient.base);
+
+ WKPageUIClientV4 uiClient;
+ memset(&uiClient, 0, sizeof(uiClient));
+
+ uiClient.base.version = 4;
+ uiClient.isPlayingAudioDidChange = isPlayingAudioDidChangeCallback;
+
+ WKPageSetPageUIClient(page, &uiClient.base);
+}
+
+TEST(WebKit2, WKPageIsPlayingAudio)
+{
+ WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
+
+ PlatformWebView webView(context.get());
+ setUpClients(webView.page());
+
+ WKRetainPtr<WKURLRef> url = adoptWK(Util::createURLForResource("file-with-video", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&didFinishLoad);
+
+ EXPECT_FALSE(WKPageIsPlayingAudio(webView.page()));
+ WKPageRunJavaScriptInMainFrame(webView.page(), Util::toWK("playVideo()").get(), 0, nullJavaScriptCallback);
+
+ Util::run(&isPlayingAudioChanged);
+ EXPECT_TRUE(WKPageIsPlayingAudio(webView.page()));
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2filewithvideohtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/file-with-video.html (0 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/file-with-video.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/file-with-video.html        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<html>
+<head>
+ <script>
+ function playVideo()
+ {
+ document.getElementById("test-video").play();
+ }
+ </script>
+</head>
+<body>
+ <p>
+ <video id="test-video" src="test.mp4" controls></video>
+ </p>
+ <p>
+ <button onclick="playVideo()">Play Video</button>
+ </p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2testmp4"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/test.mp4 (0 => 174463)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/test.mp4         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/test.mp4        2014-10-08 18:20:12 UTC (rev 174463)
</span><span class="lines">@@ -0,0 +1,1901 @@
</span><ins>+ ftypmp42 mp42avc1 \xC9moov lmvhd \xC6\xC2}\xC6\xC2}         \xC4 :\xDC @ etrak \tkhd \xC6\xC2|\xC6\xC2} :\xDC @ $edts elst :\xDC \xDDmdia mdhd \xC6\xC2}\xC6\xC2} \xACD \xC7 :hdlr soun Apple Sound Media Handler {minf smhd $dinf dref url