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

Unified Diff: LayoutTests/http/tests/navigation/resources/check-beacon.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
« no previous file with comments | « no previous file | LayoutTests/http/tests/navigation/resources/check-ping.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 0fadda190d02741e4c97da04fa8cb3caaf6ffa90..9b42b96672311573eb3e85c40ae336a42c145479 100644
--- a/LayoutTests/http/tests/navigation/resources/check-beacon.php
+++ b/LayoutTests/http/tests/navigation/resources/check-beacon.php
@@ -1,6 +1,10 @@
<?php
-$beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
-$retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : -1;
+require_once '../../resources/portabilityLayer.php';
+
+$beaconFilename = sys_get_temp_dir() . "/beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
+
+$max_attempts = 700;
+$retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : $max_attempts;
while (!file_exists($beaconFilename) && $retries != 0) {
usleep(10000);
# file_exists() caches results, we want to invalidate the cache.
@@ -11,15 +15,22 @@ while (!file_exists($beaconFilename) && $retries != 0) {
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";
+ $beaconFile = false;
+ if (is_readable($beaconFilename)) {
+ $beaconFile = fopen($beaconFilename, 'r');
+ }
+ if ($beaconFile) {
+ echo "Beacon sent successfully\n";
+ while ($line = fgets($beaconFile)) {
+ $trimmed = trim($line);
+ if ($trimmed != "")
+ echo "$trimmed\n";
+ }
+ fclose($beaconFile);
+ unlink($beaconFilename);
+ } else {
+ echo "Beacon status not readable\n";
}
- fclose($beaconFile);
- unlink($beaconFilename);
} else {
echo "Beacon not sent\n";
}
« no previous file with comments | « no previous file | LayoutTests/http/tests/navigation/resources/check-ping.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698