[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 12:39:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6de51101aeb6ad95470150a640f0a9988e53293c
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 26 20:15:40 2010 +0000

    2010-08-26  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Make it possible for http tests to log resource requests
            https://bugs.webkit.org/show_bug.cgi?id=44702
    
            Enhance network-simulator.php to be able to log resource
            requests to a file, and then return the list of requests.
    
            Test with a new loading test that logs CSS-related image requests.
    
            * http/tests/css/css-image-loading-expected.txt: Added.
            * http/tests/css/css-image-loading.html: Added.
            * http/tests/css/resources/request-logging.js: Added.
            (CallCommand):
            (startTest):
            (endTest):
            (getResourceLog):
            * http/tests/resources/network-simulator.php:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66128 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a076e4f..252b7d1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-26  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Make it possible for http tests to log resource requests
+        https://bugs.webkit.org/show_bug.cgi?id=44702
+        
+        Enhance network-simulator.php to be able to log resource
+        requests to a file, and then return the list of requests.
+        
+        Test with a new loading test that logs CSS-related image requests.
+        
+        * http/tests/css/css-image-loading-expected.txt: Added.
+        * http/tests/css/css-image-loading.html: Added.
+        * http/tests/css/resources/request-logging.js: Added.
+        (CallCommand):
+        (startTest):
+        (endTest):
+        (getResourceLog):
+        * http/tests/resources/network-simulator.php:
+
 2010-08-26  Tony Chang  <tony at chromium.org>
 
         Not reviewed.  Removing chromium-mac and chromium test results that deduplicate-tests says are not necessary.
diff --git a/LayoutTests/http/tests/css/css-image-loading-expected.txt b/LayoutTests/http/tests/css/css-image-loading-expected.txt
new file mode 100644
index 0000000..6e97434
--- /dev/null
+++ b/LayoutTests/http/tests/css/css-image-loading-expected.txt
@@ -0,0 +1,11 @@
+item
+Resource requests:
+
+
+background1.jpg
+background2.jpg
+content-image1.jpg
+content-image2.jpg
+content-image3.jpg
+list-image1.jpg
+list-image2.jpg
diff --git a/LayoutTests/http/tests/css/css-image-loading.html b/LayoutTests/http/tests/css/css-image-loading.html
new file mode 100644
index 0000000..7ed1341
--- /dev/null
+++ b/LayoutTests/http/tests/css/css-image-loading.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <script src="resources/request-logging.js" type="text/javascript" charset="utf-8"></script>
+
+  <style type="text/css">
+    .box {
+      height: 100px;
+      width: 100px;
+      background-image: url("/resources/network-simulator.php?command=log-resource-request&path=background1.jpg");
+    }
+    
+    .background {
+      background-image: url("/resources/network-simulator.php?command=log-resource-request&path=background2.jpg");
+    }
+    
+    .content {
+      content: url("/resources/network-simulator.php?command=log-resource-request&path=content-image1.jpg");
+    }
+
+    .test {
+      content: url("/resources/network-simulator.php?command=log-resource-request&path=content-image2.jpg") "foopy" url("/resources/network-simulator.php?command=log-resource-request&path=content-image3.jpg");
+    }
+    
+    ul {
+      list-style-image: url("/resources/network-simulator.php?command=log-resource-request&path=list-image1.jpg");
+    }
+    .list {
+      list-style-image: url("/resources/network-simulator.php?command=log-resource-request&path=list-image2.jpg");
+    }
+    
+  </style>
+</head>
+<body>
+
+  <div class="box background"></div>
+  <div class="content test"></div>
+  <ul class="list"><li>item</li></div>
+
+  <h2>Resource requests:</h2>
+  <pre id="result">Request log goes here in DRT</pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/css/resources/request-logging.js b/LayoutTests/http/tests/css/resources/request-logging.js
new file mode 100644
index 0000000..9491c61
--- /dev/null
+++ b/LayoutTests/http/tests/css/resources/request-logging.js
@@ -0,0 +1,41 @@
+function CallCommand(cmd)
+{
+ try {
+     var req = new XMLHttpRequest;
+     req.open("GET", "/resources/network-simulator.php?command=" + cmd, false);
+     req.send(null);
+     return req.responseText;
+ } catch (ex) {
+     return "";
+ }
+}
+
+function startTest()
+{
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+ 
+    window.setTimeout(endTest, 0);
+}
+
+function endTest()
+{
+    getResourceLog();
+    CallCommand("clear-resource-request-log");
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function getResourceLog()
+{
+    var log = CallCommand("get-resource-request-log");
+    var logLines = log.split('\n');
+    logLines.sort();
+    document.getElementById('result').innerText = logLines.join('\n');
+}
+
+CallCommand("start-resource-request-log");
+window.addEventListener('load', startTest, false);
diff --git a/LayoutTests/http/tests/resources/network-simulator.php b/LayoutTests/http/tests/resources/network-simulator.php
index 3f1201f..4860028 100644
--- a/LayoutTests/http/tests/resources/network-simulator.php
+++ b/LayoutTests/http/tests/resources/network-simulator.php
@@ -120,6 +120,38 @@ function handleGetResourceCountCommand($path)
     }
 }
 
+function handleStartResourceRequestsLog()
+{
+    $resourceLogFile = sys_get_temp_dir() . "/resource-log";
+    file_put_contents($resourceLogFile,  "");
+}
+
+function handleClearResourceRequestsLog()
+{
+    $resourceLogFile = sys_get_temp_dir() . "/resource-log";
+    file_put_contents($resourceLogFile, "");
+}
+
+function handleGetResourceRequestsLog()
+{
+    $resourceLogFile = sys_get_temp_dir() . "/resource-log";
+
+    generateNoCacheHTTPHeader();
+    header("Content-Type: text/plain");
+
+    print file_get_contents($resourceLogFile);
+}
+
+function handleLogResourceRequest($path)
+{
+    $resourceLogFile = sys_get_temp_dir() . "/resource-log";
+    
+    $newData = "\n".$path;
+    // Documentation says that appends are atomic.
+    file_put_contents($resourceLogFile, $newData, FILE_APPEND);
+    generateResponse($path);
+}
+
 $stateFile = sys_get_temp_dir() . "/network-simulator-state";
 $command = $_GET['command'];
 if ($command) {
@@ -133,6 +165,14 @@ if ($command) {
         handleResetResourceCountCommand();
     else if ($command == "get-resource-count")
         handleGetResourceCountCommand($_GET['path']);
+    else if ($command == "start-resource-request-log")
+        handleStartResourceRequestsLog();
+    else if ($command == "clear-resource-request-log")
+        handleClearResourceRequestsLog();
+    else if ($command == "get-resource-request-log")
+        handleGetResourceRequestsLog();
+    else if ($command == "log-resource-request")
+        handleLogResourceRequest($_GET['path']);
     else
         echo "Unknown command: " . $command . "\n";
     exit();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list