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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/navigation/resources/check-ping.php » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <?php 1 <?php
2 $beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt"; 2 require_once '../../resources/portabilityLayer.php';
3 $retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : -1; 3
4 $beaconFilename = sys_get_temp_dir() . "/beacon" . (isset($_REQUEST['name']) ? $ _REQUEST['name'] : "") . ".txt";
5
6 $max_attempts = 700;
7 $retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : $max_attemp ts;
4 while (!file_exists($beaconFilename) && $retries != 0) { 8 while (!file_exists($beaconFilename) && $retries != 0) {
5 usleep(10000); 9 usleep(10000);
6 # file_exists() caches results, we want to invalidate the cache. 10 # file_exists() caches results, we want to invalidate the cache.
7 clearstatcache(); 11 clearstatcache();
8 $retries--; 12 $retries--;
9 } 13 }
10 14
11 header('Content-Type: text/plain'); 15 header('Content-Type: text/plain');
12 header('Access-Control-Allow-Origin: *'); 16 header('Access-Control-Allow-Origin: *');
13 if (file_exists($beaconFilename)) { 17 if (file_exists($beaconFilename)) {
14 echo "Beacon sent successfully\n"; 18 $beaconFile = false;
15 $beaconFile = fopen($beaconFilename, 'r'); 19 if (is_readable($beaconFilename)) {
16 while ($line = fgets($beaconFile)) { 20 $beaconFile = fopen($beaconFilename, 'r');
17 $trimmed = trim($line);
18 if ($trimmed != "")
19 echo "$trimmed\n";
20 } 21 }
21 fclose($beaconFile); 22 if ($beaconFile) {
22 unlink($beaconFilename); 23 echo "Beacon sent successfully\n";
24 while ($line = fgets($beaconFile)) {
25 $trimmed = trim($line);
26 if ($trimmed != "")
27 echo "$trimmed\n";
28 }
29 fclose($beaconFile);
30 unlink($beaconFilename);
31 } else {
32 echo "Beacon status not readable\n";
33 }
23 } else { 34 } else {
24 echo "Beacon not sent\n"; 35 echo "Beacon not sent\n";
25 } 36 }
26 ?> 37 ?>
OLDNEW
« 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