webapps

changeset 970:ec95ece1bbf8

add test cases for 4.1 and 4.4
author Jungkee Song <jungkee.song@samsung.com>
date Fri, 18 Jan 2013 21:21:04 +0900
parents 5d9e3b5a2559
children 3090e4355b84
files ProgressEvents/tests/submissions/Samsung/firing-events-http-content-length.html ProgressEvents/tests/submissions/Samsung/firing-events-http-no-content-length.html ProgressEvents/tests/submissions/Samsung/resources/img.jpg ProgressEvents/tests/submissions/Samsung/resources/no-content-length.php ProgressEvents/tests/submissions/Samsung/security-consideration.html
diffstat 5 files changed, 146 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ProgressEvents/tests/submissions/Samsung/firing-events-http-content-length.html	Fri Jan 18 21:21:04 2013 +0900
     1.3 @@ -0,0 +1,38 @@
     1.4 +<!doctype html>
     1.5 +<html>
     1.6 +  <head>
     1.7 +    <title>ProgressEvent: firing events for HTTP with Content-Length</title>
     1.8 +    <script src="/resources/testharness.js"></script>
     1.9 +    <script src="/resources/testharnessreport.js"></script>
    1.10 +    <link rel="help" href="http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#firing-events-using-the-progressevent-interface-for-http" data-tested-assertations="/following-sibling::ol/li[1] /following-sibling::ol/li[2]" />
    1.11 +  </head>
    1.12 +  <body>
    1.13 +    <div id="log"></div>
    1.14 +    <script>
    1.15 +      var test = async_test();
    1.16 +
    1.17 +      test.step(function() {
    1.18 +        var xhr = new XMLHttpRequest();
    1.19 +
    1.20 +        xhr.onprogress = function(pe) {
    1.21 +          test.step(function() {
    1.22 +            if(pe.type == "progress") {
    1.23 +              assert_not_equals(pe.loaded, 0, "loaded is not zero.");
    1.24 +              assert_true(pe.lengthComputable, "lengthComputable is true.");
    1.25 +              assert_not_equals(pe.total, 0, "total is not zero.");
    1.26 +            }
    1.27 +          }, "Check lengthComputed, loaded, total when Content-Length is given.");
    1.28 +        }
    1.29 +
    1.30 +        // "loadstart", "error", "abort", "load" tests are out of scope.
    1.31 +        // They SHOULD be tested in each spec that implement ProgressEvent.
    1.32 +        
    1.33 +        xhr.onloadend = function(pe) {
    1.34 +          test.done();
    1.35 +        }
    1.36 +        xhr.open("GET", "resources/img.jpg", true);
    1.37 +        xhr.send(null);
    1.38 +      })
    1.39 +    </script>
    1.40 +  </body>
    1.41 +</html>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ProgressEvents/tests/submissions/Samsung/firing-events-http-no-content-length.html	Fri Jan 18 21:21:04 2013 +0900
     2.3 @@ -0,0 +1,38 @@
     2.4 +<!doctype html>
     2.5 +<html>
     2.6 +  <head>
     2.7 +    <title>ProgressEvent: firing events for HTTP with no Content-Length</title>
     2.8 +    <script src="/resources/testharness.js"></script>
     2.9 +    <script src="/resources/testharnessreport.js"></script>
    2.10 +    <link rel="help" href="http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#firing-events-using-the-progressevent-interface-for-http" data-tested-assertations="/following-sibling::ol/li[1] /following-sibling::ol/li[2]" />
    2.11 +  </head>
    2.12 +  <body>
    2.13 +    <div id="log"></div>
    2.14 +    <script>
    2.15 +      var test = async_test();
    2.16 +
    2.17 +      test.step(function() {
    2.18 +        var xhr = new XMLHttpRequest();
    2.19 +
    2.20 +        xhr.onprogress = function(pe) {
    2.21 +          test.step(function() {
    2.22 +            if(pe.type == "progress") {
    2.23 +              assert_not_equals(pe.loaded, 0, "loaded is not zero.");
    2.24 +              assert_false(pe.lengthComputable, "lengthComputable is false.");
    2.25 +              assert_equals(pe.total, 0, "total is zero.");
    2.26 +            }
    2.27 +          }, "Check lengthComputed, loaded, total when Content-Length is NOT given.");
    2.28 +        }
    2.29 +
    2.30 +        // "loadstart", "error", "abort", "load" tests are out of scope.
    2.31 +        // They SHOULD be tested in each spec that implement ProgressEvent.
    2.32 +
    2.33 +        xhr.onloadend = function(pe) {
    2.34 +          test.done();
    2.35 +        }
    2.36 +        xhr.open("GET", "resources/no-content-length.php", true);
    2.37 +        xhr.send(null);
    2.38 +      })
    2.39 +    </script>
    2.40 +  </body>
    2.41 +</html>
     3.1 Binary file ProgressEvents/tests/submissions/Samsung/resources/img.jpg has changed
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ProgressEvents/tests/submissions/Samsung/resources/no-content-length.php	Fri Jan 18 21:21:04 2013 +0900
     4.3 @@ -0,0 +1,22 @@
     4.4 +<?php
     4.5 +    header('Content-Encoding', 'chunked');
     4.6 +    header('Transfer-Encoding', 'chunked');
     4.7 +    header('Content-Type', 'text/html');
     4.8 +    header('Connection', 'keep-alive');
     4.9 +
    4.10 +    ob_flush();
    4.11 +    flush();
    4.12 +
    4.13 +    for ($i = 0; $i < 100000; $i++) {
    4.14 +        $string = "W3C Progress Events Test";
    4.15 +        echo strlen($string)."\r\n"; // this is the length
    4.16 +        echo $string."\r\n"; // this is the date
    4.17 +        echo "\r\n"; // newline between chunks
    4.18 +        ob_flush(); // rinse and repeat
    4.19 +        flush();
    4.20 +    } 
    4.21 +    echo  "\r\n"; // send final empty line
    4.22 +    ob_flush();
    4.23 +    flush();
    4.24 +?>
    4.25 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/ProgressEvents/tests/submissions/Samsung/security-consideration.html	Fri Jan 18 21:21:04 2013 +0900
     5.3 @@ -0,0 +1,48 @@
     5.4 +<!doctype html>
     5.5 +<html>
     5.6 +  <head>
     5.7 +    <title>ProgressEvent: security consideration</title>
     5.8 +    <script src="/resources/testharness.js"></script>
     5.9 +    <script src="/resources/testharnessreport.js"></script>
    5.10 +    <link rel="help" href="http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#security-considerations" data-tested-assertations="/following-sibling::p" />
    5.11 +  </head>
    5.12 +  <body>
    5.13 +    <div id="log"></div>
    5.14 +    <script>
    5.15 +      var test = async_test();
    5.16 +
    5.17 +      test.step(function() {
    5.18 +        var xhr = new XMLHttpRequest();
    5.19 +
    5.20 +        xhr.onprogress = function(pe) {
    5.21 +          test.step(function() {
    5.22 +            if(pe.type == "progress") {
    5.23 +              assert_unreached("MUST NOT dispatch progress event.");
    5.24 +            }
    5.25 +          }, "Progress event named progress is not dispatched.");
    5.26 +        }
    5.27 +        xhr.onload = function(pe) {
    5.28 +          test.step(function() {
    5.29 +            if(pe.type == "load") {
    5.30 +              assert_unreached("MUST NOT dispatch progress event.");
    5.31 +            }
    5.32 +          }, "Progress event named load is not dispatched.");
    5.33 +        }
    5.34 +        xhr.onerror = function(pe) {
    5.35 +          test.step(function() {
    5.36 +            if(pe.type == "error") {
    5.37 +              assert_equals(pe.loaded, 0, "loaded is zero.");
    5.38 +              assert_false(pe.lengthComputable, "lengthComputable is false.");
    5.39 +              assert_equals(pe.total, 0, "total is zero.");
    5.40 +            }
    5.41 +          }, "Progress event named error does not reveal information.");
    5.42 +        }
    5.43 +        xhr.onloadend = function(pe) {
    5.44 +          test.done();
    5.45 +        }
    5.46 +        xhr.open("GET", "http://www.w3.org", true);
    5.47 +        xhr.send(null);
    5.48 +      })
    5.49 +    </script>
    5.50 +  </body>
    5.51 +</html>
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.