ported js scripts and pulled puhley's php to cors1.0 testJam
authorGopal Raghavan <gopal.raghavan@nokia.com>
Thu, 03 May 2012 15:44:21 -0700
branchtestJam
changeset 55 fa303bb04679
parent 48 e872c4bb2244
child 56 f7794f64d068
ported js scripts and pulled puhley's php to cors1.0
tests/cors/submitted/cors1.0/MANIFEST
tests/cors/submitted/cors1.0/access-control-basic-non-simple-allow.html
tests/cors/submitted/cors1.0/resources/access-control-basic-non-get-allow.php
tests/cors/submitted/webkit/resources/access-control-basic-non-get-allow.php
--- a/tests/cors/submitted/cors1.0/MANIFEST	Thu May 03 15:30:50 2012 -0700
+++ b/tests/cors/submitted/cors1.0/MANIFEST	Thu May 03 15:44:21 2012 -0700
@@ -2,3 +2,4 @@
 access-control-basic-allow-star.html
 access-control-basic-denied.html
 access-control-basic-allow-access-control-origin-header.html
+access-control-basic-non-simple-allow.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cors/submitted/cors1.0/access-control-basic-non-simple-allow.html	Thu May 03 15:44:21 2012 -0700
@@ -0,0 +1,43 @@
+<html>
+<body>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+
+<pre id='console'></pre>
+<div  id=log></div>
+<script type="text/javascript">
+function log(message)
+{
+    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var accessControlBasicNonSimpleAllow = function() {
+    var xhr = new XMLHttpRequest;
+    var path = "/webappsec/tests/cors/submitted/cors1.0";
+
+    try {
+        xhr.open("PUT", "http://www1.w3c-test.org" + path + "/resources/access-control-basic-non-get-allow.php", false);
+    } catch(e) {
+        log("FAIL: Exception thrown. Cross-domain access is not allowed in 'open'. [" + e.message + "].");
+        return;
+    }
+
+    xhr.setRequestHeader("Content-Type", "text/plain; charset=UTF-8");
+
+    try {
+        xhr.send("PASS: PUT data received");
+    } catch(e) {
+        log("FAIL: Exception thrown. Cross-domain access is not allowed in 'send'. [" + e.message + "].");
+        return;
+    }
+
+    //log(xhr.responseText);
+};
+test(accessControlBasicNonSimpleAllow, "access-control-basic-non-simple-allow")
+
+</script>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cors/submitted/cors1.0/resources/access-control-basic-non-get-allow.php	Thu May 03 15:44:21 2012 -0700
@@ -0,0 +1,21 @@
+<?PHP
+
+if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
+    header("Content-Type: text/plain");
+    header("Access-Control-Allow-Credentials: true");
+    header("Access-Control-Allow-Methods: PUT");
+    header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
+} elseif ($_SERVER['REQUEST_METHOD'] == "PUT") {
+    header("Content-Type: text/plain");
+    header("Access-Control-Allow-Credentials: true");
+    header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
+
+    echo "PASS: Cross-domain access allowed.\n";
+    $request_body = @file_get_contents('php://input');
+    echo $request_body ;
+} else {
+    header("Content-Type: text/plain");
+    echo "Wrong method: " . $_SERVER['REQUEST_METHOD'] . "\n";
+}
+
+?>
--- a/tests/cors/submitted/webkit/resources/access-control-basic-non-get-allow.php	Thu May 03 15:30:50 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?PHP
-
-if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
-    header("Content-Type: text/plain");
-    header("Access-Control-Allow-Credentials: true");
-    header("Access-Control-Allow-Methods: PUT");
-    header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
-} elseif ($_SERVER['REQUEST_METHOD'] == "PUT") {
-    header("Content-Type: text/plain");
-    header("Access-Control-Allow-Credentials: true");
-    header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
-
-    echo "PASS: Cross-domain access allowed.\n";
-    $request_body = @file_get_contents('php://input');
-    echo $request_body ;
-} else {
-    header("Content-Type: text/plain");
-    echo "Wrong method: " . $_SERVER['REQUEST_METHOD'] . "\n";
-}
-
-?>