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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/navigation/resources/save-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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/navigation/resources/save-beacon.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/resources/save-beacon.php b/third_party/WebKit/LayoutTests/http/tests/navigation/resources/save-beacon.php
deleted file mode 100644
index 1888c9329cc5bdbd380cf21a39a513310e89488e..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/resources/save-beacon.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-require_once '../../resources/portabilityLayer.php';
-
-function prettify($name) {
- return str_replace(' ', '-', ucwords(str_replace('_', ' ', str_replace('http_', '', strtolower($name)))));
-}
-
-$beaconFilename = sys_get_temp_dir() . "/beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
-$beaconFile = fopen($beaconFilename . ".tmp", 'w');
-$httpHeaders = $_SERVER;
-ksort($httpHeaders, SORT_STRING);
-$contentType = "";
-foreach ($httpHeaders as $name => $value) {
- if ($name === "CONTENT_TYPE" || $name === "HTTP_REFERER" || $name === "REQUEST_METHOD" || $name === "HTTP_COOKIE" || $name === "HTTP_ORIGIN") {
- if ($name === "CONTENT_TYPE") {
- $contentType = $value;
- $value = preg_replace('/boundary=.*$/', '', $value);
- }
- $headerName = prettify($name);
- fwrite($beaconFile, "$headerName: $value\n");
- }
-}
-$postdata = file_get_contents("php://input");
-if (strlen($postdata) == 0)
- $postdata = http_build_query($_POST);
-
-fwrite($beaconFile, "Length: " . strlen($postdata) . "\n");
-if (strpos($contentType, "application/") !== false) {
- $postdata = base64_encode($postdata);
-}
-
-fwrite($beaconFile, "Body: $postdata\n");
-fclose($beaconFile);
-rename($beaconFilename . ".tmp", $beaconFilename);
-
-if (!array_key_exists('dontclearcookies', $_GET)) {
- foreach ($_COOKIE as $name => $value)
- setcookie($name, "deleted", time() - 60, "/");
-}
-?>

Powered by Google App Engine
This is Rietveld 408576698