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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/cache/resources/post-image-to-verify.php

Issue 2532103003: Fix http/tests/cache random-order flakiness (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/LayoutTests/http/tests/cache/post-with-cached-subresources-expected.txt ('k') | no next file » | 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 require_once '../../resources/portabilityLayer.php'; 2 require_once '../../resources/portabilityLayer.php';
3 3
4 clearstatcache(); 4 clearstatcache();
5 if (file_exists(sys_get_temp_dir() . "/post.tmp")) { 5 $tmpFilename = sys_get_temp_dir() . "/" . $_GET['filename'];
6 if (file_exists($tmpFilename)) {
6 header('HTTP/1.1 404 Not Found'); 7 header('HTTP/1.1 404 Not Found');
7 exit(); 8 exit();
8 } else { 9 } else {
9 $tmpFile = fopen(sys_get_temp_dir() . "/post.tmp", 'w'); 10 $tmpFile = fopen($tmpFilename, 'w');
10 fclose($tmpFile); 11 fclose($tmpFile);
11 12
12 $filename = 'compass-no-cache.jpg'; 13 $filename = 'compass-no-cache.jpg';
13 $filemtime = filemtime($filename); 14 $filemtime = filemtime($filename);
14 $filesize = filesize($filename); 15 $filesize = filesize($filename);
15 16
16 $etag = '"' . $filesize . '-' . $filemtime . '"'; 17 $etag = '"' . $filesize . '-' . $filemtime . '"';
17 $last_modified = gmdate(DATE_RFC1123, $filemtime); 18 $last_modified = gmdate(DATE_RFC1123, $filemtime);
18 $max_age = 12 * 31 * 24 * 60 * 60; //one year 19 $max_age = 12 * 31 * 24 * 60 * 60; //one year
19 $expires = gmdate(DATE_RFC1123, time() + $max_age); 20 $expires = gmdate(DATE_RFC1123, time() + $max_age);
20 21
21 $handle = fopen($filename, 'rb'); 22 $handle = fopen($filename, 'rb');
22 $contents = fread($handle, $filesize); 23 $contents = fread($handle, $filesize);
23 fclose($handle); 24 fclose($handle);
24 25
25 header('Cache-Control: public, max-age=' . $max_age); 26 header('Cache-Control: public, max-age=' . $max_age);
26 header('Expires: ' . $expires); 27 header('Expires: ' . $expires);
27 header('Content-Type: image/png'); 28 header('Content-Type: image/png');
28 header('Content-Length: ' . $filesize); 29 header('Content-Length: ' . $filesize);
29 header('Etag: ' . $etag); 30 header('Etag: ' . $etag);
30 header('Last-Modified: ' . $last_modified); 31 header('Last-Modified: ' . $last_modified);
31 echo $contents; 32 echo $contents;
32 exit(); 33 exit();
33 } 34 }
34 ?> 35 ?>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/cache/post-with-cached-subresources-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698