Commit d1eb8915 authored by Glenn Adams's avatar Glenn Adams

Populate level 4 wsp tests.

parent 83595270
Tue, 21 Oct 2014 07:10:09 GMT
\ No newline at end of file
Tue, 21 Oct 2014 20:10:08 GMT
\ No newline at end of file
......@@ -8,7 +8,7 @@
"helpers3": [
"ProtocolCORS"
],
"crossDomainSupport": true,
"configuredConstantsSupport": true,
"tests": [
{
"name": "ProtocolCORS",
......
Tue, 21 Oct 2014 07:12:33 GMT
\ No newline at end of file
Tue, 21 Oct 2014 20:12:32 GMT
\ No newline at end of file
This diff is collapsed.
......@@ -8,7 +8,7 @@
"helpers3": [
"ProtocolOrigin"
],
"crossDomainSupport": true,
"configuredConstantsSupport": true,
"tests": [
{
"name": "ProtocolOrigin",
......
......@@ -9,7 +9,7 @@
<hgroup>
<h1 class="allcaps">URL</h1>
<h2>Living Standard — Last Updated 20 October 2014</h2>
<h2>Living Standard — Last Updated 21 October 2014</h2>
</hgroup>
<dl>
......@@ -1720,9 +1720,10 @@ optionally with an <a class="external" data-anolis-spec="encoding" href="https:/
<li><p>Set <var title="">url</var>'s <a href="#concept-url-password" title="concept-url-password">password</a> to
the empty string.
<li><p>For each code point in the given value, <a href="#utf-8-percent-encode">utf-8 percent encode</a> it
using the <a href="#password-encode-set">password encode set</a>, and append the result to
<var title="">url</var>'s <a href="#concept-url-password" title="concept-url-password">password</a>.
<li><p>For each code point in <var title="">password</var>,
<a href="#utf-8-percent-encode">utf-8 percent encode</a> it using the <a href="#password-encode-set">password encode set</a>, and
append the result to <var title="">url</var>'s
<a href="#concept-url-password" title="concept-url-password">password</a>.
</ol>
</ol>
......@@ -2221,28 +2222,32 @@ and optionally a <var title="">url</var>, run these steps:
constructor, when invoked, must run these steps:
<ol>
<li><p>Set <var title="">base</var> to the result of running the
<a href="#concept-basic-url-parser" title="concept-basic-url-parser">base URL parser</a> on <var title="">base</var>.
<li><p>Let <var title="">parsedBase</var> be the result of running the
<a href="#concept-basic-url-parser" title="concept-basic-url-parser">basic URL parser</a> on <var title="">base</var>.
<li><p>If <var title="">base</var> is failure, <a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a
<code title="">TypeError</code> exception.
<li><p>If <var title="">parsedBase</var> is failure,
<a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a <code title="">TypeError</code> exception.
<li><p>Set <var title="">url</var> to the result of running the
<a href="#concept-basic-url-parser" title="concept-basic-url-parser">basic URL parser</a> on <var title="">input</var>
with <var title="">base</var>.
<li><p>Set <var title="">parsedURL</var> to the result of running the
<a href="#concept-basic-url-parser" title="concept-basic-url-parser">basic URL parser</a> on <var title="">url</var>
with <var title="">parsedBase</var>.
<li><p>If <var title="">url</var> is failure, <a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a
<code title="">TypeError</code> exception.
<li><p>If <var title="">parsedURL</var> is failure,
<a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a <code title="">TypeError</code> exception.
<li><p>Let <var title="">result</var> be a new <a href="#url"><code>URL</code></a> object.
<li><p>Let <var title="">result</var>'s
<a href="#concept-urlutils-get-the-base" title="concept-URLUtils-get-the-base">get the base</a> return
<var title="">base</var>.
<var title="">parsedBase</var>.
<li>
<p>Run <var title="">result</var>'s
<a href="#concept-urlutils-set-the-input" title="concept-URLUtils-set-the-input">set the input</a> given the empty string
and <var title="">parsedURL</var>.
<li><p>Run <var title="">result</var>'s
<a href="#concept-urlutils-set-the-input" title="concept-URLUtils-set-the-input">set the input</a> given the empty string
and <var title="">url</var>.
<p class="note no-backref">A <a href="#url"><code>URL</code></a> object's
<a href="#concept-urlutils-input" title="concept-URLUtils-input">input</a> is never exposed.
<li><p>Return <var title="">result</var>.
</ol>
......@@ -2329,16 +2334,20 @@ these steps:
run these substeps:
<ol>
<li><p>Let <var title="">url</var> be the result of running the
<li><p>Let <var title="">parsedURL</var> be the result of running the
<a href="#concept-basic-url-parser" title="concept-basic-url-parser">basic URL parser</a> on <var title="">input</var>
with <a href="#concept-base-url" title="concept-base-url">base URL</a> being the result of running
<a href="#concept-urlutils-get-the-base" title="concept-URLUtils-get-the-base">get the base</a>.
<li><p>If <var title="">url</var> is failure, <a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a
<code title="">TypeError</code> exception.
<li><p>If <var title="">parsedURL</var> is failure,
<a class="external" data-anolis-spec="webidl" href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a <code title="">TypeError</code> exception.
<li>
<p>Run <a href="#concept-urlutils-set-the-input" title="concept-URLUtils-set-the-input">set the input</a> given the empty
string and <var title="">parsedURL</var>.
<li><p>Run <a href="#concept-urlutils-set-the-input" title="concept-URLUtils-set-the-input">set the input</a> given
<var title="">input</var> and <var title="">url</var>.
<p class="note no-backref">A <a href="#url"><code>URL</code></a> object's
<a href="#concept-urlutils-input" title="concept-URLUtils-input">input</a> is never exposed.
</ol>
<li>
......
Mon, 20 Oct 2014 17:10:56 GMT
\ No newline at end of file
Tue, 21 Oct 2014 10:47:35 GMT
\ No newline at end of file
"use strict";
function run(tOuter) {
var properties = tOuter.properties;
var defProperties = properties.def;
var url = 'ws://' + WS_SERVER + ':' + WS_PORT + WS_PATH_ECHO;
var ws = new WebSocket(url);
var open = false;
var data = 'message';
var tOpen = async_test(defProperties.expandedName + '-check-open');
var tData;
var tDone;
ws.onopen = tOpen.step_func_done(function() {
open = true;
ws.send(data);
assert_equals(ws.bufferedAmount, data.length);
tData = async_test(defProperties.expandedName + '-check-data');
});
ws.onmessage = tData.step_func_done(function(evt) {
assert_equals(evt.data, data);
ws.close();
tDone = async_test(defProperties.expandedName + '-check-done');
});
ws.onclose = tDone.step_func_done(function(evt) {
assert_true(open);
open = false;
assert_true(evt.wasClean);
tOuter.done();
});
}
......@@ -9,6 +9,7 @@
"helpers3": [
"SchemeWS"
],
"configuredConstantsSupport": true,
"tests": [
{
"name": "SchemeWS",
......
Tue, 21 Oct 2014 07:22:53 GMT
\ No newline at end of file
Tue, 21 Oct 2014 20:18:19 GMT
\ No newline at end of file
......@@ -6,7 +6,7 @@
<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='/tools/common/constants.js?pipe=sub'></script>
<script src='./helpers/ProtocolCORS.js'></script>
<script type='text/plain' id='testDef'>
{"name":"ProtocolCORS","helper":"ProtocolCORS","code":"run(t)","async":true}
......
......@@ -6,7 +6,7 @@
<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='/tools/common/constants.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}
......
"use strict";
function run(tOuter) {
var properties = tOuter.properties;
var defProperties = properties.def;
var url = 'ws://' + WS_SERVER + ':' + WS_PORT + WS_PATH_ECHO;
var ws = new WebSocket(url);
var open = false;
var data = 'message';
var tOpen = async_test(defProperties.expandedName + '-check-open');
var tData;
var tDone;
ws.onopen = tOpen.step_func_done(function() {
open = true;
ws.send(data);
assert_equals(ws.bufferedAmount, data.length);
tData = async_test(defProperties.expandedName + '-check-data');
});
ws.onmessage = tData.step_func_done(function(evt) {
assert_equals(evt.data, data);
ws.close();
tDone = async_test(defProperties.expandedName + '-check-done');
});
ws.onclose = tDone.step_func_done(function(evt) {
assert_true(open);
open = false;
assert_true(evt.wasClean);
tOuter.done();
});
}
<!-- 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 SchemeWS</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='/tools/common/level3.js'></script>
<script src='/tools/common/constants.js?pipe=sub'></script>
<script src='./helpers/SchemeWS.js'></script>
<script type='text/plain' id='testDef'>
{"name":"SchemeWS","helper":"SchemeWS","code":"run(t)","async":true}
</script>
<h1>Test SchemeWS Support</h1>
<div id='log'></div>
<script>
level3Async('wsp', JSON.parse(document.getElementById('testDef').textContent), function(t){return run(t);});
</script>
"use strict";
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
var WS_SERVER = '{{host}}';
var WS_PORT = '{{ports[ws][0]}}';
var WS_PATH_ECHO = '/echo';
......@@ -37,7 +37,7 @@
var defaults = {
configFile : undefined,
configFileEncoding : 'utf8',
crossDomainSupport : false,
configuredConstantsSupport : false,
helpers3 : undefined,
level : 3,
local : undefined,
......@@ -172,8 +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 ($.options['configuredConstantsSupport'])
html += "<script src='/tools/common/constants.js?pipe=sub'></script>\n";
if (!!helper)
html += "<script src='./helpers/" + helper + ".js'></script>\n";
html += "<script type='text/plain' id='testDef'>\n";
......
......@@ -303,7 +303,7 @@ def set_computed_defaults(config):
root = config["doc_root"]
else:
root = repo_root
config["ws_doc_root"] = os.path.join(repo_root, "websockets", "handlers")
config["ws_doc_root"] = os.path.join(repo_root, "tools", "wsh")
if not value_set(config, "doc_root"):
config["doc_root"] = repo_root
......
#!/usr/bin/python
from mod_pywebsocket import msgutil
_GOODBYE_MESSAGE = u'Goodbye'
def web_socket_do_extra_handshake(request):
# This example handler accepts any request. See origin_check_wsh.py for how
# to reject access from untrusted scripts based on origin value.
if request.ws_requested_protocols:
if "echo" in request.ws_requested_protocols:
request.ws_protocol = "echo"
def web_socket_transfer_data(request):
while True:
line = request.ws_stream.receive_message()
if line is None:
return
if isinstance(line, unicode):
request.ws_stream.send_message(line, binary=False)
if line == _GOODBYE_MESSAGE:
return
else:
request.ws_stream.send_message(line, binary=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