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

Side by Side Diff: LayoutTests/http/tests/appcache/resources/modified-manifest.php

Issue 217133002: AppCache error details tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: statusCode -> status Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 <?php 1 <?php
2 require_once '../../resources/portabilityLayer.php'; 2 require_once '../../resources/portabilityLayer.php';
3 3
4 $tmpFile = sys_get_temp_dir() . "/" . "appcache_manifest_counter"; 4 # This manifest references itself with a command to bump a counter, so
5 # that a subsequent fetch of the same manifest URL returns a file that
6 # is not byte-for-byte identical, which will cause caching to fail.
7
8 $tmpFile = sys_get_temp_dir() . "/" . "appcache_modified_manifest_counter";
5 9
6 function getCount($file) 10 function getCount($file)
7 { 11 {
8 if (!file_exists($file)) { 12 if (!file_exists($file)) {
9 file_put_contents($file, "0"); 13 file_put_contents($file, "0");
10 return "0"; 14 return "0";
11 } 15 }
12 return file_get_contents($file); 16 return file_get_contents($file);
13 } 17 }
14 18
15 function stepCounter($file) 19 function stepCounter($file)
16 { 20 {
17 if (file_exists($file)) { 21 if (file_exists($file)) {
18 $value = getCount($file); 22 $value = getCount($file);
19 file_put_contents($file, ++$value); 23 file_put_contents($file, ++$value);
20 } 24 }
21 } 25 }
22 26
27 if ("step" == $_GET['command'])
28 stepCounter($tmpFile);
29
23 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); 30 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
24 header("Cache-Control: no-cache, must-revalidate"); 31 header("Cache-Control: no-cache, must-revalidate");
25 header("Pragma: no-cache"); 32 header("Pragma: no-cache");
26 header("Content-Type: text/cache-manifest"); 33 header("Content-Type: text/cache-manifest");
27 34
28 if ("step" == $_GET['command'])
29 stepCounter($tmpFile);
30
31 print("CACHE MANIFEST\n"); 35 print("CACHE MANIFEST\n");
32 print("# version " . getCount($tmpFile) . "\n"); 36 print("# version " . getCount($tmpFile) . "\n");
33 print("counter.php\n"); 37 print("CACHE:\n");
34 print("uncacheable-resource.php\n"); // with Cache-control: no-store 38 print("modified-manifest.php?command=step\n");
35 print("NETWORK:\n");
36 print("versioned-manifest.php?command=\n");
37 ?> 39 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698