Commit 85c1791b authored by Glenn Adams's avatar Glenn Adams

Populate level 3 origin tests.

parent 5da3f5a8
import pprint
def main(request, response):
headers = [("Content-Type", "text/plain")]
ident = request.GET.first('ident', 'test')
......
"use strict";
function run(t) {
var defProperties = t.properties.def;
var url = CROSSDOMAIN + './resources/check-origin.py';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = t.step_func_done(function() {
var response = JSON.parse(xhr.response);
test(function() {
assert_true(response);
}, defProperties.expandedName + '-test-origin-present');
});
xhr.onerror = function() {
assert_unreached('unable to load ' + url);
};
xhr.send();
}
......@@ -5,5 +5,16 @@
"local": "rfc6454.txt",
"dontFetch": true,
"dontFetchReason": "specification is final",
"helpers3": []
"helpers3": [
"ProtocolOrigin"
],
"crossDomainSupport": true,
"tests": [
{
"name": "ProtocolOrigin",
"helper": "ProtocolOrigin",
"code": "run(t)",
"async": true
}
]
}
def main(request, response):
response.headers.set("Content-Type", "text/plain")
origin = request.headers.get("origin")
if origin is not None:
response.headers.set("Access-Control-Allow-Origin", origin)
body = "true"
else:
body = "false"
return body
"use strict";
function run(t) {
var defProperties = t.properties.def;
var url = CROSSDOMAIN + './resources/check-origin.py';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = t.step_func_done(function() {
var response = JSON.parse(xhr.response);
test(function() {
assert_true(response);
}, defProperties.expandedName + '-test-origin-present');
});
xhr.onerror = function() {
assert_unreached('unable to load ' + url);
};
xhr.send();
}
<!-- Copyright (C) 2014, Cable Television Laboratories, Inc. & Skynav, Inc. -->
<!-- DO NOT EDIT! This test was generated by $(CVP2TS)/tools/level2/generate/generate.js. -->
<!doctype html>
<meta charset='utf-8'>
<title>Test ProtocolOrigin</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='/tools/common/level3.js'></script>
<script src='/tools/common/crossdomain.js?pipe=sub'></script>
<script src='./helpers/ProtocolOrigin.js'></script>
<script type='text/plain' id='testDef'>
{"name":"ProtocolOrigin","helper":"ProtocolOrigin","code":"run(t)","async":true}
</script>
<h1>Test ProtocolOrigin Support</h1>
<div id='log'></div>
<script>
level3Async('origin', JSON.parse(document.getElementById('testDef').textContent), function(t){return run(t);});
</script>
def main(request, response):
response.headers.set("Content-Type", "text/plain")
origin = request.headers.get("origin")
if origin is not None:
response.headers.set("Access-Control-Allow-Origin", origin)
body = "true"
else:
body = "false"
return body
function dirname(path) {
return path.replace(/\/[^\/]*$/, '/')
}
var SUBDOMAIN = 'www1'
var PORT = {{ports[http][1]}}
var CROSSDOMAIN = dirname(location.href).replace('://', '://' + SUBDOMAIN + '.')
var REMOTE_HOST = SUBDOMAIN + '.' + location.host
var REMOTE_PROTOCOL = location.protocol
var REMOTE_ORIGIN = REMOTE_PROTOCOL + '//' + REMOTE_HOST
......@@ -37,6 +37,7 @@
var defaults = {
configFile : undefined,
configFileEncoding : 'utf8',
crossDomainSupport : false,
helpers3 : undefined,
level : 3,
local : undefined,
......@@ -171,6 +172,8 @@
html += "<script src='/resources/testharness.js'></script>\n";
html += "<script src='/resources/testharnessreport.js'></script>\n";
html += "<script src='/tools/common/level3.js'></script>\n";
if ($.options['crossDomainSupport'])
html += "<script src='/tools/common/crossdomain.js?pipe=sub'></script>\n";
if (!!helper)
html += "<script src='./helpers/" + helper + ".js'></script>\n";
html += "<script type='text/plain' id='testDef'>\n";
......
......@@ -5,6 +5,6 @@
"https": [ "auto" ]
},
"check_subdomains": true,
"log_level": "debug",
"log_level": "info",
"bind_hostname": true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment