Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: LayoutTests/http/tests/navigation/resources/check-ping.php

Issue 286063003: Save ping+beacon test status in temporary directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/navigation/resources/check-ping.php
diff --git a/LayoutTests/http/tests/navigation/resources/check-ping.php b/LayoutTests/http/tests/navigation/resources/check-ping.php
index d1e669b243fb7b9c56d5c54c15e21c220189aa4f..7d384983e5c0fe6eabea497ba736f9be2924b718 100644
--- a/LayoutTests/http/tests/navigation/resources/check-ping.php
+++ b/LayoutTests/http/tests/navigation/resources/check-ping.php
@@ -1,19 +1,26 @@
<?php
-while (!file_exists("ping.txt")) {
+require_once '../../resources/portabilityLayer.php';
+
+$pingFilename = sys_get_temp_dir() . "/ping.txt";
+while (!file_exists($pingFilename)) {
usleep(10000);
// file_exists() caches results, we want to invalidate the cache.
clearstatcache();
}
echo "<html><body>\n";
-echo "Ping sent successfully";
-$pingFile = fopen("ping.txt", 'r');
-while ($line = fgets($pingFile)) {
- echo "<br>";
- echo trim($line);
+$pingFile = fopen($pingFilename, 'r');
+if ($pingFile) {
+ echo "Ping sent successfully";
+ while ($line = fgets($pingFile)) {
+ echo "<br>";
+ echo trim($line);
+ }
+ fclose($pingFile);
+ unlink($pingFilename);
+} else {
+ echo "Ping not sent";
}
-fclose($pingFile);
-unlink("ping.txt");
echo "<script>";
echo "if (window.testRunner)";
echo " testRunner.notifyDone();";

Powered by Google App Engine
This is Rietveld 408576698