Commit 54fd8155 authored by mkwst@chromium.org's avatar mkwst@chromium.org

Deflake http/tests/navigation/ping-*.

This CL de-flakes the http/tests/navigation/ping-* suite by ensuring
that each test generates its own ping file dump, and that the temp
directory is consistently used.

Review URL: https://codereview.chromium.org/334113003

git-svn-id: svn://svn.chromium.org/blink/trunk@176335 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ec36d36b
PingLoader dispatched to 'http://127.0.0.1:8000/navigation/resources/save-Ping.php'.
PingLoader dispatched to 'http://127.0.0.1:8000/navigation/resources/save-Ping.php?test=cookie'.
Ping sent successfully
CONTENT_TYPE: text/ping
HTTP_COOKIE: hello=world
HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-cookie.html
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php?test=cookie
REQUEST_METHOD: POST
......@@ -42,6 +42,6 @@ function test() {
</script>
</head>
<body onload="test();">
<img src="resources/delete-ping.php" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php" ping="resources/save-Ping.php">Navigate and send ping</a>
<img src="resources/delete-ping.php?test=cookie" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php?test=cookie" ping="resources/save-Ping.php?test=cookie">Navigate and send ping</a>
</body></html>
PingLoader dispatched to 'http://localhost:8000/navigation/resources/save-Ping.php'.
PingLoader dispatched to 'http://localhost:8000/navigation/resources/save-Ping.php?test=cross-origin'.
Ping sent successfully
CONTENT_TYPE: text/ping
HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-cross-origin.html
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php?test=cross-origin
HTTP_REFERER: http://127.0.0.1:8000/navigation/ping-cross-origin.html
REQUEST_METHOD: POST
PingLoader dispatched to 'http://localhost:8000/navigation/resources/save-Ping.php'.
PingLoader dispatched to 'http://localhost:8000/navigation/resources/save-Ping.php?test=cross-origin'.
Ping sent successfully
CONTENT_TYPE: text/ping
HTTP_PING_TO: https://127.0.0.1:8443/navigation/resources/check-ping.php
HTTP_PING_TO: https://127.0.0.1:8443/navigation/resources/check-ping.php?test=cross-origin
REQUEST_METHOD: POST
......@@ -27,6 +27,6 @@ function test() {
</script>
</head>
<body onload="test();">
<img src="resources/delete-ping.php" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php" ping="http://localhost:8000/navigation/resources/save-Ping.php">Navigate and send ping</a>
<img src="resources/delete-ping.php?test=cross-origin" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php?test=cross-origin" ping="http://localhost:8000/navigation/resources/save-Ping.php?test=cross-origin">Navigate and send ping</a>
</body></html>
PingLoader dispatched to 'http://127.0.0.1:8000/navigation/resources/save-Ping.php'.
PingLoader dispatched to 'http://127.0.0.1:8000/navigation/resources/save-Ping.php?test=same-origin'.
Ping sent successfully
CONTENT_TYPE: text/ping
HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-same-origin.html
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php?test=same-origin
REQUEST_METHOD: POST
......@@ -27,6 +27,6 @@ function test() {
</script>
</head>
<body onload="test();">
<img src="resources/delete-ping.php" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php" ping="resources/save-Ping.php">Navigate and send ping</a>
<img src="resources/delete-ping.php?test=same-origin" onload="test();" onerror="test();"></img>
<a id="a" href="resources/check-ping.php?test=same-origin" ping="resources/save-Ping.php?test=same-origin">Navigate and send ping</a>
</body></html>
<?php
require_once '../../resources/portabilityLayer.php';
$pingFilename = sys_get_temp_dir() . "/ping.txt";
$pingFilename = sys_get_temp_dir() . "/ping." . $_GET["test"];
while (!file_exists($pingFilename)) {
usleep(10000);
// file_exists() caches results, we want to invalidate the cache.
......
<?php
unlink("ping.txt");
$pingFilename = sys_get_temp_dir() . "/ping." . $_GET["test"];
unlink($pingFilename);
?>
......@@ -9,7 +9,8 @@ foreach ($httpHeaders as $name => $value) {
fwrite($pingFile, "$name: $value\n");
}
fclose($pingFile);
rename(sys_get_temp_dir() . "/ping.txt.tmp", sys_get_temp_dir() . "/ping.txt");
$finalPingFilename = sys_get_temp_dir() . "/ping." . $_GET["test"];
rename(sys_get_temp_dir() . "/ping.txt.tmp", $finalPingFilename);
foreach ($_COOKIE as $name => $value)
setcookie($name, "deleted", time() - 60, "/");
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment