Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -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>

View file

@ -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>

View file

@ -0,0 +1,53 @@
<!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)
assert_throws(new TypeError(), function() {
"use strict";
delete ProgressEvent.length;
})
})
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>

View file

@ -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>

View file

@ -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>

View file

@ -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();