<!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>[200403] 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/200403">200403</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-03 18:46:30 -0700 (Tue, 03 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add VideoControlsManager tests
https://bugs.webkit.org/show_bug.cgi?id=157332
-and corresponding-
rdar://problem/24358431
Reviewed by Sam Weinig.
Source/WebKit2:
Expose _hasActiveVideoForControlsManager on WKWebViewPrivate for the sake of
testing.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _hasActiveVideoForControlsManager]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Tools:
This patch adds three VideoControlsManager tests.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm: Added.
(-[DidPlayMessageHandler initWithWKWebView:]):
(-[DidPlayMessageHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</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="#trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithaudiohtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithaudiomp4">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithoutaudiohtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (200402 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-04 01:21:38 UTC (rev 200402)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-05-03 Beth Dakin <bdakin@apple.com>
+
+ Add VideoControlsManager tests
+ https://bugs.webkit.org/show_bug.cgi?id=157332
+ -and corresponding-
+ rdar://problem/24358431
+
+ Reviewed by Sam Weinig.
+
+ Expose _hasActiveVideoForControlsManager on WKWebViewPrivate for the sake of
+ testing.
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _hasActiveVideoForControlsManager]):
+ (-[WKWebView _doAfterNextPresentationUpdate:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
</ins><span class="cx"> 2016-05-03 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS][WK2] Allow WKWebView to play local filesystem media when created with -loadFileURL:allowingReadAccessToURL:
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (200402 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-04 01:21:38 UTC (rev 200402)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -4348,6 +4348,13 @@
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
+- (BOOL)_hasActiveVideoForControlsManager
+{
+ return _page && _page->hasActiveVideoForControlsManager();
+}
+#endif // PLATFORM(MAC)
+
</ins><span class="cx"> // Execute the supplied block after the next transaction from the WebProcess.
</span><span class="cx"> - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (200402 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-05-04 01:21:38 UTC (rev 200402)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -252,6 +252,10 @@
</span><span class="cx"> - (CGPoint)_convertPointFromViewToContents:(CGPoint)point WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !TARGET_OS_IPHONE
+@property (nonatomic, readonly) BOOL _hasActiveVideoForControlsManager WK_AVAILABLE(WK_MAC_TBA, NA);
+#endif
+
</ins><span class="cx"> - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (200402 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-04 01:21:38 UTC (rev 200402)
+++ trunk/Tools/ChangeLog        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-05-03 Beth Dakin <bdakin@apple.com>
+
+ Add VideoControlsManager tests
+ https://bugs.webkit.org/show_bug.cgi?id=157332
+ -and corresponding-
+ rdar://problem/24358431
+
+ Reviewed by Sam Weinig.
+
+ This patch adds three VideoControlsManager tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm: Added.
+ (-[DidPlayMessageHandler initWithWKWebView:]):
+ (-[DidPlayMessageHandler userContentController:didReceiveScriptMessage:]):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html: Added.
+
</ins><span class="cx"> 2016-05-03 Joanmarie Diggs <jdiggs@igalia.com>
</span><span class="cx">
</span><span class="cx"> [ATK] accessibility/document-attributes.html is failing
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (200402 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-04 01:21:38 UTC (rev 200402)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -293,8 +293,12 @@
</span><span class="cx">                 83CF1C301C4F1B8B00688447 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */; };
</span><span class="cx">                 930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
</span><span class="cx">                 9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
</span><ins>+                93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93625D261CD973AF006DC1F1 /* large-video-without-audio.html */; };
+                936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */; };
+                936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */; };
</ins><span class="cx">                 93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; };
</span><span class="cx">                 93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
</span><ins>+                93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */; };
</ins><span class="cx">                 93F1DB3414DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB3314DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp */; };
</span><span class="cx">                 93F1DB5714DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB5614DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp */; };
</span><span class="cx">                 93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */; };
</span><span class="lines">@@ -417,6 +421,9 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
+                                936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
+                                936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */,
</ins><span class="cx">                                 536770361CC81B6100D425B1 /* WebScriptObjectDescription.html in Copy Resources */,
</span><span class="cx">                                 57901FB11CAF142D00ED64F9 /* LoadInvalidURLRequest.html in Copy Resources */,
</span><span class="cx">                                 5714ECBD1CA8C22A00051AC8 /* DownloadRequestOriginalURL2.html in Copy Resources */,
</span><span class="lines">@@ -719,6 +726,9 @@
</span><span class="cx">                 930AD401150698B30067970F /* lots-of-text.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-text.html"; sourceTree = "<group>"; };
</span><span class="cx">                 9331407B17B4419000F083B1 /* DidNotHandleKeyDown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DidNotHandleKeyDown.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9361002814DC957B0061379D /* lots-of-iframes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-iframes.html"; sourceTree = "<group>"; };
</span><ins>+                93625D261CD973AF006DC1F1 /* large-video-without-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-without-audio.html"; sourceTree = "<group>"; };
+                936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-with-audio.html"; sourceTree = "<group>"; };
+                936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "large-video-with-audio.mp4"; sourceTree = "<group>"; };
</ins><span class="cx">                 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorOnBack.mm; sourceTree = "<group>"; };
</span><span class="cx">                 939BFE3918E5548900883275 /* StringTruncator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringTruncator.mm; sourceTree = "<group>"; };
</span><span class="cx">                 93A427A8180D9B0700CD24D7 /* RefPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefPtr.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -733,6 +743,7 @@
</span><span class="cx">                 93AF4ECF1506F123007FD57E /* lots-of-images.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-images.html"; sourceTree = "<group>"; };
</span><span class="cx">                 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "all-content-in-one-iframe.html"; sourceTree = "<group>"; };
</span><span class="cx">                 93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutMilestonesWithAllContentInFrame.cpp; sourceTree = "<group>"; };
</span><ins>+                93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoControlsManager.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 93F1DB3014DA20760024C362 /* NewFirstVisuallyNonEmptyLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayout.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93F1DB3314DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayout_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93F1DB5414DB1B730024C362 /* NewFirstVisuallyNonEmptyLayoutFails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFails.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -1052,6 +1063,7 @@
</span><span class="cx">                                 CD9E292B1C90A71F000BB800 /* RequiresUserActionForPlayback.mm */,
</span><span class="cx">                                 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
</span><span class="cx">                                 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
</span><ins>+                                93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
</ins><span class="cx">                                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
</span><span class="cx">                                 7C882E031C80C624006BF731 /* UserContentWorld.mm */,
</span><span class="cx">                                 7C882E041C80C624006BF731 /* UserContentWorldPlugIn.mm */,
</span><span class="lines">@@ -1141,6 +1153,9 @@
</span><span class="cx">                                 51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
</span><span class="cx">                                 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
</span><span class="cx">                                 51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
</span><ins>+                                936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */,
+                                936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */,
+                                93625D261CD973AF006DC1F1 /* large-video-without-audio.html */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Resources;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -1973,6 +1988,7 @@
</span><span class="cx">                                 1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */,
</span><span class="cx">                                 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */,
</span><span class="cx">                                 2D8104CC1BEC13E70020DA46 /* FindInPage.mm in Sources */,
</span><ins>+                                93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */,
</ins><span class="cx">                                 5798E2B01CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm in Sources */,
</span><span class="cx">                                 CD225C081C45A69200140761 /* ParsedContentRange.cpp in Sources */,
</span><span class="cx">                                 41973B5D1AF22875006C7B36 /* SharedBuffer.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (0 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+/*
+ * Copyright (C) 2016 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"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+
+static bool testedControlsManagerAfterPlaying;
+static bool receivedScriptMessage;
+
+@interface DidPlayMessageHandler : NSObject <WKScriptMessageHandler> {
+ RetainPtr<WKWebView> _webView;
+}
+
+@property (nonatomic) BOOL expectedToHaveControlsManager;
+
+- (instancetype)initWithWKWebView:(WKWebView*)webView;
+@end
+
+@implementation DidPlayMessageHandler
+
+- (instancetype)initWithWKWebView:(WKWebView*)webView
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _webView = webView;
+
+ return self;
+}
+
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
+{
+ receivedScriptMessage = true;
+
+ NSString *bodyString = (NSString *)[message body];
+ if ([bodyString isEqualToString:@"playing"]) {
+ BOOL hasControlsManager = [_webView _hasActiveVideoForControlsManager];
+ if (self.expectedToHaveControlsManager)
+ EXPECT_TRUE(hasControlsManager);
+ else
+ EXPECT_FALSE(hasControlsManager);
+ testedControlsManagerAfterPlaying = true;
+ }
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(VideoControlsManager, VideoControlsManagerSingleLargeVideo)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+ RetainPtr<DidPlayMessageHandler> handler = adoptNS([[DidPlayMessageHandler alloc] initWithWKWebView:webView.get()]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ // A large video with audio should have a controls manager even if it is played via script like this video.
+ // So the expectation is YES.
+ [handler setExpectedToHaveControlsManager:YES];
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"large-video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
+TEST(VideoControlsManager, VideoControlsManagerSingleSmallVideo)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+ RetainPtr<DidPlayMessageHandler> handler = adoptNS([[DidPlayMessageHandler alloc] initWithWKWebView:webView.get()]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ // A small video will not have a controls manager unless it started playing because of a user gesture. Since this
+ // video is started with a script, the expectation is NO.
+ [handler setExpectedToHaveControlsManager:NO];
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
+TEST(VideoControlsManager, VideoControlsManagerSingleLargeVideoWithoutAudio)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+ RetainPtr<DidPlayMessageHandler> handler = adoptNS([[DidPlayMessageHandler alloc] initWithWKWebView:webView.get()]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ // A large video with no audio will not have a controls manager unless it started playing because of a user gesture. Since this
+ // video is started with a script, the expectation is NO.
+ [handler setExpectedToHaveControlsManager:NO];
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"large-video-without-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
+TEST(VideoControlsManager, VideoControlsManagerAudioElementStartedWithScript)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+ RetainPtr<DidPlayMessageHandler> handler = adoptNS([[DidPlayMessageHandler alloc] initWithWKWebView:webView.get()]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ // An audio element MUST be started with a user gesture in order to have a controls manager, so the expectation is NO.
+ [handler setExpectedToHaveControlsManager:NO];
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"audio-only" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
+} // namespace TestWebKitAPI
+
+#endif // WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithaudiohtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html (0 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<html>
+<head>
+<script>
+ var timeout;
+
+ function go() {
+ var video = document.getElementsByTagName('video')[0];
+ timeout = window.setTimeout(notPlaying, 250);
+ video.addEventListener('playing', playing);
+ video.play();
+ }
+
+ function playing() {
+ window.clearTimeout(timeout);
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage('playing');
+ } catch(e) {
+ window.location = 'callback:playing';
+ }
+ }
+
+ function notPlaying() {
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage('not playing');
+ } catch(e) { }
+ }
+</script>
+</head>
+<body onload="go()">
+ <video id="test-video" src="large-video-with-audio.mp4" controls width=640 height=480></video>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithaudiomp4"></a>
<div class="binary"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoalargevideowithoutaudiohtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html (0 => 200403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html        2016-05-04 01:46:30 UTC (rev 200403)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<html>
+<head>
+<script>
+ var timeout;
+
+ function go() {
+ var video = document.getElementsByTagName('video')[0];
+ timeout = window.setTimeout(notPlaying, 250);
+ video.addEventListener('playing', playing);
+ video.play();
+ }
+
+ function playing() {
+ window.clearTimeout(timeout);
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage('playing');
+ } catch(e) {
+ window.location = 'callback:playing';
+ }
+ }
+
+ function notPlaying() {
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage('not playing');
+ } catch(e) { }
+ }
+</script>
+</head>
+<body onload="go()">
+ <video id="test-video" src="video-without-audio.mp4" controls width=640 height=480></video>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>