Index: LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching.html b/LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching.html |
index 1c9c735b92ec8d8db2858721f2f286ca9909e5eb..be4886edd1bd4dda9d20347b46690b7ee3a5d3c7 100644 |
--- a/LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching.html |
+++ b/LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching.html |
@@ -8,63 +8,44 @@ |
<script src="../resources/testharnessreport.js"></script> |
<script type="text/javascript"> |
-// Test what caching XMLHttpRequest performs when issuing |
-// sync requests over various verbs and with various |
-// kinds of query portions. Without any cache control |
-// headers. |
-var verbs = [ "GET", |
- "PUT", |
- "POST", |
- "PROPFIND"]; |
+// Test what caching XMLHttpRequest performs when issuing sync |
+// requests over various verbs and with various kinds of query |
+// portions. Without any cache control headers. |
+var verbs = [ "GET", "POST" ]; |
var query_kinds = [ |
{query: "'?random'", |
- name: "constant query", |
- // The list of verbs we expect the request not to be repeated for. |
- should_cache: []}, |
+ name: "constant query"}, |
{query: "", |
- name: "no query", |
- should_cache: []}, |
+ name: "no query"}, |
{query: "'?' + (Math.random() + Date.now()).toString()", |
- name: "unique query string", |
- should_cache: []}, |
- {query: "'?'", |
- name: "empty query", |
- should_cache: []}]; |
+ name: "unique query string"}]; |
var base_url = "resources/echo-random.php"; |
+function fetchSyncTextResponse(verb, url) { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open(verb, url, false); |
+ xhr.send(); |
+ return xhr.responseText; |
+} |
+ |
function runTest() { |
for (var i = 0; i < verbs.length; i++) { |
var verb = verbs[i]; |
for (var j = 0; j < query_kinds.length; j++) { |
- var q1 = eval(query_kinds[j].query) || ""; |
- |
- var request_url1 = base_url + q1; |
- var xhr1 = new XMLHttpRequest; |
- xhr1.open(verb, request_url1, false); |
- xhr1.send(); |
- var result1 = xhr1.responseText; |
- |
- var xhr2 = new XMLHttpRequest(); |
- var q2 = eval(query_kinds[j].query) || ""; |
- var request_url2 = base_url + q2; |
- xhr2.open(verb, request_url2, false); |
- xhr2.send(); |
- var result2 = xhr2.responseText; |
- |
test(function () { |
- if (query_kinds[j].should_cache.indexOf(verb) >= 0) |
- assert_true(result1 === result2); |
- else |
- assert_false(result1 === result2); |
- }, "Test repeated sync requests using verb '" + verb + " with " + query_kinds[j].name); |
+ var q1 = eval(query_kinds[j].query) || ""; |
+ var q2 = eval(query_kinds[j].query) || ""; |
+ var result1 = fetchSyncTextResponse(verb, base_url + q1); |
+ var result2 = fetchSyncTextResponse(verb, base_url + q2); |
+ assert_false(result1 === result2); |
+ }, "Test repeated sync requests using verb '" + verb + "' with " + query_kinds[j].name); |
} |
} |
} |
test(runTest, document.title); |
</script> |
-<div id="log"></div> |
</body> |
</html> |