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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/cache/resources/random-cached-image.php

Issue 2874073003: Add layout tests for ImageLoader::UpdateFromElement(kUpdateForcedReload) (Closed)
Patch Set: comment Created 3 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 | third_party/WebKit/LayoutTests/http/tests/images/force-reload.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <?php
2 # The script name is "random-cached-image" because this is expected to return
3 # different images on every (re)load to test caching, which is similar to
4 # other random-cached* scripts.
5 # However, this actually returns an image from a small number of predefined
6 # images in sequence,
7 # because it is hard to generate random (PNG/JPEG/etc.) images from scratch.
8
9 require_once '../../resources/portabilityLayer.php';
10
11 if (!sys_get_temp_dir()) {
12 echo "FAIL: No temp dir was returned.\n";
13 exit();
14 }
15
16 $id = $_GET['id'];
17 if (filter_var($id, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^ [a-z0-9\-]+$/"))) === false) {
18 echo "FAIL: invalid id.\n";
19 exit();
20 }
21
22 $countFilename = sys_get_temp_dir() . "/random-cached-image." . $id . ".tmp";
23 $count = 0;
24 if (file_exists($countFilename)) {
25 $count = file_get_contents($countFilename);
26 }
27 $count += 1;
28 file_put_contents($countFilename, $count);
29
30 # Images with different dimensions.
31 $imageFilenames = array(
32 '../../resources/square20.png',
33 '../../resources/square100.png',
34 '../../resources/square200.png'
35 );
36
37 header("Content-type: image/png");
38 header("Cache-control: max-age=60000");
39 header("ETag: 98765");
40
41 readfile($imageFilenames[$count % count($imageFilenames)]);
42 ?>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/images/force-reload.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698