<!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>[210446] trunk/Tools</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/210446">210446</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-01-06 10:50:18 -0800 (Fri, 06 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Support webkit-test-runner key-value pairs in http tests
https://bugs.webkit.org/show_bug.cgi?id=149812

Patch by Antoine Quint &lt;graouts@apple.com&gt; on 2017-01-06
Reviewed by Alex Christensen.

We pass the absolute path for a test through to WKTR so that we can parse
tests that are running as URLs for webkit-test-runner options.

* DumpRenderTree/DumpRenderTreeCommon.cpp:
(parseInputLine):

Explicitly skip the --absolute-path option in DRT or else we'd crash.

* Scripts/webkitpy/port/driver.py:
(Driver._command_from_driver_input):

Pass the absolute path to the file through the CLI.

* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
(WTR::TestController::testOptionsForTest):
(WTR::parseInputLine):
(WTR::TestController::runTest):
* WebKitTestRunner/TestController.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreeCommoncpp">trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210445 => 210446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/ChangeLog        2017-01-06 18:50:18 UTC (rev 210446)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2017-01-06  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        Support webkit-test-runner key-value pairs in http tests
+        https://bugs.webkit.org/show_bug.cgi?id=149812
+
+        Reviewed by Alex Christensen.
+
+        We pass the absolute path for a test through to WKTR so that we can parse
+        tests that are running as URLs for webkit-test-runner options.
+
+        * DumpRenderTree/DumpRenderTreeCommon.cpp:
+        (parseInputLine):
+
+        Explicitly skip the --absolute-path option in DRT or else we'd crash.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._command_from_driver_input):
+
+        Pass the absolute path to the file through the CLI.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::updateTestOptionsFromTestHeader):
+        (WTR::TestController::testOptionsForTest):
+        (WTR::parseInputLine):
+        (WTR::TestController::runTest):
+        * WebKitTestRunner/TestController.h:
+
</ins><span class="cx"> 2017-01-06  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Warning about unconnectable outlets when opening a MiniBrowser window
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreeCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp (210445 => 210446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp        2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp        2017-01-06 18:50:18 UTC (rev 210446)
</span><span class="lines">@@ -104,6 +104,8 @@
</span><span class="cx">                 result.expectedPixelHash = tokenizer.next();
</span><span class="cx">         } else if (arg == &quot;--dump-jsconsolelog-in-stderr&quot;)
</span><span class="cx">             result.dumpJSConsoleLogInStdErr = true;
</span><ins>+        else if (arg == std::string(&quot;--absolutePath&quot;))
+            tokenizer.next();
</ins><span class="cx">         else
</span><span class="cx">             die(inputLine);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (210445 => 210446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2017-01-06 18:50:18 UTC (rev 210446)
</span><span class="lines">@@ -474,6 +474,8 @@
</span><span class="cx">             command = driver_input.test_name
</span><span class="cx">         elif self.is_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == &quot;cygwin&quot;)):
</span><span class="cx">             command = self.test_to_uri(driver_input.test_name)
</span><ins>+            command += &quot;'--absolutePath'&quot;
+            command += self._port.abspath_for_test(driver_input.test_name)
</ins><span class="cx">         else:
</span><span class="cx">             command = self._port.abspath_for_test(driver_input.test_name)
</span><span class="cx">             if sys.platform == 'cygwin':
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (210445 => 210446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2017-01-06 18:50:18 UTC (rev 210446)
</span><span class="lines">@@ -920,11 +920,15 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void updateTestOptionsFromTestHeader(TestOptions&amp; testOptions, const std::string&amp; pathOrURL)
</del><ins>+static void updateTestOptionsFromTestHeader(TestOptions&amp; testOptions, const std::string&amp; pathOrURL, const std::string&amp; absolutePath)
</ins><span class="cx"> {
</span><del>-    // Gross. Need to reduce conversions between all the string types and URLs.
-    WKRetainPtr&lt;WKURLRef&gt; wkURL(AdoptWK, createTestURL(pathOrURL.c_str()));
-    std::string filename = testPath(wkURL.get());
</del><ins>+    std::string filename = absolutePath;
+    if (filename.empty()) {
+        // Gross. Need to reduce conversions between all the string types and URLs.
+        WKRetainPtr&lt;WKURLRef&gt; wkURL(AdoptWK, createTestURL(pathOrURL.c_str()));
+        filename = testPath(wkURL.get());
+    }
+
</ins><span class="cx">     if (filename.empty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -982,15 +986,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TestOptions TestController::testOptionsForTest(const std::string&amp; pathOrURL) const
</del><ins>+TestOptions TestController::testOptionsForTest(const TestCommand&amp; command) const
</ins><span class="cx"> {
</span><del>-    TestOptions options(pathOrURL);
</del><ins>+    TestOptions options(command.pathOrURL);
</ins><span class="cx"> 
</span><span class="cx">     options.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
</span><span class="cx">     options.shouldShowWebView = m_shouldShowWebView;
</span><span class="cx"> 
</span><del>-    updatePlatformSpecificTestOptionsForTest(options, pathOrURL);
-    updateTestOptionsFromTestHeader(options, pathOrURL);
</del><ins>+    updatePlatformSpecificTestOptionsForTest(options, command.pathOrURL);
+    updateTestOptionsFromTestHeader(options, command.pathOrURL, command.absolutePath);
</ins><span class="cx"> 
</span><span class="cx">     return options;
</span><span class="cx"> }
</span><span class="lines">@@ -1021,14 +1025,6 @@
</span><span class="cx">     platformConfigureViewForTest(test);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-struct TestCommand {
-    std::string pathOrURL;
-    bool shouldDumpPixels { false };
-    std::string expectedPixelHash;
-    int timeout { 0 };
-    bool dumpJSConsoleLogInStdErr { false };
-};
-
</del><span class="cx"> class CommandTokenizer {
</span><span class="cx"> public:
</span><span class="cx">     explicit CommandTokenizer(const std::string&amp; input)
</span><span class="lines">@@ -1101,6 +1097,8 @@
</span><span class="cx">                 result.expectedPixelHash = tokenizer.next();
</span><span class="cx">         } else if (arg == std::string(&quot;--dump-jsconsolelog-in-stderr&quot;))
</span><span class="cx">             result.dumpJSConsoleLogInStdErr = true;
</span><ins>+        else if (arg == std::string(&quot;--absolutePath&quot;))
+            result.absolutePath = tokenizer.next();
</ins><span class="cx">         else
</span><span class="cx">             die(inputLine);
</span><span class="cx">     }
</span><span class="lines">@@ -1114,7 +1112,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_state = RunningTest;
</span><span class="cx">     
</span><del>-    TestOptions options = testOptionsForTest(command.pathOrURL);
</del><ins>+    TestOptions options = testOptionsForTest(command);
</ins><span class="cx"> 
</span><span class="cx">     WKRetainPtr&lt;WKURLRef&gt; wkURL(AdoptWK, createTestURL(command.pathOrURL.c_str()));
</span><span class="cx">     m_currentInvocation = std::make_unique&lt;TestInvocation&gt;(wkURL.get(), options);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (210445 => 210446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h        2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/WebKitTestRunner/TestController.h        2017-01-06 18:50:18 UTC (rev 210446)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> class OriginSettings;
</span><span class="cx"> class PlatformWebView;
</span><span class="cx"> class EventSenderProxy;
</span><ins>+struct TestCommand;
</ins><span class="cx"> struct TestOptions;
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Rename this TestRunner?
</span><span class="lines">@@ -177,7 +178,7 @@
</span><span class="cx">     void initializeTestPluginDirectory();
</span><span class="cx"> 
</span><span class="cx">     void ensureViewSupportsOptionsForTest(const TestInvocation&amp;);
</span><del>-    TestOptions testOptionsForTest(const std::string&amp; pathOrURL) const;
</del><ins>+    TestOptions testOptionsForTest(const TestCommand&amp;) const;
</ins><span class="cx">     void updatePlatformSpecificTestOptionsForTest(TestOptions&amp;, const std::string&amp; pathOrURL) const;
</span><span class="cx"> 
</span><span class="cx">     void updateWebViewSizeForTest(const TestInvocation&amp;);
</span><span class="lines">@@ -353,6 +354,15 @@
</span><span class="cx">     WorkQueueManager m_workQueueManager;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+struct TestCommand {
+    std::string pathOrURL;
+    std::string absolutePath;
+    bool shouldDumpPixels { false };
+    std::string expectedPixelHash;
+    int timeout { 0 };
+    bool dumpJSConsoleLogInStdErr { false };
+};
+
</ins><span class="cx"> } // namespace WTR
</span><span class="cx"> 
</span><span class="cx"> #endif // TestController_h
</span></span></pre>
</div>
</div>

</body>
</html>