<!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>[190368] 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/190368">190368</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-09-30 14:48:00 -0700 (Wed, 30 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Allow tests to generate user gestures for UI testing
https://bugs.webkit.org/show_bug.cgi?id=149653

Reviewed by Tim Horton.

Tools:

Expose functionality in UIScriptController to allow for testing single- and double-tap,
and to listen for completion of scrolling and zooming in the WKWebView.

Tap generation is done using synthetic IOHIDEvents, via a new HIDEventGenerator class
which hides the complexity of creating these events. Event dispatch is asynchronous.
We detect when the last event has been handled by dispatching a vendor-specific event,
which is detected via -_handleHIDEvent: in our UIApplication subclass.

* WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig: Link with IOKit.
* WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl: Two new properties
for 'will begin zooming' and 'did end zooming' callbacks, and functions to dispatch
single and double taps.
* WebKitTestRunner/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::registerCallback): Used to store the callbacks for zooming.
Unlike the &quot;task&quot; callbacks, these are persistent, but we store them in the same hash map.
(UIScriptContext::unregisterCallback):
(UIScriptContext::callbackWithID):
(UIScriptContext::fireCallback):
* WebKitTestRunner/UIScriptContext/UIScriptContext.h:
* WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setWillBeginZoomingCallback): Cross-platform code.
(WTR::UIScriptController::willBeginZoomingCallback): Ditto.
(WTR::UIScriptController::setDidEndZoomingCallback):
(WTR::UIScriptController::didEndZoomingCallback):
(WTR::UIScriptController::singleTapAtPoint): Non-iOS stub.
(WTR::UIScriptController::doubleTapAtPoint): Ditto.
(WTR::UIScriptController::platformSetWillBeginZoomingCallback):
(WTR::UIScriptController::platformSetDidEndZoomingCallback):
* WebKitTestRunner/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h: Properties for the zooming callbacks.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView zoomToScale:animated:completionHandler:]): Dispatch the zooming callback.
(-[TestRunnerWKWebView scrollViewWillBeginZooming:withView:]): Ditto.
(-[TestRunnerWKWebView scrollViewDidEndZooming:withView:atScale:]): Ditto.
(-[TestRunnerWKWebView onDidEndZooming:]): Deleted.
* WebKitTestRunner/ios/HIDEventGenerator.h: Copied from Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h.
* WebKitTestRunner/ios/HIDEventGenerator.m: Added.
(simpleDragCurve):
(calculateNextLocation):
(delayBetweenMove):
(+[HIDEventGenerator sharedHIDEventGenerator]):
(+[HIDEventGenerator nextEventCallbackID]):
(-[HIDEventGenerator init]):
(-[HIDEventGenerator _createIOHIDEventType:]):
(-[HIDEventGenerator _sendHIDEvent:]):
(-[HIDEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
(-[HIDEventGenerator _updateTouchPoints:count:]):
(-[HIDEventGenerator touchDownAtPoints:touchCount:]):
(-[HIDEventGenerator touchDown:touchCount:]):
(-[HIDEventGenerator touchDown:]):
(-[HIDEventGenerator liftUpAtPoints:touchCount:]):
(-[HIDEventGenerator liftUp:touchCount:]):
(-[HIDEventGenerator liftUp:]):
(-[HIDEventGenerator moveToPoints:touchCount:duration:]):
(-[HIDEventGenerator sendTaps:location:withNumberOfTouches:completionBlock:]):
(-[HIDEventGenerator tap:completionBlock:]):
(-[HIDEventGenerator doubleTap:completionBlock:]):
(-[HIDEventGenerator twoFingerTap:completionBlock:]):
(-[HIDEventGenerator dragWithStartPoint:endPoint:duration:completionBlock:]):
(-[HIDEventGenerator pinchCloseWithStartPoint:endPoint:duration:completionBlock:]):
(-[HIDEventGenerator pinchOpenWithStartPoint:endPoint:duration:completionBlock:]):
(-[HIDEventGenerator markerEventReceived:]):
* WebKitTestRunner/ios/IOKitSPI.h: Added.
* WebKitTestRunner/ios/UIKitSPI.h: Copied from Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h.
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::globalToContentCoordinates):
(WTR::UIScriptController::singleTapAtPoint):
(WTR::UIScriptController::doubleTapAtPoint):
(WTR::UIScriptController::platformSetWillBeginZoomingCallback):
(WTR::UIScriptController::platformSetDidEndZoomingCallback):
* WebKitTestRunner/ios/mainIOS.mm:
(-[WebKitTestRunnerApp _handleHIDEvent:]):

LayoutTests:

Simple tests for single tap triggering a click, and double-tap zoom.

* TestExpectations:
* fast/events/ios/double-tap-zoom-expected.txt: Added.
* fast/events/ios/double-tap-zoom.html: Added.
* fast/events/ios/single-tap-generates-click-expected.txt: Added.
* fast/events/ios/single-tap-generates-click.html: Added.
* platform/ios-simulator-wk2/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerConfigurationsWebKitTestRunnerAppxcconfig">trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptContextcpp">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptContexth">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercpp">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerh">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj">trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewh">trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm">trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosmainIOSmm">trunk/Tools/WebKitTestRunner/ios/mainIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/fast/events/ios/</li>
<li><a href="#trunkLayoutTestsfasteventsiosdoubletapzoomexpectedtxt">trunk/LayoutTests/fast/events/ios/double-tap-zoom-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsiosdoubletapzoomhtml">trunk/LayoutTests/fast/events/ios/double-tap-zoom.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsiossingletapgeneratesclickexpectedtxt">trunk/LayoutTests/fast/events/ios/single-tap-generates-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsiossingletapgeneratesclickhtml">trunk/LayoutTests/fast/events/ios/single-tap-generates-click.html</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosHIDEventGeneratorh">trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosHIDEventGeneratormm">trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosIOKitSPIh">trunk/Tools/WebKitTestRunner/ios/IOKitSPI.h</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIKitSPIh">trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/LayoutTests/ChangeLog        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-09-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS] Allow tests to generate user gestures for UI testing
+        https://bugs.webkit.org/show_bug.cgi?id=149653
+
+        Reviewed by Tim Horton.
+
+        Simple tests for single tap triggering a click, and double-tap zoom.
+
+        * TestExpectations:
+        * fast/events/ios/double-tap-zoom-expected.txt: Added.
+        * fast/events/ios/double-tap-zoom.html: Added.
+        * fast/events/ios/single-tap-generates-click-expected.txt: Added.
+        * fast/events/ios/single-tap-generates-click.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+
</ins><span class="cx"> 2015-09-30  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Add TypedArray.prototype functionality.
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/LayoutTests/TestExpectations        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> swipe [ Skip ]
</span><span class="cx"> fast/zooming/ios [ Skip ]
</span><span class="cx"> fast/viewport/ios [ Skip ]
</span><ins>+fast/events/ios [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> fast/forms/attributed-strings.html [ Skip ]
</span><span class="cx"> fast/scrolling/latching [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsiosdoubletapzoomexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/ios/double-tap-zoom-expected.txt (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/double-tap-zoom-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/ios/double-tap-zoom-expected.txt        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+Zoomed to scale 1.6
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsiosdoubletapzoomhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/ios/double-tap-zoom.html (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/double-tap-zoom.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/ios/double-tap-zoom.html        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0&quot;&gt;
+    &lt;script id=&quot;ui-script&quot; type=&quot;text/plain&quot;&gt;
+        (function() {
+            uiController.didEndZoomingCallback = function() {
+                uiController.uiScriptComplete('Zoomed to scale ' + uiController.zoomScale);
+            };
+
+            uiController.doubleTapAtPoint(50, 50, function() {});
+        })();
+    &lt;/script&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return document.getElementById('ui-script').text;
+        }
+
+        function runTest()
+        {
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getUIScript(), function(result) {
+                    document.getElementById('target').innerText = result;
+                    testRunner.notifyDone();
+                });
+            }
+        }
+    &lt;/script&gt;
+    &lt;style&gt;
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+
+&lt;div id=&quot;target&quot;&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsiossingletapgeneratesclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/ios/single-tap-generates-click-expected.txt (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/single-tap-generates-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/ios/single-tap-generates-click-expected.txt        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: received click event at 50 50
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsiossingletapgeneratesclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/ios/single-tap-generates-click.html (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/single-tap-generates-click.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/ios/single-tap-generates-click.html        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
+    &lt;script id=&quot;ui-script&quot; type=&quot;text/plain&quot;&gt;
+        (function() {
+            uiController.singleTapAtPoint(50, 50);
+        })();
+    &lt;/script&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return document.getElementById('ui-script').text;
+        }
+
+        function runTest()
+        {
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getUIScript(), function() {
+                    // Just wait for the tap.
+                });
+            }
+        }
+        
+        function boxClicked(event)
+        {
+            document.getElementById('target').textContent = 'PASS: received click event at ' + event.clientX + ' ' + event.clientY;
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+    &lt;/script&gt;
+    &lt;style&gt;
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+
+&lt;div id=&quot;target&quot; onclick=&quot;boxClicked(event)&quot;&gt;
+    FAIL: did not receive click event.
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -10,6 +10,7 @@
</span><span class="cx"> fast/harness/concurrent-ui-side-scripts.html [ Pass ]
</span><span class="cx"> fast/zooming/ios [ Pass ]
</span><span class="cx"> fast/viewport/ios [ Pass ]
</span><ins>+fast/events/ios [ Pass ]
</ins><span class="cx"> 
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End platform-specific directories.
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/ChangeLog        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -1,3 +1,84 @@
</span><ins>+2015-09-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS] Allow tests to generate user gestures for UI testing
+        https://bugs.webkit.org/show_bug.cgi?id=149653
+
+        Reviewed by Tim Horton.
+
+        Expose functionality in UIScriptController to allow for testing single- and double-tap,
+        and to listen for completion of scrolling and zooming in the WKWebView.
+        
+        Tap generation is done using synthetic IOHIDEvents, via a new HIDEventGenerator class
+        which hides the complexity of creating these events. Event dispatch is asynchronous.
+        We detect when the last event has been handled by dispatching a vendor-specific event,
+        which is detected via -_handleHIDEvent: in our UIApplication subclass.
+        
+        * WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig: Link with IOKit.
+        * WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl: Two new properties
+        for 'will begin zooming' and 'did end zooming' callbacks, and functions to dispatch
+        single and double taps.
+        * WebKitTestRunner/UIScriptContext/UIScriptContext.cpp:
+        (UIScriptContext::registerCallback): Used to store the callbacks for zooming.
+        Unlike the &quot;task&quot; callbacks, these are persistent, but we store them in the same hash map.
+        (UIScriptContext::unregisterCallback):
+        (UIScriptContext::callbackWithID):
+        (UIScriptContext::fireCallback):
+        * WebKitTestRunner/UIScriptContext/UIScriptContext.h:
+        * WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::setWillBeginZoomingCallback): Cross-platform code.
+        (WTR::UIScriptController::willBeginZoomingCallback): Ditto.
+        (WTR::UIScriptController::setDidEndZoomingCallback):
+        (WTR::UIScriptController::didEndZoomingCallback):
+        (WTR::UIScriptController::singleTapAtPoint): Non-iOS stub.
+        (WTR::UIScriptController::doubleTapAtPoint): Ditto.
+        (WTR::UIScriptController::platformSetWillBeginZoomingCallback):
+        (WTR::UIScriptController::platformSetDidEndZoomingCallback):
+        * WebKitTestRunner/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+        * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: Properties for the zooming callbacks.
+        * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+        (-[TestRunnerWKWebView zoomToScale:animated:completionHandler:]): Dispatch the zooming callback.
+        (-[TestRunnerWKWebView scrollViewWillBeginZooming:withView:]): Ditto.
+        (-[TestRunnerWKWebView scrollViewDidEndZooming:withView:atScale:]): Ditto.
+        (-[TestRunnerWKWebView onDidEndZooming:]): Deleted.
+        * WebKitTestRunner/ios/HIDEventGenerator.h: Copied from Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h.
+        * WebKitTestRunner/ios/HIDEventGenerator.m: Added.
+        (simpleDragCurve):
+        (calculateNextLocation):
+        (delayBetweenMove):
+        (+[HIDEventGenerator sharedHIDEventGenerator]):
+        (+[HIDEventGenerator nextEventCallbackID]):
+        (-[HIDEventGenerator init]):
+        (-[HIDEventGenerator _createIOHIDEventType:]):
+        (-[HIDEventGenerator _sendHIDEvent:]):
+        (-[HIDEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
+        (-[HIDEventGenerator _updateTouchPoints:count:]):
+        (-[HIDEventGenerator touchDownAtPoints:touchCount:]):
+        (-[HIDEventGenerator touchDown:touchCount:]):
+        (-[HIDEventGenerator touchDown:]):
+        (-[HIDEventGenerator liftUpAtPoints:touchCount:]):
+        (-[HIDEventGenerator liftUp:touchCount:]):
+        (-[HIDEventGenerator liftUp:]):
+        (-[HIDEventGenerator moveToPoints:touchCount:duration:]):
+        (-[HIDEventGenerator sendTaps:location:withNumberOfTouches:completionBlock:]):
+        (-[HIDEventGenerator tap:completionBlock:]):
+        (-[HIDEventGenerator doubleTap:completionBlock:]):
+        (-[HIDEventGenerator twoFingerTap:completionBlock:]):
+        (-[HIDEventGenerator dragWithStartPoint:endPoint:duration:completionBlock:]):
+        (-[HIDEventGenerator pinchCloseWithStartPoint:endPoint:duration:completionBlock:]):
+        (-[HIDEventGenerator pinchOpenWithStartPoint:endPoint:duration:completionBlock:]):
+        (-[HIDEventGenerator markerEventReceived:]):
+        * WebKitTestRunner/ios/IOKitSPI.h: Added.
+        * WebKitTestRunner/ios/UIKitSPI.h: Copied from Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h.
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::globalToContentCoordinates):
+        (WTR::UIScriptController::singleTapAtPoint):
+        (WTR::UIScriptController::doubleTapAtPoint):
+        (WTR::UIScriptController::platformSetWillBeginZoomingCallback):
+        (WTR::UIScriptController::platformSetDidEndZoomingCallback):
+        * WebKitTestRunner/ios/mainIOS.mm:
+        (-[WebKitTestRunnerApp _handleHIDEvent:]):
+
</ins><span class="cx"> 2015-09-30  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         git-add-reviewer should trim trailing spaces/newlines
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerConfigurationsWebKitTestRunnerAppxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> PRODUCT_NAME = WebKitTestRunner;
</span><span class="cx"> GCC_ENABLE_OBJC_EXCEPTIONS = YES;
</span><del>-OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -framework JavaScriptCore -framework CoreGraphics -framework ImageIO -framework UIKit -framework WebKit -framework Foundation;
</del><ins>+OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -framework JavaScriptCore -framework CoreGraphics -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
</ins><span class="cx"> SKIP_INSTALL[sdk=macosx*] = YES;
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = ios/* AppDelegate.m;
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = ios/Launch.storyboard;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -29,6 +29,16 @@
</span><span class="cx"> 
</span><span class="cx">     void zoomToScale(double scale, object callback);
</span><span class="cx"> 
</span><ins>+    // Interaction.
+    // These functions post events asynchronously. The callback is fired when the events have been disptached, but any
+    // resulting behavior may also be asynchronous.
+    void singleTapAtPoint(long x, long y, object callback);
+    void doubleTapAtPoint(long x, long y, object callback);
+
+    attribute object willBeginZoomingCallback;
+    attribute object didEndZoomingCallback;
+
+    // View state
</ins><span class="cx">     readonly attribute double zoomScale;
</span><span class="cx">     readonly attribute double minimumZoomScale;
</span><span class="cx">     readonly attribute double maximumZoomScale;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -102,6 +102,40 @@
</span><span class="cx">     m_currentScriptCallbackID = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+unsigned UIScriptContext::registerCallback(JSValueRef taskCallback)
+{
+    return prepareForAsyncTask(taskCallback);
+}
+
+void UIScriptContext::unregisterCallback(unsigned callbackID)
+{
+    Task task = m_callbacks.take(callbackID);
+    ASSERT(task.callback);
+    JSValueUnprotect(m_context.get(), task.callback);
+}
+
+JSValueRef UIScriptContext::callbackWithID(unsigned callbackID)
+{
+    Task task = m_callbacks.get(callbackID);
+    return task.callback;
+}
+
+void UIScriptContext::fireCallback(unsigned callbackID)
+{
+    Task task = m_callbacks.get(callbackID);
+    ASSERT(task.callback);
+
+    JSValueRef exception = nullptr;
+    JSObjectRef callbackObject = JSValueToObject(m_context.get(), task.callback, &amp;exception);
+
+    m_currentScriptCallbackID = task.parentScriptCallbackID;
+
+    exception = nullptr;
+    JSObjectCallAsFunction(m_context.get(), callbackObject, JSContextGetGlobalObject(m_context.get()), 0, nullptr, &amp;exception);
+    
+    m_currentScriptCallbackID = 0;
+}
+
</ins><span class="cx"> void UIScriptContext::uiScriptComplete(JSStringRef result)
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; uiScriptResult = WKStringCreateWithJSString(result);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptContexth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -47,9 +47,16 @@
</span><span class="cx">     void runUIScript(WKStringRef script, unsigned scriptCallbackID);
</span><span class="cx">     void uiScriptComplete(JSStringRef);
</span><span class="cx"> 
</span><ins>+    // For one-shot tasks callbacks.
</ins><span class="cx">     unsigned prepareForAsyncTask(JSValueRef taskCallback);
</span><span class="cx">     void asyncTaskComplete(unsigned taskCallbackID);
</span><span class="cx"> 
</span><ins>+    // For persistent callbacks.
+    unsigned registerCallback(JSValueRef taskCallback);
+    JSValueRef callbackWithID(unsigned callbackID);
+    void unregisterCallback(unsigned callbackID);
+    void fireCallback(unsigned callbackID);
+
</ins><span class="cx">     unsigned nextTaskCallbackID();
</span><span class="cx"> 
</span><span class="cx">     JSObjectRef objectFromRect(const WKRect&amp;) const;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSUIScriptController.h&quot;
</span><span class="cx"> #include &quot;UIScriptContext.h&quot;
</span><del>-// #include &lt;JavaScriptCore/JavaScriptCore.h&gt;
</del><ins>+#include &lt;JavaScriptCore/JSValueRef.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="cx"> 
</span><span class="lines">@@ -53,11 +53,41 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void UIScriptController::setWillBeginZoomingCallback(JSValueRef callback)
+{
+    m_willBeginZoomingCallback = m_context.registerCallback(callback);
+    platformSetWillBeginZoomingCallback();
+}
+
+JSValueRef UIScriptController::willBeginZoomingCallback() const
+{
+    return m_context.callbackWithID(m_willBeginZoomingCallback);
+}
+
+void UIScriptController::setDidEndZoomingCallback(JSValueRef callback)
+{
+    m_didEndZoomingCallback = m_context.registerCallback(callback);
+    platformSetDidEndZoomingCallback();
+}
+
+JSValueRef UIScriptController::didEndZoomingCallback() const
+{
+    return m_context.callbackWithID(m_didEndZoomingCallback);
+}
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> void UIScriptController::zoomToScale(double, JSValueRef)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::singleTapAtPoint(long x, long y, JSValueRef)
+{
+}
+
+void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef)
+{
+}
+
</ins><span class="cx"> double UIScriptController::zoomScale() const
</span><span class="cx"> {
</span><span class="cx">     return 1;
</span><span class="lines">@@ -77,6 +107,14 @@
</span><span class="cx"> {
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><ins>+
+void UIScriptController::platformSetWillBeginZoomingCallback()
+{
+}
+
+void UIScriptController::platformSetDidEndZoomingCallback()
+{
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void UIScriptController::uiScriptComplete(JSStringRef result)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -45,6 +45,15 @@
</span><span class="cx">     void doAsyncTask(JSValueRef callback);
</span><span class="cx">     void zoomToScale(double scale, JSValueRef callback);
</span><span class="cx"> 
</span><ins>+    void singleTapAtPoint(long x, long y, JSValueRef callback);
+    void doubleTapAtPoint(long x, long y, JSValueRef callback);
+    
+    void setWillBeginZoomingCallback(JSValueRef);
+    JSValueRef willBeginZoomingCallback() const;
+
+    void setDidEndZoomingCallback(JSValueRef);
+    JSValueRef didEndZoomingCallback() const;
+
</ins><span class="cx">     double zoomScale() const;
</span><span class="cx">     double minimumZoomScale() const;
</span><span class="cx">     double maximumZoomScale() const;
</span><span class="lines">@@ -55,12 +64,18 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     UIScriptController(UIScriptContext&amp;);
</span><ins>+    
+    void platformSetWillBeginZoomingCallback();
+    void platformSetDidEndZoomingCallback();
</ins><span class="cx"> 
</span><span class="cx">     virtual JSClassRef wrapperClass() override;
</span><span class="cx"> 
</span><span class="cx">     JSObjectRef objectFromRect(const WKRect&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     UIScriptContext&amp; m_context;
</span><ins>+
+    unsigned m_willBeginZoomingCallback { 0 };
+    unsigned m_didEndZoomingCallback { 0 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">                 0F87B6201BACDA93004EC572 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F87B61C1BACDA93004EC572 /* UIScriptController.cpp */; settings = {ASSET_TAGS = (); }; };
</span><span class="cx">                 0FEB90A01905A834000FDBF3 /* InjectedBundlePageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */; };
</span><span class="cx">                 0FEB90A51905C016000FDBF3 /* CrashReporterInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */; };
</span><ins>+                0FEBF85A1BB61DF20028722D /* HIDEventGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEBF8591BB61DF20028722D /* HIDEventGenerator.mm */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 29210EAE144CACB700835BB5 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */; };
</span><span class="cx">                 29210EB0144CACBD00835BB5 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */; };
</span><span class="cx">                 29210EB4144CACD500835BB5 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */; };
</span><span class="lines">@@ -189,6 +190,10 @@
</span><span class="cx">                 0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundlePageCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrashReporterInfo.h; path = cocoa/CrashReporterInfo.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CrashReporterInfo.mm; path = cocoa/CrashReporterInfo.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0FEBF8581BB61DF20028722D /* HIDEventGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIDEventGenerator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0FEBF8591BB61DF20028722D /* HIDEventGenerator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HIDEventGenerator.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0FEBF85B1BB62A370028722D /* IOKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IOKitSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0FEBF85C1BB62D460028722D /* UIKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIKitSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A3326051B75396500F89F62 /* TestOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestOptions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationProviderMock.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26D758E6160BECDD00268472 /* GeolocationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationProviderMock.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -551,6 +556,10 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 0F87B6181BACC558004EC572 /* Launch.storyboard */,
</span><span class="cx">                                 2EE52CEB1890A9A80010ED21 /* InfoPlist.strings */,
</span><ins>+                                0FEBF85B1BB62A370028722D /* IOKitSPI.h */,
+                                0FEBF85C1BB62D460028722D /* UIKitSPI.h */,
+                                0FEBF8581BB61DF20028722D /* HIDEventGenerator.h */,
+                                0FEBF8591BB61DF20028722D /* HIDEventGenerator.mm */,
</ins><span class="cx">                                 2EE52D131890A9FB0010ED21 /* PlatformWebViewIOS.mm */,
</span><span class="cx">                                 2EE52D141890A9FB0010ED21 /* TestControllerIOS.mm */,
</span><span class="cx">                                 0F73B55B1BA89042004B3EF4 /* UIScriptControllerIOS.mm */,
</span><span class="lines">@@ -914,6 +923,7 @@
</span><span class="cx">                                 2E63ED941891ADAD002A7AFC /* mainIOS.mm in Sources */,
</span><span class="cx">                                 2E63ED921891ADAD002A7AFC /* TestControllerIOS.mm in Sources */,
</span><span class="cx">                                 2E63ED9C1891ADC7002A7AFC /* AppDelegate.m in Sources */,
</span><ins>+                                0FEBF85A1BB61DF20028722D /* HIDEventGenerator.mm in Sources */,
</ins><span class="cx">                                 2E63ED911891ADAD002A7AFC /* PlatformWebViewIOS.mm in Sources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -30,8 +30,12 @@
</span><span class="cx"> @interface TestRunnerWKWebView : WKWebView
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+
+@property (nonatomic, copy) void (^willBeginZoomingCallback)(void);
+@property (nonatomic, copy) void (^didEndZoomingCallback)(void);
+
</ins><span class="cx"> - (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler;
</span><del>-- (void)onDidEndZooming:(void (^)(void))completionHandler;
</del><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> @interface WKWebView ()
</span><span class="cx"> 
</span><ins>+// FIXME: move these to WKWebView_Private.h
+- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view;
</ins><span class="cx"> - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale;
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="lines">@@ -41,7 +43,7 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><span class="cx"> @interface TestRunnerWKWebView ()
</span><del>-@property (nonatomic, copy) void (^zoomCompletionHandler)(void);
</del><ins>+@property (nonatomic, copy) void (^zoomToScaleCompletionHandler)(void);
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation TestRunnerWKWebView
</span><span class="lines">@@ -57,27 +59,32 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> - (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler
</span><span class="cx"> {
</span><del>-    ASSERT(!self.zoomCompletionHandler);
-    self.zoomCompletionHandler = completionHandler;
</del><ins>+    ASSERT(!self.zoomToScaleCompletionHandler);
+    self.zoomToScaleCompletionHandler = completionHandler;
</ins><span class="cx"> 
</span><span class="cx">     [self.scrollView setZoomScale:scale animated:animated];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view
+{
+    [super scrollViewWillBeginZooming:scrollView withView:view];
+
+    if (self.willBeginZoomingCallback)
+        self.willBeginZoomingCallback();
+}
+
</ins><span class="cx"> - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
</span><span class="cx"> {
</span><span class="cx">     [super scrollViewDidEndZooming:scrollView withView:view atScale:scale];
</span><span class="cx">     
</span><del>-    if (self.zoomCompletionHandler) {
-        self.zoomCompletionHandler();
-        self.zoomCompletionHandler = nullptr;
</del><ins>+    if (self.didEndZoomingCallback)
+        self.didEndZoomingCallback();
+
+    if (self.zoomToScaleCompletionHandler) {
+        self.zoomToScaleCompletionHandler();
+        self.zoomToScaleCompletionHandler = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><del>-
-- (void)onDidEndZooming:(void (^)(void))completionHandler
-{
-    ASSERT(!self.zoomCompletionHandler);
-    self.zoomCompletionHandler = completionHandler;
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosHIDEventGeneratorhfromrev190367trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h (from rev 190367, trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h) (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h                                (rev 0)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import &quot;UIKitSPI.h&quot;
+
+#import &lt;CoreGraphics/CGGeometry.h&gt;
+
+@interface HIDEventGenerator : NSObject
+
++ (HIDEventGenerator *)sharedHIDEventGenerator;
+
+// Touches
+- (void)touchDown:(CGPoint)location;
+- (void)liftUp:(CGPoint)location;
+- (void)moveToPoints:(CGPoint*)locations touchCount:(NSUInteger)count duration:(NSTimeInterval)seconds;
+
+// Taps
+- (void)tap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
+- (void)doubleTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
+- (void)twoFingerTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
+
+// Drags
+- (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
+
+// Pinches
+- (void)pinchCloseWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
+- (void)pinchOpenWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
+
+- (void)markerEventReceived:(IOHIDEventRef)event;
+
+@end
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosHIDEventGeneratormm"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm                                (rev 0)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,431 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;HIDEventGenerator.h&quot;
+
+#import &quot;IOKitSPI.h&quot;
+#import &quot;UIKitSPI.h&quot;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;mach/mach_time.h&gt;
+#import &lt;wtf/Assertions.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+SOFT_LINK_PRIVATE_FRAMEWORK(BackBoardServices)
+SOFT_LINK(BackBoardServices, BKSHIDEventSetDigitizerInfo, void, (IOHIDEventRef digitizerEvent, uint32_t contextID, uint8_t systemGestureisPossible, uint8_t isSystemGestureStateChangeEvent, CFStringRef displayUUID, CFTimeInterval initialTouchTimestamp, float maxForce), (digitizerEvent, contextID, systemGestureisPossible, isSystemGestureStateChangeEvent, displayUUID, initialTouchTimestamp, maxForce));
+
+static const NSTimeInterval fingerLiftDelay = 5e7;
+static const NSTimeInterval multiTapInterval = 15e7;
+static const NSTimeInterval fingerMoveInterval = 0.016;
+static const IOHIDFloat defaultMajorRadius = 5;
+static const IOHIDFloat defaultPathPressure = 0;
+static const NSUInteger maxTouchCount = 5;
+static const long nanosecondsPerSecond = 1e9;
+
+static int fingerIdentifiers[maxTouchCount] = { 2, 3, 4, 5, 1 };
+
+typedef enum {
+    HandEventNull,
+    HandEventTouched,
+    HandEventMoved,
+    HandEventChordChanged,
+    HandEventLifted,
+    HandEventCanceled,
+    HandEventInRange,
+    HandEventInRangeLift,
+} HandEventType;
+
+typedef struct {
+    int identifier;
+    CGPoint point;
+    IOHIDFloat pathMajorRadius;
+    IOHIDFloat pathPressure;
+    UInt8 pathProximity;
+} SyntheticEventDigitizerInfo;
+
+static CFTimeInterval secondsSinceAbsoluteTime(CFAbsoluteTime startTime)
+{
+    return (CFAbsoluteTimeGetCurrent() - startTime);
+}
+
+static double simpleDragCurve(double a, double b, double t)
+{
+    return (a + (b - a) * sin(sin(t * M_PI / 2) * t * M_PI / 2));
+}
+
+static CGPoint calculateNextLocation(CGPoint a, CGPoint b, CFTimeInterval t)
+{
+    return CGPointMake(simpleDragCurve(a.x, b.x, t), simpleDragCurve(a.y, b.y, t));
+}
+
+static void delayBetweenMove(int eventIndex, double elapsed)
+{
+    // Delay next event until expected elapsed time.
+    double delay = (eventIndex * fingerMoveInterval) - elapsed;
+    if (delay &gt; 0) {
+        struct timespec moveDelay = { 0, static_cast&lt;long&gt;(delay * nanosecondsPerSecond) };
+        nanosleep(&amp;moveDelay, NULL);
+    }   
+}
+
+@interface HIDEventGenerator ()
+@property (nonatomic, strong) NSMutableDictionary *eventCallbacks;
+@end
+
+@implementation HIDEventGenerator {
+    IOHIDEventSystemClientRef _ioSystemClient;
+    SyntheticEventDigitizerInfo _activePoints[maxTouchCount];
+    NSUInteger _activePointCount;
+}
+
++ (HIDEventGenerator *)sharedHIDEventGenerator
+{
+    static HIDEventGenerator *eventGenerator = nil;
+    if (!eventGenerator)
+        eventGenerator = [[HIDEventGenerator alloc] init];
+
+    return eventGenerator;
+}
+
++ (unsigned)nextEventCallbackID
+{
+    static unsigned callbackID = 0;
+    return ++callbackID;
+}
+
+- (instancetype)init
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    for (NSUInteger i = 0; i &lt; maxTouchCount; ++i)
+        _activePoints[i].identifier = fingerIdentifiers[i];
+
+    _eventCallbacks = [[NSMutableDictionary alloc] init];
+
+    return self;
+}
+
+- (IOHIDEventRef)_createIOHIDEventType:(HandEventType)eventType
+{
+    BOOL isTouching = (eventType == HandEventTouched || eventType == HandEventMoved || eventType == HandEventChordChanged);
+
+    IOHIDDigitizerEventMask eventMask = kIOHIDDigitizerEventTouch;
+    if (eventType == HandEventMoved) {
+        eventMask &amp;= ~kIOHIDDigitizerEventTouch;
+        eventMask |= kIOHIDDigitizerEventPosition;
+        eventMask |= kIOHIDDigitizerEventAttribute;
+    } else if (eventType == HandEventChordChanged) {
+        eventMask |= kIOHIDDigitizerEventPosition;
+        eventMask |= kIOHIDDigitizerEventAttribute;
+    } else if (eventType == HandEventTouched  || eventType == HandEventCanceled) {
+        eventMask |= kIOHIDDigitizerEventIdentity;
+    } else if (eventType == HandEventLifted)
+        eventMask |= kIOHIDDigitizerEventIdentity;
+
+    uint64_t machTime = mach_absolute_time();
+    RetainPtr&lt;IOHIDEventRef&gt; eventRef = adoptCF(IOHIDEventCreateDigitizerEvent(kCFAllocatorDefault, machTime,
+        kIOHIDDigitizerTransducerTypeHand,
+        0,
+        0,
+        eventMask,
+        0,
+        0, 0, 0,
+        0,
+        0,
+        0,
+        isTouching,
+        kIOHIDEventOptionNone));
+
+    IOHIDEventSetIntegerValue(eventRef.get(), kIOHIDEventFieldDigitizerIsDisplayIntegrated, 1);
+
+    for (NSUInteger i = 0; i &lt; _activePointCount; ++i) {
+        SyntheticEventDigitizerInfo* pointInfo = &amp;_activePoints[i];
+        if (eventType == HandEventTouched) {
+            if (!pointInfo-&gt;pathMajorRadius)
+                pointInfo-&gt;pathMajorRadius = defaultMajorRadius;
+            if (!pointInfo-&gt;pathPressure)
+                pointInfo-&gt;pathPressure = defaultPathPressure;
+            if (!pointInfo-&gt;pathProximity)
+                pointInfo-&gt;pathProximity = kGSEventPathInfoInTouch | kGSEventPathInfoInRange;
+        } else if (eventType == HandEventLifted || eventType == HandEventCanceled) {
+            pointInfo-&gt;pathMajorRadius = 0;
+            pointInfo-&gt;pathPressure = 0;
+            pointInfo-&gt;pathProximity = 0;
+        }
+
+        CGPoint point = pointInfo-&gt;point;
+        point = CGPointMake(roundf(point.x), roundf(point.y));
+        RetainPtr&lt;IOHIDEventRef&gt; subEvent = adoptCF(IOHIDEventCreateDigitizerFingerEvent(kCFAllocatorDefault, machTime,
+            pointInfo-&gt;identifier,
+            pointInfo-&gt;identifier,
+            eventMask,
+            point.x, point.y, 0,
+            pointInfo-&gt;pathPressure,
+            0,
+            pointInfo-&gt;pathProximity &amp; kGSEventPathInfoInRange,
+            pointInfo-&gt;pathProximity &amp; kGSEventPathInfoInTouch,
+            kIOHIDEventOptionNone));
+        IOHIDEventSetFloatValue(subEvent.get(), kIOHIDEventFieldDigitizerMajorRadius, pointInfo-&gt;pathMajorRadius);
+        IOHIDEventSetFloatValue(subEvent.get(), kIOHIDEventFieldDigitizerMinorRadius, pointInfo-&gt;pathMajorRadius);
+        IOHIDEventAppendEvent(eventRef.get(), subEvent.get(), 0);
+    }
+
+    if (_activePointCount) {
+        IOHIDFloat progress = _activePoints[0].pathPressure;
+        RetainPtr&lt;IOHIDEventRef&gt; forceEvent = adoptCF(IOHIDEventCreateForceEvent(kCFAllocatorDefault,
+            machTime,
+            0,
+            progress,
+            0,
+            0.0,
+            kIOHIDEventOptionNone));
+        IOHIDEventAppendEvent(eventRef.get(), forceEvent.get(), 0);
+    }
+
+    return eventRef.leakRef();
+}
+
+- (BOOL)_sendHIDEvent:(IOHIDEventRef)eventRef
+{
+    if (!_ioSystemClient)
+        _ioSystemClient = IOHIDEventSystemClientCreate(kCFAllocatorDefault);
+
+    if (eventRef) {
+        RetainPtr&lt;IOHIDEventRef&gt; strongEvent = eventRef;
+        dispatch_async(dispatch_get_main_queue(), ^{
+            uint32_t contextID = [UIApplication sharedApplication].keyWindow._contextId;
+            ASSERT(contextID);
+            BKSHIDEventSetDigitizerInfo(strongEvent.get(), contextID, false, false, NULL, 0, 0);
+            [[UIApplication sharedApplication] _enqueueHIDEvent:strongEvent.get()];
+        });
+    }
+    return YES;
+}
+
+- (BOOL)_sendMarkerHIDEventWithCompletionBlock:(void (^)(void))completionBlock
+{
+    unsigned callbackID = [HIDEventGenerator nextEventCallbackID];
+    void (^completionBlockCopy)() = Block_copy(completionBlock);
+    [_eventCallbacks setObject:completionBlockCopy forKey:@(callbackID)];
+
+    uint64_t machTime = mach_absolute_time();
+    RetainPtr&lt;IOHIDEventRef&gt; markerEvent = adoptCF(IOHIDEventCreateVendorDefinedEvent(kCFAllocatorDefault,
+        machTime,
+        kHIDPage_VendorDefinedStart + 100,
+        0,
+        1,
+        (uint8_t*)&amp;callbackID,
+        sizeof(unsigned),
+        kIOHIDEventOptionNone));
+    
+    if (markerEvent) {
+        markerEvent.get();
+        dispatch_async(dispatch_get_main_queue(), ^{
+            uint32_t contextID = [UIApplication sharedApplication].keyWindow._contextId;
+            ASSERT(contextID);
+            BKSHIDEventSetDigitizerInfo(markerEvent.get(), contextID, false, false, NULL, 0, 0);
+            [[UIApplication sharedApplication] _enqueueHIDEvent:markerEvent.get()];
+        });
+    }
+    return YES;
+}
+
+- (void)_updateTouchPoints:(CGPoint*)points count:(NSUInteger)count
+{
+    HandEventType handEventType;
+    
+    // The hand event type is based on previous state.
+    if (!_activePointCount)
+        handEventType = HandEventTouched;
+    else if (!count)
+        handEventType = HandEventLifted;
+    else if (count == _activePointCount)
+        handEventType = HandEventMoved;
+    else
+        handEventType = HandEventChordChanged;
+    
+    // Update previous count for next event.
+    _activePointCount = count;
+
+    // Update point locations.
+    for (NSUInteger i = 0; i &lt; count; ++i)
+        _activePoints[i].point = points[i];
+    
+    RetainPtr&lt;IOHIDEventRef&gt; eventRef = adoptCF([self _createIOHIDEventType:handEventType]);
+    [self _sendHIDEvent:eventRef.get()];
+}
+
+- (void)touchDownAtPoints:(CGPoint*)locations touchCount:(NSUInteger)touchCount
+{
+    touchCount = MIN(touchCount, maxTouchCount);
+
+    _activePointCount = touchCount;
+
+    for (NSUInteger index = 0; index &lt; touchCount; ++index)
+        _activePoints[index].point = locations[index];
+
+    RetainPtr&lt;IOHIDEventRef&gt; eventRef = adoptCF([self _createIOHIDEventType:HandEventTouched]);
+    [self _sendHIDEvent:eventRef.get()];
+}
+
+- (void)touchDown:(CGPoint)location touchCount:(NSUInteger)touchCount
+{
+    touchCount = MIN(touchCount, maxTouchCount);
+
+    CGPoint locations[touchCount];
+
+    for (NSUInteger index = 0; index &lt; touchCount; ++index)
+        locations[index] = location;
+    
+    [self touchDownAtPoints:locations touchCount:touchCount];
+}
+
+- (void)touchDown:(CGPoint)location
+{
+    [self touchDownAtPoints:&amp;location touchCount:1];
+}
+
+- (void)liftUpAtPoints:(CGPoint*)locations touchCount:(NSUInteger)touchCount
+{
+    touchCount = MIN(touchCount, maxTouchCount);
+    touchCount = MIN(touchCount, _activePointCount);
+
+    NSUInteger newPointCount = _activePointCount - touchCount;
+
+    for (NSUInteger index = 0; index &lt; touchCount; ++index)
+        _activePoints[newPointCount + index].point = locations[index];
+    
+    RetainPtr&lt;IOHIDEventRef&gt; eventRef = adoptCF([self _createIOHIDEventType:HandEventLifted]);
+    [self _sendHIDEvent:eventRef.get()];
+    
+    _activePointCount = newPointCount;
+}
+
+- (void)liftUp:(CGPoint)location touchCount:(NSUInteger)touchCount
+{
+    touchCount = MIN(touchCount, maxTouchCount);
+
+    CGPoint locations[touchCount];
+
+    for (NSUInteger index = 0; index &lt; touchCount; ++index)
+        locations[index] = location;
+    
+    [self liftUpAtPoints:locations touchCount:touchCount];
+}
+
+- (void)liftUp:(CGPoint)location
+{
+    [self liftUp:location touchCount:1];
+}
+
+- (void)moveToPoints:(CGPoint*)newLocations touchCount:(NSUInteger)touchCount duration:(NSTimeInterval)seconds
+{
+    touchCount = MIN(touchCount, maxTouchCount);
+
+    CGPoint startLocations[touchCount];
+    CGPoint nextLocations[touchCount];
+
+    CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent();
+    CFTimeInterval elapsed = 0;
+
+    int eventIndex = 0;
+    while (elapsed &lt; (seconds - fingerMoveInterval)) {
+        elapsed = secondsSinceAbsoluteTime(startTime);
+        CFTimeInterval interval = elapsed / seconds;
+        
+        for (NSUInteger i = 0; i &lt; touchCount; ++i) {
+            if (!eventIndex)
+                startLocations[i] = _activePoints[i].point;
+
+            nextLocations[i] = calculateNextLocation(startLocations[i], newLocations[i], interval);
+        }
+        [self _updateTouchPoints:nextLocations count:touchCount];
+
+        delayBetweenMove(eventIndex++, elapsed);
+    }
+
+    [self _updateTouchPoints:newLocations count:touchCount];
+}
+
+- (void)sendTaps:(int)tapCount location:(CGPoint)location withNumberOfTouches:(int)touchCount completionBlock:(void (^)(void))completionBlock
+{
+    struct timespec doubleDelay = { 0, static_cast&lt;long&gt;(multiTapInterval) };
+    struct timespec pressDelay = { 0, static_cast&lt;long&gt;(fingerLiftDelay) };
+
+    for (int i = 0; i &lt; tapCount; i++) {
+        [self touchDown:location touchCount:touchCount];
+        nanosleep(&amp;pressDelay, 0);
+        [self liftUp:location touchCount:touchCount];
+        if (i + 1 != tapCount) 
+            nanosleep(&amp;doubleDelay, 0);
+    }
+    
+    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
+}
+
+- (void)tap:(CGPoint)location completionBlock:(void (^)(void))completionBlock
+{
+    [self sendTaps:1 location:location withNumberOfTouches:1 completionBlock:completionBlock];
+}
+
+- (void)doubleTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock
+{
+    [self sendTaps:2 location:location withNumberOfTouches:1 completionBlock:completionBlock];
+}
+
+- (void)twoFingerTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock
+{
+    [self sendTaps:1 location:location withNumberOfTouches:2 completionBlock:completionBlock];
+}
+
+- (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock
+{
+}
+
+- (void)pinchCloseWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock
+{
+}
+
+- (void)pinchOpenWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock
+{
+}
+
+- (void)markerEventReceived:(IOHIDEventRef)event
+{
+    if (IOHIDEventGetType(event) != kIOHIDEventTypeVendorDefined)
+        return;
+
+    CFIndex callbackID = IOHIDEventGetIntegerValue(event, kIOHIDEventFieldVendorDefinedData);
+    void (^completionBlock)() = [_eventCallbacks objectForKey:@(callbackID)];
+    if (completionBlock) {
+        [_eventCallbacks removeObjectForKey:@(callbackID)];
+        completionBlock();
+        Block_release(completionBlock);
+    }
+}
+
+@end
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosIOKitSPIh"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/ios/IOKitSPI.h (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/IOKitSPI.h                                (rev 0)
+++ trunk/Tools/WebKitTestRunner/ios/IOKitSPI.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,136 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef IOKitSPI_h
+#define IOKitSPI_h
+
+#import &lt;wtf/Platform.h&gt;
+
+#if PLATFORM(IOS)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import &lt;IOKit/hid/IOHIDEvent.h&gt;
+#import &lt;IOKit/hid/IOHIDEventSystemClient.h&gt;
+#import &lt;IOKit/hid/IOHIDUsageTables.h&gt;
+
+#else
+
+WTF_EXTERN_C_BEGIN
+
+#ifdef __LP64__
+typedef double IOHIDFloat;
+#else
+typedef float IOHIDFloat;
+#endif
+
+enum {
+    kIOHIDEventOptionNone = 0,
+};
+
+typedef UInt32 IOOptionBits;
+typedef uint32_t IOHIDEventOptionBits;
+typedef uint32_t IOHIDEventField;
+
+typedef struct __IOHIDEventSystemClient * IOHIDEventSystemClientRef;
+typedef struct __IOHIDEvent * IOHIDEventRef;
+
+#define IOHIDEventFieldBase(type) (type &lt;&lt; 16)
+
+enum {
+    kHIDPage_VendorDefinedStart     = 0xFF00
+};
+
+enum {
+    kIOHIDDigitizerEventRange       = 1&lt;&lt;0,
+    kIOHIDDigitizerEventTouch       = 1&lt;&lt;1,
+    kIOHIDDigitizerEventPosition    = 1&lt;&lt;2,
+    kIOHIDDigitizerEventIdentity    = 1&lt;&lt;5,
+    kIOHIDDigitizerEventAttribute   = 1&lt;&lt;6,
+    kIOHIDDigitizerEventCancel      = 1&lt;&lt;7,
+    kIOHIDDigitizerEventStart       = 1&lt;&lt;8,
+};
+typedef uint32_t IOHIDDigitizerEventMask;
+
+enum {
+    kIOHIDEventTypeNULL,
+    kIOHIDEventTypeVendorDefined,
+    kIOHIDEventTypeKeyboard = 3,
+    kIOHIDEventTypeDigitizer = 11,
+};
+typedef uint32_t IOHIDEventType;
+
+enum {
+    kIOHIDEventFieldVendorDefinedUsagePage = IOHIDEventFieldBase(kIOHIDEventTypeVendorDefined),
+    kIOHIDEventFieldVendorDefinedReserved,
+    kIOHIDEventFieldVendorDefinedReserved1,
+    kIOHIDEventFieldVendorDefinedDataLength,
+    kIOHIDEventFieldVendorDefinedData
+};
+
+enum {
+    kIOHIDEventFieldDigitizerX = IOHIDEventFieldBase(kIOHIDEventTypeDigitizer),
+    kIOHIDEventFieldDigitizerY,
+    kIOHIDEventFieldDigitizerMajorRadius = kIOHIDEventFieldDigitizerX + 20,
+    kIOHIDEventFieldDigitizerMinorRadius,
+    kIOHIDEventFieldDigitizerIsDisplayIntegrated = kIOHIDEventFieldDigitizerMajorRadius + 5,
+};
+
+enum {
+    kIOHIDDigitizerTransducerTypeHand = 3
+};
+typedef uint32_t IOHIDDigitizerTransducerType;
+
+IOHIDEventRef IOHIDEventCreateDigitizerEvent(CFAllocatorRef, uint64_t, IOHIDDigitizerTransducerType, uint32_t, uint32_t, IOHIDDigitizerEventMask, uint32_t, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, boolean_t, boolean_t, IOOptionBits);
+
+IOHIDEventRef IOHIDEventCreateDigitizerFingerEvent(CFAllocatorRef, uint64_t, uint32_t, uint32_t, IOHIDDigitizerEventMask, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, boolean_t, boolean_t, IOHIDEventOptionBits);
+
+IOHIDEventRef IOHIDEventCreateForceEvent(CFAllocatorRef, uint64_t, uint32_t, IOHIDFloat, uint32_t, IOHIDFloat, IOHIDEventOptionBits);
+
+IOHIDEventRef IOHIDEventCreateKeyboardEvent(CFAllocatorRef, uint64_t, uint32_t, uint32_t, boolean_t, IOOptionBits);
+
+IOHIDEventRef IOHIDEventCreateVendorDefinedEvent(CFAllocatorRef, uint64_t, uint32_t, uint32_t, uint32_t, uint8_t*, CFIndex, IOHIDEventOptionBits);
+
+IOHIDEventType IOHIDEventGetType(IOHIDEventRef);
+
+void IOHIDEventSetFloatValue(IOHIDEventRef, IOHIDEventField, IOHIDFloat);
+
+CFIndex IOHIDEventGetIntegerValue(IOHIDEventRef, IOHIDEventField);
+void IOHIDEventSetIntegerValue(IOHIDEventRef, IOHIDEventField, CFIndex);
+
+void IOHIDEventAppendEvent(IOHIDEventRef, IOHIDEventRef, IOOptionBits);
+
+IOHIDEventSystemClientRef IOHIDEventSystemClientCreate(CFAllocatorRef);
+
+#define kGSEventPathInfoInRange (1 &lt;&lt; 0)
+#define kGSEventPathInfoInTouch (1 &lt;&lt; 1)
+
+WTF_EXTERN_C_END
+
+#endif // USE(APPLE_INTERNAL_SDK)
+
+#endif // PLATFORM(IOS)
+
+#endif // IOKitSPI_h
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIKitSPIhfromrev190367trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h (from rev 190367, trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h) (0 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h                                (rev 0)
+++ trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -0,0 +1,46 @@
</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.
+ */
+
+#import &lt;UIKit/UIKit.h&gt;
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import &lt;UIKit/UIApplication_Private.h&gt;
+#import &lt;UIKit/UIWindow_Private.h&gt;
+
+#else
+
+#import &quot;IOKitSPI.h&quot;
+
+@interface UIApplication ()
+- (void)_enqueueHIDEvent:(IOHIDEventRef)event;
+- (void)_handleHIDEvent:(IOHIDEventRef)event;
+@end
+
+@interface UIWindow ()
+- (uint32_t)_contextId;
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><ins>+#import &quot;HIDEventGenerator.h&quot;
</ins><span class="cx"> #import &quot;PlatformWebView.h&quot;
</span><span class="cx"> #import &quot;TestController.h&quot;
</span><span class="cx"> #import &quot;TestRunnerWKWebView.h&quot;
</span><span class="lines">@@ -64,6 +65,33 @@
</span><span class="cx">     return webView.scrollView.zoomScale;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static CGPoint globalToContentCoordinates(TestRunnerWKWebView *webView, long x, long y)
+{
+    CGPoint point = CGPointMake(x, y);
+    point = [webView _convertPointFromContentsToView:point];
+    point = [webView convertPoint:point toView:nil];
+    point = [webView.window convertPoint:point toWindow:nil];
+    return point;
+}
+
+void UIScriptController::singleTapAtPoint(long x, long y, JSValueRef callback)
+{
+    unsigned callbackID = m_context.prepareForAsyncTask(callback);
+
+    [[HIDEventGenerator sharedHIDEventGenerator] tap:globalToContentCoordinates(TestController::singleton().mainWebView()-&gt;platformView(), x, y) completionBlock:^{
+        m_context.asyncTaskComplete(callbackID);
+    }];
+}
+
+void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef callback)
+{
+    unsigned callbackID = m_context.prepareForAsyncTask(callback);
+
+    [[HIDEventGenerator sharedHIDEventGenerator] doubleTap:globalToContentCoordinates(TestController::singleton().mainWebView()-&gt;platformView(), x, y) completionBlock:^{
+        m_context.asyncTaskComplete(callbackID);
+    }];
+}
+
</ins><span class="cx"> double UIScriptController::minimumZoomScale() const
</span><span class="cx"> {
</span><span class="cx">     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
</span><span class="lines">@@ -86,6 +114,22 @@
</span><span class="cx">     return m_context.objectFromRect(wkRect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::platformSetWillBeginZoomingCallback()
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
+    webView.willBeginZoomingCallback = ^{
+        m_context.fireCallback(m_willBeginZoomingCallback);
+    };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::platformSetDidEndZoomingCallback()
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
+    webView.didEndZoomingCallback = ^{
+        m_context.fireCallback(m_didEndZoomingCallback);
+    };
+}
+
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosmainIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/mainIOS.mm (190367 => 190368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/mainIOS.mm        2015-09-30 21:00:42 UTC (rev 190367)
+++ trunk/Tools/WebKitTestRunner/ios/mainIOS.mm        2015-09-30 21:48:00 UTC (rev 190368)
</span><span class="lines">@@ -25,7 +25,9 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> 
</span><ins>+#import &quot;HIDEventGenerator.h&quot;
</ins><span class="cx"> #import &quot;TestController.h&quot;
</span><ins>+#import &quot;UIKitSPI.h&quot;
</ins><span class="cx"> #import &lt;UIKit/UIKit.h&gt;
</span><span class="cx"> 
</span><span class="cx"> static int _argc;
</span><span class="lines">@@ -70,6 +72,11 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_handleHIDEvent:(IOHIDEventRef)event
+{
+    [[HIDEventGenerator sharedHIDEventGenerator] markerEventReceived:event];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> int main(int argc, const char* argv[])
</span></span></pre>
</div>
</div>

</body>
</html>