Porting access-control-response-with-body-sync from LayoutTest to WPT
Bug: 745385
Change-Id: I7a95993d3af74ba41756764bd96c6a3440dced32
Reviewed-on: https://chromium-review.googlesource.com/644926
Commit-Queue: Austin James Ahlstrom <aahlstrom@google.com>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501888}
diff --git a/XMLHttpRequest/access-control-response-with-body-sync.htm b/XMLHttpRequest/access-control-response-with-body-sync.htm
new file mode 100644
index 0000000..559b7d2
--- /dev/null
+++ b/XMLHttpRequest/access-control-response-with-body-sync.htm
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Tests body from CORS preflight response and actual response with sync request</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ </head>
+ <body>
+ <script type="text/javascript">
+test(() => {
+ const xhr = new XMLHttpRequest;
+
+ xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN+
+ "/XMLHttpRequest/resources/access-control-allow-with-body.py", false);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ xhr.send();
+
+ assert_equals(xhr.status, 200);
+ assert_equals(xhr.responseText, "PASS");
+});
+ </script>
+ </body>
+</html>