Index: LayoutTests/http/tests/navigation/resources/check-beacon.php |
diff --git a/LayoutTests/http/tests/navigation/resources/check-beacon.php b/LayoutTests/http/tests/navigation/resources/check-beacon.php |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0fadda190d02741e4c97da04fa8cb3caaf6ffa90 |
--- /dev/null |
+++ b/LayoutTests/http/tests/navigation/resources/check-beacon.php |
@@ -0,0 +1,26 @@ |
+<?php |
+$beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt"; |
+$retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : -1; |
+while (!file_exists($beaconFilename) && $retries != 0) { |
+ usleep(10000); |
+ # file_exists() caches results, we want to invalidate the cache. |
+ clearstatcache(); |
+ $retries--; |
+} |
+ |
+header('Content-Type: text/plain'); |
+header('Access-Control-Allow-Origin: *'); |
+if (file_exists($beaconFilename)) { |
+ echo "Beacon sent successfully\n"; |
+ $beaconFile = fopen($beaconFilename, 'r'); |
+ while ($line = fgets($beaconFile)) { |
+ $trimmed = trim($line); |
+ if ($trimmed != "") |
+ echo "$trimmed\n"; |
+ } |
+ fclose($beaconFile); |
+ unlink($beaconFilename); |
+} else { |
+ echo "Beacon not sent\n"; |
+} |
+?> |