From 8ca7ff11ca693ee541bdbcb43d097312cba09935 Mon Sep 17 00:00:00 2001 From: Daniel Robertson Date: Wed, 16 Mar 2016 16:02:22 -0400 Subject: [PATCH] Add wpt tests for send Add wpt tests for send that do not set the responseType and compare the result against a string. --- tests/wpt/mozilla/meta/MANIFEST.json | 12 ++++ .../tests/mozilla/resources/content.py | 18 ++++++ .../tests/mozilla/send-arraybuffer.htm | 50 +++++++++++++++ tests/wpt/mozilla/tests/mozilla/send-blob.htm | 62 +++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 tests/wpt/mozilla/tests/mozilla/resources/content.py create mode 100644 tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm create mode 100644 tests/wpt/mozilla/tests/mozilla/send-blob.htm diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 7ea42099e65..b5a34d37cde 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -6096,6 +6096,18 @@ "url": "/_mozilla/mozilla/script_type.html" } ], + "mozilla/send-arraybuffer.htm": [ + { + "path": "mozilla/send-arraybuffer.htm", + "url": "/_mozilla/mozilla/send-arraybuffer.htm" + } + ], + "mozilla/send-blob.htm": [ + { + "path": "mozilla/send-blob.htm", + "url": "/_mozilla/mozilla/send-blob.htm" + } + ], "mozilla/sequence-hole.html": [ { "path": "mozilla/sequence-hole.html", diff --git a/tests/wpt/mozilla/tests/mozilla/resources/content.py b/tests/wpt/mozilla/tests/mozilla/resources/content.py new file mode 100644 index 00000000000..9369f21171c --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/resources/content.py @@ -0,0 +1,18 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +def main(request, response): + headers = [("Content-type", "text/plain"), + ("X-Request-Method", request.method), + ("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"), + ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), + ("X-Request-Content-Type", request.headers.get("Content-Type", "NO"))] + + if "content" in request.GET: + content = request.GET.first("content") + else: + content = request.body + + return headers, content diff --git a/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm b/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm new file mode 100644 index 00000000000..9b297c8f232 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm @@ -0,0 +1,50 @@ + + + + + + + + + XMLHttpRequest: The send() method: ArrayBuffer data + + + +
+ + + + diff --git a/tests/wpt/mozilla/tests/mozilla/send-blob.htm b/tests/wpt/mozilla/tests/mozilla/send-blob.htm new file mode 100644 index 00000000000..895aae6d77b --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/send-blob.htm @@ -0,0 +1,62 @@ + + + + + + + + + + + XMLHttpRequest: The send() method: Blob data + + + +
+ + + +