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

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: fix 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
OLDNEW
(Empty)
1 <?php
2 # Returns a cacheable image randomly.
yhirano 2017/05/12 10:30:43 Isn't this comment (and filename) confusing? The t
hiroshige 2017/05/12 17:14:51 Maybe. I chose the name because this is used simil
3
4 require_once '../../resources/portabilityLayer.php';
5
6 if (!sys_get_temp_dir()) {
kouhei (in TOK) 2017/05/11 18:22:08 I'm not sure if we are guaranteed to get same temp
7 echo "FAIL: No temp dir was returned.\n";
8 exit();
9 }
10
11 $id = intval($_GET['id']);
12 $countFilename = sys_get_temp_dir() . "/random-cached-image." . $id . ".tmp";
13 $count = 0;
14 if (file_exists($countFilename)) {
15 $count = file_get_contents($countFilename);
16 }
17 $count += 1;
18 file_put_contents($countFilename, $count);
19
20 # Images with different dimensions.
21 $imageFilenames = array(
22 '../../resources/square20.png',
23 '../../resources/square100.png',
24 '../../resources/square200.png'
25 );
26
27 header("Content-type: image/png");
28 header("Cache-control: max-age=60000");
29 header("ETag: 98765");
30
31 readfile($imageFilenames[$count % count($imageFilenames)]);
32 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698