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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/navigation/resources/check-beacon.php

Issue 2702113003: Move tests for sendBeacon to a separate dedicated directory for clearer ownership (Closed)
Patch Set: a Created 3 years, 10 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
OLDNEW
(Empty)
1 <?php
2 require_once '../../resources/portabilityLayer.php';
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;
8 while (!file_exists($beaconFilename) && $retries != 0) {
9 usleep(10000);
10 # file_exists() caches results, we want to invalidate the cache.
11 clearstatcache();
12 $retries--;
13 }
14
15 header('Content-Type: text/plain');
16 header('Access-Control-Allow-Origin: *');
17 if (file_exists($beaconFilename)) {
18 $beaconFile = false;
19 if (is_readable($beaconFilename)) {
20 $beaconFile = fopen($beaconFilename, 'r');
21 }
22 if ($beaconFile) {
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 }
34 } else {
35 echo "Beacon not sent\n";
36 }
37 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698