Changeset 71196 in webkit
- Timestamp:
- Nov 2, 2010 6:07:40 PM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r71192 r71196 1 2010-11-02 Michael Nordman <michaeln@google.com> 2 3 Reviewed by Alexey Proskuryakov. 4 5 [Chromium] Some work on making appcache layout tests less flaky. 6 https://bugs.webkit.org/show_bug.cgi?id=48002 7 1) Make network-simulator.php less slow. 8 In addition to redirecting back to the requested url, the response contains 9 multiple content-length headers. Chrome's network stacks considers that an 10 error condition too and picks up on it faster (one round trip instead of multiple). 11 This avoids timeouts due to using PHP via slow CGI on windows. 12 2) Removed canLoad() from appcache/fallback.html layout test, the load() 13 result is sufficient for determining if it could be loaded. So fewer requests are 14 made to conduct the test, cutting out more time. 15 3) Removed some unneeded code from offline-access-frame.html. Appcache events are guaranteed 16 to be deferred until after 'onload' has happened. This test was coded prior to that 17 guarantee being satisfied. 18 19 * http/tests/appcache/fallback.html: 20 * http/tests/resources/network-simulator.php: 21 * http/tests/resources/offline-access-frame.html: 22 1 23 2010-11-02 Mihai Parparita <mihaip@chromium.org> 2 24 -
trunk/LayoutTests/http/tests/appcache/fallback.html
r39546 r71196 30 30 } 31 31 32 function canLoad(url)33 {34 try {35 var req = new XMLHttpRequest();36 req.open("GET", url, false);37 req.send("");38 return true;39 } catch (e) {40 return false;41 }42 }43 44 32 function load(url) 45 33 { … … 50 38 return req.responseText; 51 39 } catch (ex) { 52 alert("Unexpected error loading " + url + ":" + ex);40 log("FAIL: Cannot load " + url + ", ex = " + ex); 53 41 hadError = true; 42 return ""; // This value should not be expected as the responseText for a url presented to this function. 54 43 } 55 44 } … … 66 55 setNetworkEnabled(true); 67 56 68 if (! canLoad(testURL) || !/not in the cache/.test(load(testURL))) {57 if (!/not in the cache/.test(load(testURL))) { 69 58 log("FAIL: Cannot load an URL from fallback namespace when network is enabled"); 70 59 hadError = true; 71 60 } 72 61 73 if ( !canLoad(nonexistentURL) ||load(nonexistentURL) != "Hello, World!") {62 if (load(nonexistentURL) != "Hello, World!") { 74 63 log("FAIL: Fallback resource wasn't used for a 404 response"); 75 64 hadError = true; 76 65 } 77 66 78 if ( !canLoad(redirectURL) ||load(redirectURL) != "Hello, World!") {67 if (load(redirectURL) != "Hello, World!") { 79 68 log("FAIL: Fallback resource wasn't used for a redirect to a resource with another origin"); 80 69 hadError = true; … … 148 137 setNetworkEnabled(false); 149 138 150 if (!canLoad(testURL)) { 151 log("FAIL: Cannot load an URL from fallback namespace when network is disabled"); 152 hadError = true; 153 } else if (load(testURL) != load("resources/simple.txt")) { 139 if (load(testURL) != load("resources/simple.txt")) { 154 140 log("FAIL: Loading an URL from fallback namespace when network is disabled returned unexpected response"); 155 141 hadError = true; -
trunk/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
r40354 r71196 18 18 applicationCache.onnoupdate = function() { log("noupdate"); test() } 19 19 applicationCache.onerror = function() { log("error"); test() } 20 21 if (applicationCache.status == applicationCache.IDLE) {22 // Update finished while we were waiting for offline-access.js to load.23 applicationCache.oncached = function() { log("cached") }24 applicationCache.onnoupdate = function() { log("noupdate") }25 applicationCache.onerror = function() { log("error") }26 test();27 }28 29 20 </script> 30 21 </html> -
trunk/LayoutTests/http/tests/resources/network-simulator.php
r66128 r71196 3 3 4 4 // This script acts as a stateful proxy for retrieving files. When the state is set to 5 // offline, it simulates a network error by redirecting to itself.5 // offline, it simulates a network error with a nonsense response. 6 6 7 7 if (!sys_get_temp_dir()) { … … 60 60 $state = getState($stateFile); 61 61 if ($state == "Offline") { 62 # Simulate a network error by replying with a nonsense response. 62 63 header('HTTP/1.1 307 Temporary Redirect'); 63 # Simulate a network error by redirecting to self. 64 header('Location: ' . $_SERVER['REQUEST_URI']); 64 header('Location: ' . $_SERVER['REQUEST_URI']); # Redirect to self. 65 header('Content-Length: 1'); 66 header('Content-Length: 5', false); # Multiple content-length headers, some network stacks can detect this condition faster. 67 echo "Intentionally incorrect response."; 65 68 } else { 66 69 // A little securuty checking can't hurt. … … 71 74 $path = '..' . $path; 72 75 73 generateNoCacheHTTPHeader(); 76 generateNoCacheHTTPHeader(); 74 77 75 78 if (file_exists($path)) {
Note: See TracChangeset
for help on using the changeset viewer.