2011-06-09 Vsevolod Vlasov <vsevik@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jun 2011 20:53:58 +0000 (20:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jun 2011 20:53:58 +0000 (20:53 +0000)
        Reviewed by James Robinson.

        Web Inspector: Inspector layout tests - extract method for sending XHR
        https://bugs.webkit.org/show_bug.cgi?id=62391

        * http/tests/inspector/console-xhr-logging.html:
        * http/tests/inspector/network-test.js:
        (doXHR.xhr.onreadystatechange):
        (doXHR):
        * http/tests/inspector/network/network-size-sync.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88480 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/console-xhr-logging.html
LayoutTests/http/tests/inspector/network-test.js
LayoutTests/http/tests/inspector/network/network-size-sync.html

index 7bfab69..0153bc4 100644 (file)
@@ -1,3 +1,16 @@
+2011-06-09  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Reviewed by James Robinson.
+
+        Web Inspector: Inspector layout tests - extract method for sending XHR
+        https://bugs.webkit.org/show_bug.cgi?id=62391
+
+        * http/tests/inspector/console-xhr-logging.html:
+        * http/tests/inspector/network-test.js:
+        (doXHR.xhr.onreadystatechange):
+        (doXHR):
+        * http/tests/inspector/network/network-size-sync.html:
+
 2011-06-09  Julien Chaffraix  <jchaffraix@codeaurora.org>
 
         Reviewed by Antti Koivisto.
index c7bb039..79cab68 100644 (file)
@@ -2,15 +2,13 @@
 <head>
 <script src="inspector-test.js"></script>
 <script src="console-test.js"></script>
+<script src="network-test.js"></script>
 <script>
-
 function requestHelper(method, url)
 {
     // Make synchronous requests for simplicity.
     console.log("sending a %s request to %s", method, url);
-    var xhr = new XMLHttpRequest();
-    xhr.open(method, url, false);
-    xhr.send();
+    doXHR(method, url, false);
 }
 
 function makeRequests()
index bd55b7a..deff134 100644 (file)
@@ -24,3 +24,18 @@ InspectorTest.dumpNetworkResources = function()
 }
 
 };
+
+function doXHR(method, url, async, callback)
+{
+    var xhr = new XMLHttpRequest();
+    xhr.onreadystatechange = function()
+    {
+        if (xhr.readyState === XMLHttpRequest.DONE) {
+            if (typeof(callback) === "function")
+                callback();
+        }
+    };
+    xhr.open(method, url, async);
+    xhr.send(null);
+}
+
index a5d6b58..a2614f7 100644 (file)
@@ -1,17 +1,11 @@
 <html>
 <head>
 <script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
 <script>
 function loadData()
 {
-    var xhr = new XMLHttpRequest();
-    xhr.onreadystatechange = function()
-    {
-        if (xhr.readyState  == 4)
-            resourceLoaded();
-    };
-    xhr.open('GET', 'resources/resource.php?type=image&size=500&gzip=true&chunked=true', false);
-    xhr.send(null);
+    doXHR("GET", "resources/resource.php?type=image&size=500&gzip=true&chunked=true", false, resourceLoaded);
 }
 
 function resourceLoaded()