<!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>[176602] trunk/LayoutTests</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/176602">176602</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-12-01 13:15:42 -0800 (Mon, 01 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>http tests should not use shared temporary files, part 3
https://bugs.webkit.org/show_bug.cgi?id=139135

Reviewed by Tim Horton.

Fix ping tests, using the same techniques as before.

* http/tests/navigation/image-load-in-unload-handler.html:
* http/tests/navigation/ping-cross-origin-from-https.html:
* http/tests/navigation/resources/check-ping.php:
* http/tests/navigation/resources/delete-ping.php:
* http/tests/navigation/resources/image-load-in-unload-handler-2.html: Copied from LayoutTests/http/tests/navigation/resources/ping-redirect.html.
* http/tests/navigation/resources/ping-file-path.php: Copied from LayoutTests/http/tests/security/contentSecurityPolicy/resources/report-file-path.php.
* http/tests/navigation/resources/ping-redirect.html: Removed.
* http/tests/navigation/resources/save-Ping.php:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationimageloadinunloadhandlerhtml">trunk/LayoutTests/http/tests/navigation/image-load-in-unload-handler.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationpingcrossoriginfromhttpshtml">trunk/LayoutTests/http/tests/navigation/ping-cross-origin-from-https.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcescheckpingphp">trunk/LayoutTests/http/tests/navigation/resources/check-ping.php</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcesdeletepingphp">trunk/LayoutTests/http/tests/navigation/resources/delete-ping.php</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcessavePingphp">trunk/LayoutTests/http/tests/navigation/resources/save-Ping.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcesimageloadinunloadhandler2html">trunk/LayoutTests/http/tests/navigation/resources/image-load-in-unload-handler-2.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcespingfilepathphp">trunk/LayoutTests/http/tests/navigation/resources/ping-file-path.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcespingredirecthtml">trunk/LayoutTests/http/tests/navigation/resources/ping-redirect.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/ChangeLog        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2014-12-01  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        http tests should not use shared temporary files, part 3
+        https://bugs.webkit.org/show_bug.cgi?id=139135
+
+        Reviewed by Tim Horton.
+
+        Fix ping tests, using the same techniques as before.
+
+        * http/tests/navigation/image-load-in-unload-handler.html:
+        * http/tests/navigation/ping-cross-origin-from-https.html:
+        * http/tests/navigation/resources/check-ping.php:
+        * http/tests/navigation/resources/delete-ping.php:
+        * http/tests/navigation/resources/image-load-in-unload-handler-2.html: Copied from LayoutTests/http/tests/navigation/resources/ping-redirect.html.
+        * http/tests/navigation/resources/ping-file-path.php: Copied from LayoutTests/http/tests/security/contentSecurityPolicy/resources/report-file-path.php.
+        * http/tests/navigation/resources/ping-redirect.html: Removed.
+        * http/tests/navigation/resources/save-Ping.php:
+
+2014-12-01  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
</ins><span class="cx">         &lt;rdar://problem/11358748&gt; http/tests/multipart/multipart-wait-before-boundary.html fails on ML as of r115745
</span><span class="cx"> 
</span><span class="cx">         Looks like it no longer fails.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationimageloadinunloadhandlerhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/navigation/image-load-in-unload-handler.html (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/image-load-in-unload-handler.html        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/image-load-in-unload-handler.html        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx">     // page being navigated to. Instead, we go through a dummy redirect page,
</span><span class="cx">     // to make sure that the onunload handler has run before we get to 
</span><span class="cx">     // check-ping.php.
</span><del>-    location.assign(&quot;resources/ping-redirect.html&quot;);
</del><ins>+    location.assign(&quot;resources/image-load-in-unload-handler-2.html&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function ping() {
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationpingcrossoriginfromhttpshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/navigation/ping-cross-origin-from-https.html (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/ping-cross-origin-from-https.html        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/ping-cross-origin-from-https.html        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -8,6 +8,34 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (location.protocol != &quot;https:&quot;)
</span><del>-    location = &quot;https://127.0.0.1:8443/navigation/ping-cross-origin.html&quot;
</del><ins>+    location = &quot;https://127.0.0.1:8443/navigation/ping-cross-origin-from-https.html&quot;
+
+var testCalled = false;
+
+function test() {
+    if (!testCalled) {
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.overridePreference(&quot;WebKitHyperlinkAuditingEnabled&quot;, 1);
+            testRunner.waitUntilDone();
+        }
+        testCalled = true;
+        return;
+    }
+
+    if (window.eventSender) {
+        var a = document.getElementById(&quot;a&quot;);
+        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
+}
+
</ins><span class="cx"> &lt;/script&gt;
</span><del>-&lt;/head&gt;&lt;/html&gt;
</del><ins>+&lt;/head&gt;
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test();&quot;&gt;
+&lt;img src=&quot;resources/delete-ping.php&quot; onload=&quot;test();&quot; onerror=&quot;test();&quot;&gt;&lt;/img&gt;
+&lt;a id=&quot;a&quot; href=&quot;resources/check-ping.php&quot; ping=&quot;http://localhost:8000/navigation/resources/save-Ping.php?test=/navigation/ping-cross-origin-from-https.html&quot;&gt;Navigate and send ping&lt;/a&gt;
+&lt;/body&gt;&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcescheckpingphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/navigation/resources/check-ping.php (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/check-ping.php        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/resources/check-ping.php        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -1,5 +1,7 @@
</span><span class="cx"> &lt;?php
</span><del>-while (!file_exists(&quot;ping.txt&quot;)) {
</del><ins>+require_once 'ping-file-path.php';
+
+while (!file_exists($pingFilePath)) {
</ins><span class="cx">     usleep(10000);
</span><span class="cx">     // file_exists() caches results, we want to invalidate the cache.
</span><span class="cx">     clearstatcache();
</span><span class="lines">@@ -7,13 +9,13 @@
</span><span class="cx"> 
</span><span class="cx"> echo &quot;&lt;html&gt;&lt;body&gt;\n&quot;;
</span><span class="cx"> echo &quot;Ping sent successfully&quot;;
</span><del>-$pingFile = fopen(&quot;ping.txt&quot;, 'r');
</del><ins>+$pingFile = fopen($pingFilePath, 'r');
</ins><span class="cx"> while ($line = fgets($pingFile)) {
</span><span class="cx">     echo &quot;&lt;br&gt;&quot;;
</span><span class="cx">     echo trim($line);
</span><span class="cx"> }
</span><span class="cx"> fclose($pingFile);
</span><del>-unlink(&quot;ping.txt&quot;);
</del><ins>+unlink($pingFilePath);
</ins><span class="cx"> echo &quot;&lt;script&gt;&quot;;
</span><span class="cx"> echo &quot;if (window.testRunner)&quot;;
</span><span class="cx"> echo &quot;    testRunner.notifyDone();&quot;;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcesdeletepingphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/navigation/resources/delete-ping.php (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/delete-ping.php        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/resources/delete-ping.php        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -1,3 +1,5 @@
</span><span class="cx"> &lt;?php
</span><del>-unlink(&quot;ping.txt&quot;);
</del><ins>+require_once 'ping-file-path.php';
+
+unlink($pingFilePath);
</ins><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcesimageloadinunloadhandler2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/resources/image-load-in-unload-handler-2.html (0 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/image-load-in-unload-handler-2.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/image-load-in-unload-handler-2.html        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;script&gt;
+location.href = 'check-ping.php?test=/navigation/image-load-in-unload-handler.html';
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcespingfilepathphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/resources/ping-file-path.php (0 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/ping-file-path.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/ping-file-path.php        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;?php
+require_once '../../resources/portabilityLayer.php';
+
+if (isset($_GET['test'])) {
+    $pingFilePath = sys_get_temp_dir() . &quot;/&quot; . str_replace(&quot;/&quot;, &quot;-&quot;, $_GET['test']) . &quot;.ping.txt&quot;; 
+} elseif (isset($_SERVER[&quot;HTTP_REFERER&quot;]) and strpos($_SERVER[&quot;HTTP_REFERER&quot;], '/resources/') === false) {
+    $pingFilePath = sys_get_temp_dir() . &quot;/&quot; . str_replace(&quot;/&quot;, &quot;-&quot;, parse_url($_SERVER[&quot;HTTP_REFERER&quot;], PHP_URL_PATH)) . &quot;.ping.txt&quot;; 
+} elseif (isset($_SERVER[&quot;HTTP_PING_FROM&quot;]) and strpos($_SERVER[&quot;HTTP_PING_FROM&quot;], '/resources/') === false) {
+    $pingFilePath = sys_get_temp_dir() . &quot;/&quot; . str_replace(&quot;/&quot;, &quot;-&quot;, parse_url($_SERVER[&quot;HTTP_PING_FROM&quot;], PHP_URL_PATH)) . &quot;.ping.txt&quot;; 
+} else {
+    header(&quot;HTTP/1.1 500 Internal Server Error&quot;);
+    echo &quot;This script needs to know the name of the test to form a unique temporary file path. It can get one either from HTTP referrer, or from a 'test' parameter.\n&quot;;
+    exit();
+}
+
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcespingredirecthtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/navigation/resources/ping-redirect.html (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/ping-redirect.html        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/resources/ping-redirect.html        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -1,3 +0,0 @@
</span><del>-&lt;script&gt;
-location.href = 'check-ping.php';
-&lt;/script&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcessavePingphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/navigation/resources/save-Ping.php (176601 => 176602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/save-Ping.php        2014-12-01 21:14:35 UTC (rev 176601)
+++ trunk/LayoutTests/http/tests/navigation/resources/save-Ping.php        2014-12-01 21:15:42 UTC (rev 176602)
</span><span class="lines">@@ -1,5 +1,7 @@
</span><span class="cx"> &lt;?php
</span><del>-$pingFile = fopen(&quot;ping.txt.tmp&quot;, 'w');
</del><ins>+require_once 'ping-file-path.php';
+
+$pingFile = fopen($pingFilePath . &quot;.tmp&quot;, 'w');
</ins><span class="cx"> $httpHeaders = $_SERVER;
</span><span class="cx"> ksort($httpHeaders, SORT_STRING);
</span><span class="cx"> foreach ($httpHeaders as $name =&gt; $value) {
</span><span class="lines">@@ -7,7 +9,7 @@
</span><span class="cx">         fwrite($pingFile, &quot;$name: $value\n&quot;);
</span><span class="cx"> }
</span><span class="cx"> fclose($pingFile);
</span><del>-rename(&quot;ping.txt.tmp&quot;, &quot;ping.txt&quot;);
</del><ins>+rename($pingFilePath . &quot;.tmp&quot;, $pingFilePath);
</ins><span class="cx"> foreach ($_COOKIE as $name =&gt; $value)
</span><span class="cx">     setcookie($name, &quot;deleted&quot;, time() - 60, &quot;/&quot;);
</span><span class="cx"> ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>