summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/progress-events
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/progress-events
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/progress-events')
-rw-r--r--testing/web-platform/tests/progress-events/Status.html26
-rw-r--r--testing/web-platform/tests/progress-events/constructor.html43
-rw-r--r--testing/web-platform/tests/progress-events/interface.html49
-rw-r--r--testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html38
-rw-r--r--testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html38
-rw-r--r--testing/web-platform/tests/progress-events/tests/submissions/Samsung/resources/no-content-length.py15
6 files changed, 209 insertions, 0 deletions
diff --git a/testing/web-platform/tests/progress-events/Status.html b/testing/web-platform/tests/progress-events/Status.html
new file mode 100644
index 000000000..f2aee75d7
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/Status.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+<head>
+ <title>Progress Events Test Status</title>
+</head>
+<body>
+
+<h2>Progress Events Test Suite Status</h2>
+
+<p>This test suite is part of the
+<a href="http://www.w3.org/2008/webapps/wiki/">Web Application WG's</a>
+Test Repository as described in WebApps'
+<a href="http://www.w3.org/2008/webapps/wiki/Testing">Testing Wiki</a>.
+</p>
+
+<p>The test suite is for the
+<a href="http://dev.w3.org/2006/webapi/progress/">Progress Events</a> specification.
+</p>
+
+<ul>
+ <li>Test suite status: The group has reviewed and approved all tests in the approved folder.</li>
+ <li>Test suite Facilitator: Jungkee Song</li>
+</ul>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/progress-events/constructor.html b/testing/web-platform/tests/progress-events/constructor.html
new file mode 100644
index 000000000..a99013a28
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/constructor.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<title>ProgressEvent constructor</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function() {
+ var ev = new ProgressEvent("test")
+ assert_equals(ev.type, "test")
+ assert_equals(ev.target, null)
+ assert_equals(ev.currentTarget, null)
+ assert_equals(ev.eventPhase, Event.NONE)
+ assert_equals(ev.bubbles, false)
+ assert_equals(ev.cancelable, false)
+ assert_equals(ev.defaultPrevented, false)
+ assert_true(ev.timeStamp > 0)
+ assert_true("initEvent" in ev)
+ assert_equals(ev.lengthComputable, false)
+ assert_equals(ev.loaded, 0)
+ assert_equals(ev.total, 0)
+}, "Default event values.")
+test(function() {
+ var ev = new ProgressEvent("test")
+ assert_equals(ev["initProgressEvent"], undefined)
+}, "There must not be a initProgressEvent().")
+test(function() {
+ var ev = new ProgressEvent("I am an event", { type: "trololol", bubbles: true, cancelable: false})
+ assert_equals(ev.type, "I am an event")
+ assert_equals(ev.bubbles, true)
+ assert_equals(ev.cancelable, false)
+}, "Basic test.")
+test(function() {
+ var ev = new ProgressEvent(null, { lengthComputable: "hah", loaded: "2" })
+ assert_equals(ev.type, "null")
+ assert_equals(ev.lengthComputable, true)
+ assert_equals(ev.loaded, 2)
+}, "ECMAScript value conversion test.")
+test(function() {
+ var ev = new ProgressEvent("Xx", { lengthcomputable: true})
+ assert_equals(ev.type, "Xx")
+ assert_equals(ev.lengthComputable, false)
+}, "ProgressEventInit members must be matched case-sensitively.")
+</script>
diff --git a/testing/web-platform/tests/progress-events/interface.html b/testing/web-platform/tests/progress-events/interface.html
new file mode 100644
index 000000000..850d1b23d
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/interface.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<title>The ProgressEvent interface</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_equals(typeof ProgressEvent, "function")
+ assert_equals(ProgressEvent.length, 1)
+})
+test(function() {
+ var desc = Object.getOwnPropertyDescriptor(ProgressEvent, "prototype")
+ assert_equals(desc.value, ProgressEvent.prototype)
+ assert_equals(desc.writable, false)
+ assert_equals(desc.enumerable, false)
+ assert_equals(desc.configurable, false)
+ assert_throws(new TypeError(), function() {
+ "use strict";
+ delete ProgressEvent.prototype;
+ })
+ assert_equals(ProgressEvent.prototype.constructor, ProgressEvent)
+ assert_equals(Object.getPrototypeOf(ProgressEvent.prototype), Event.prototype)
+}, "interface prototype object")
+var attributes = [
+ ["boolean", "lengthComputable"],
+ ["unsigned long long", "loaded"],
+ ["unsigned long long", "total"]
+];
+attributes.forEach(function(a) {
+ test(function() {
+ var desc = Object.getOwnPropertyDescriptor(ProgressEvent.prototype, a[1])
+ assert_equals(desc.enumerable, true)
+ assert_equals(desc.configurable, true)
+ assert_throws(new TypeError(), function() {
+ ProgressEvent.prototype[a[1]]
+ })
+ })
+})
+test(function() {
+ for (var p in window) {
+ assert_not_equals(p, "ProgressEvent")
+ }
+}, "Interface objects properties should not be Enumerable")
+test(function() {
+ assert_true(!!window.ProgressEvent, "Interface should exist.")
+ assert_true(delete window.ProgressEvent, "The delete operator should return true.")
+ assert_equals(window.ProgressEvent, undefined, "Interface should be gone.")
+}, "Should be able to delete ProgressEvent.")
+</script>
diff --git a/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html
new file mode 100644
index 000000000..d897a7110
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-content-length.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html>
+ <head>
+ <title>ProgressEvent: firing events for HTTP with Content-Length</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <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]" />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var test = async_test();
+
+ test.step(function() {
+ var xhr = new XMLHttpRequest();
+
+ xhr.onprogress = function(pe) {
+ test.step(function() {
+ if(pe.type == "progress") {
+ assert_true(pe.loaded >= 0, "loaded is initialize to the number of HTTP entity body bytes transferred.");
+ assert_true(pe.lengthComputable, "lengthComputable is true.");
+ assert_not_equals(pe.total, 0, "total is not zero.");
+ }
+ }, "Check lengthComputed, loaded, total when Content-Length is given.");
+ }
+
+ // "loadstart", "error", "abort", "load" tests are out of scope.
+ // They SHOULD be tested in each spec that implement ProgressEvent.
+
+ xhr.onloadend = function(pe) {
+ test.done();
+ }
+ xhr.open("GET", "resources/img.jpg", true);
+ xhr.send(null);
+ })
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html
new file mode 100644
index 000000000..b30b03afe
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/firing-events-http-no-content-length.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html>
+ <head>
+ <title>ProgressEvent: firing events for HTTP with no Content-Length</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <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]" />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var test = async_test();
+
+ test.step(function() {
+ var xhr = new XMLHttpRequest();
+
+ xhr.onprogress = function(pe) {
+ test.step(function() {
+ if(pe.type == "progress") {
+ assert_true(pe.loaded >= 0, "loaded is initialize to the number of HTTP entity body bytes transferred.");
+ assert_false(pe.lengthComputable, "lengthComputable is false.");
+ assert_equals(pe.total, 0, "total is zero.");
+ }
+ }, "Check lengthComputed, loaded, total when Content-Length is NOT given.");
+ }
+
+ // "loadstart", "error", "abort", "load" tests are out of scope.
+ // They SHOULD be tested in each spec that implement ProgressEvent.
+
+ xhr.onloadend = function(pe) {
+ test.done();
+ }
+ xhr.open("GET", "resources/no-content-length.py", true);
+ xhr.send(null);
+ })
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/progress-events/tests/submissions/Samsung/resources/no-content-length.py b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/resources/no-content-length.py
new file mode 100644
index 000000000..0b47ff146
--- /dev/null
+++ b/testing/web-platform/tests/progress-events/tests/submissions/Samsung/resources/no-content-length.py
@@ -0,0 +1,15 @@
+def main(request, response):
+ response.headers.update([('Transfer-Encoding', 'chunked'),
+ ('Content-Type', 'text/html'),
+ ('Connection', 'keep-alive')])
+ response.write_status_headers()
+ response.explicit_flush = True
+
+ string = "W3C"
+ for i in xrange(1000):
+ response.writer.write("%s\r\n%s\r\n" % (len(string), string))
+ response.writer.flush();
+
+ response.writer.write("0\r\n\r\n")
+ response.writer.flush();
+