Update web-platform-tests to revision 1d3af70cfecdc12d737f50cda0f402b092797201.

This commit is contained in:
Ms2ger 2015-05-17 13:59:21 +02:00
parent 5b47db447d
commit b9a01881f8
10 changed files with 135 additions and 4825 deletions

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
b3b9deafa7ed87bd0649849f3aa729f21c4ff45d 5b47db447d3151df5c84f2d5042680b32cccf1a8

View file

@ -1,5 +1,15 @@
[018.html] [018.html]
type: testharness type: testharness
[WebSockets: toString(), bubbles, cancelable] expected: TIMEOUT
[open event]
expected: FAIL expected: FAIL
[message event]
expected: TIMEOUT
[error event]
expected: TIMEOUT
[close event]
expected: TIMEOUT

View file

@ -17,8 +17,8 @@ Running the Tests
The tests are designed to be run from your local computer. The test The tests are designed to be run from your local computer. The test
environment requires Python 2.7+ (but not Python 3.x). You will also environment requires Python 2.7+ (but not Python 3.x). You will also
need a copy of OpenSSL. For users on Windows this is available from need a copy of OpenSSL. Users on Windows should read the
[the openssl website](https://www.openssl.org/related/binaries.html). [Windows Notes](#windows-notes) section below.
To get the tests running, you need to set up the test domains in your To get the tests running, you need to set up the test domains in your
[`hosts` file](http://en.wikipedia.org/wiki/Hosts_%28file%29%23Location_in_the_file_system). The [`hosts` file](http://en.wikipedia.org/wiki/Hosts_%28file%29%23Location_in_the_file_system). The
@ -71,6 +71,26 @@ like:
"ssl": {"openssl": {"binary": "/path/to/openssl"}} "ssl": {"openssl": {"binary": "/path/to/openssl"}}
``` ```
<span id="windows-notes">Windows Notes</span>
=============================================
Running wptserve with SSL enabled on Windows typically requires
installing an OpenSSL distribution.
[Shining Light](http://slproweb.com/products/Win32OpenSSL.html)
provide a convenient installer that is known to work, but requires a
little extra setup.
After installation ensure that the path to OpenSSL is on your `%Path%`
environment variable.
Then set the path to the default OpenSSL configuration file (usually
something like `C:\OpenSSL-Win32\bin\openssl.cfg` in the server
configuration. To do this copy `config.default.json` in the
web-platform-tests root to `config.json`. Then edit the JSON so that
the key `ssl/openssl/base_conf_path` has a value that is the path to
the OpenSSL config file.
Test Runner Test Runner
=========== ===========

View file

@ -95,17 +95,6 @@
onlevelchange_test.done(); onlevelchange_test.done();
}; };
// compute primes to deplete the battery faster
var w = new Worker('prime.js');
w.postMessage('compute');
w.onmessage = function (e) {
document.querySelector('#prime').textContent = e.data;
};
add_completion_callback(function () {
w.terminate();
});
navigator.getBattery().then(batterySuccess, batteryFailure); navigator.getBattery().then(batterySuccess, batteryFailure);
})(); })();

View file

@ -1,35 +0,0 @@
// adapted from http://html5demos.com/worker
var running = false;
onmessage = function (event) {
// doesn't matter what the message is, just toggle the worker
if (running == false) {
running = true;
run(1);
} else {
running = false;
}
};
function run(n) {
// split the task into 20k chunks
var limit = n + 20000;
search: while (running && n < limit) {
n += 1;
for (var i = 2; i <= Math.sqrt(n); i += 1) {
if (n % i == 0) {
continue search;
}
}
// found a prime!
postMessage(n);
}
if (n === limit) {
// wait for the UI thread to update itself
setTimeout(function(start_time) {
// resume prime computation at n
run(n);
}, 150);
}
}

View file

@ -11,7 +11,8 @@
"openssl": { "openssl": {
"openssl_binary": "openssl", "openssl_binary": "openssl",
"base_path": "_certs", "base_path": "_certs",
"force_regenerate": false "force_regenerate": false,
"base_conf_path": null
}, },
"pregenerated": { "pregenerated": {
"host_key_path": null, "host_key_path": null,

View file

@ -180,7 +180,7 @@ def start_servers(host, ports, paths, routes, bind_hostname, external_config, ss
for scheme, ports in ports.iteritems(): for scheme, ports in ports.iteritems():
assert len(ports) == {"http":2}.get(scheme, 1) assert len(ports) == {"http":2}.get(scheme, 1)
for port in ports: for port in ports:
if port is None: if port is None:
continue continue
init_func = {"http":start_http_server, init_func = {"http":start_http_server,
@ -290,11 +290,11 @@ def start_wss_server(host, port, path, routes, bind_hostname, external_config, s
return return
def get_ports(config, ssl_enabled): def get_ports(config, ssl_environment):
rv = defaultdict(list) rv = defaultdict(list)
for scheme, ports in config["ports"].iteritems(): for scheme, ports in config["ports"].iteritems():
for i, port in enumerate(ports): for i, port in enumerate(ports):
if scheme in ["http", "https"] and not ssl_enabled: if scheme in ["wss", "https"] and not ssl_environment.ssl_enabled:
port = None port = None
if port == "auto": if port == "auto":
port = get_port() port = get_port()

View file

@ -6,7 +6,8 @@ import tempfile
from datetime import datetime from datetime import datetime
class OpenSSL(object): class OpenSSL(object):
def __init__(self, logger, binary, base_path, conf_path, hosts, duration): def __init__(self, logger, binary, base_path, conf_path, hosts, duration,
base_conf_path=None):
"""Context manager for interacting with OpenSSL. """Context manager for interacting with OpenSSL.
Creates a config file for the duration of the context. Creates a config file for the duration of the context.
@ -21,6 +22,7 @@ class OpenSSL(object):
self.base_path = base_path self.base_path = base_path
self.binary = binary self.binary = binary
self.conf_path = conf_path self.conf_path = conf_path
self.base_conf_path = base_conf_path
self.logger = logger self.logger = logger
self.proc = None self.proc = None
self.cmd = [] self.cmd = []
@ -53,7 +55,13 @@ class OpenSSL(object):
if cmd != "x509": if cmd != "x509":
self.cmd += ["-config", self.conf_path] self.cmd += ["-config", self.conf_path]
self.cmd += list(args) self.cmd += list(args)
self.proc = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
env = os.environ.copy()
if self.base_conf_path is not None:
env["OPENSSL_CONF"] = self.base_conf_path.encode("utf8")
self.proc = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=env)
stdout, stderr = self.proc.communicate() stdout, stderr = self.proc.communicate()
self.log(stdout) self.log(stdout)
if self.proc.returncode != 0: if self.proc.returncode != 0:
@ -99,6 +107,11 @@ def get_config(root_dir, hosts, duration=30):
else: else:
san_line = "subjectAltName = %s" % make_alt_names(hosts) san_line = "subjectAltName = %s" % make_alt_names(hosts)
if os.path.sep == "\\":
# This seems to be needed for the Shining Light OpenSSL on
# Windows, at least.
root_dir = root_dir.replace("\\", "\\\\")
rv = """[ ca ] rv = """[ ca ]
default_ca = CA_default default_ca = CA_default
@ -106,15 +119,15 @@ default_ca = CA_default
dir = %(root_dir)s dir = %(root_dir)s
certs = $dir certs = $dir
new_certs_dir = $certs new_certs_dir = $certs
crl_dir = $dir/crl crl_dir = $dir%(sep)scrl
database = $dir/index.txt database = $dir%(sep)sindex.txt
private_key = $dir/cakey.pem private_key = $dir%(sep)scakey.pem
certificate = $dir/cacert.pem certificate = $dir%(sep)scacert.pem
serial = $dir/serial serial = $dir%(sep)sserial
crldir = $dir/crl crldir = $dir%(sep)scrl
crlnumber = $dir/crlnumber crlnumber = $dir%(sep)scrlnumber
crl = $crldir/crl.pem crl = $crldir%(sep)scrl.pem
RANDFILE = $dir/private/.rand RANDFILE = $dir%(sep)sprivate%(sep)s.rand
x509_extensions = usr_cert x509_extensions = usr_cert
name_opt = ca_default name_opt = ca_default
cert_opt = ca_default cert_opt = ca_default
@ -184,7 +197,8 @@ authorityKeyIdentifier=keyid:always,issuer:always
keyUsage = keyCertSign keyUsage = keyCertSign
""" % {"root_dir": root_dir, """ % {"root_dir": root_dir,
"san_line": san_line, "san_line": san_line,
"duration": duration} "duration": duration,
"sep": os.path.sep}
return rv return rv
@ -193,7 +207,7 @@ class OpenSSLEnvironment(object):
def __init__(self, logger, openssl_binary="openssl", base_path=None, def __init__(self, logger, openssl_binary="openssl", base_path=None,
password="web-platform-tests", force_regenerate=False, password="web-platform-tests", force_regenerate=False,
duration=30): duration=30, base_conf_path=None):
"""SSL environment that creates a local CA and host certificate using OpenSSL. """SSL environment that creates a local CA and host certificate using OpenSSL.
By default this will look in base_path for existing certificates that are still By default this will look in base_path for existing certificates that are still
@ -218,6 +232,7 @@ class OpenSSLEnvironment(object):
self.password = password self.password = password
self.force_regenerate = force_regenerate self.force_regenerate = force_regenerate
self.duration = duration self.duration = duration
self.base_conf_path = base_conf_path
self.path = None self.path = None
self.binary = openssl_binary self.binary = openssl_binary
@ -249,7 +264,7 @@ class OpenSSLEnvironment(object):
def _config_openssl(self, hosts): def _config_openssl(self, hosts):
conf_path = self.path("openssl.cfg") conf_path = self.path("openssl.cfg")
return OpenSSL(self.logger, self.binary, self.base_path, conf_path, hosts, return OpenSSL(self.logger, self.binary, self.base_path, conf_path, hosts,
self.duration) self.duration, self.base_conf_path)
def ca_cert_path(self): def ca_cert_path(self):
"""Get the path to the CA certificate file, generating a """Get the path to the CA certificate file, generating a

View file

@ -5,9 +5,13 @@
<script src=../../../constants.js?pipe=sub></script> <script src=../../../constants.js?pipe=sub></script>
<div id=log></div> <div id=log></div>
<script> <script>
var ws = null;
setup(function() {
ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo_raw');
});
async_test(function(t) { async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo_raw'); ws.addEventListener('open', t.step_func_done(function(e) {
ws.addEventListener('open', t.step_func(function(e) {
// first a text frame, then a frame with reserved opcode 3 // first a text frame, then a frame with reserved opcode 3
// which should fail the connection // which should fail the connection
ws.send('\\x81\\x04test\\x83\\x03LOL'); ws.send('\\x81\\x04test\\x83\\x03LOL');
@ -15,21 +19,29 @@ async_test(function(t) {
assert_equals(e.bubbles, false, 'open e.bubbles'); assert_equals(e.bubbles, false, 'open e.bubbles');
assert_equals(e.cancelable, false, 'open e.cancelable'); assert_equals(e.cancelable, false, 'open e.cancelable');
}), false); }), false);
ws.addEventListener('message', t.step_func(function(e) { }, "open event");
async_test(function(t) {
ws.addEventListener('message', t.step_func_done(function(e) {
assert_equals(e.toString(), '[object MessageEvent]', "message e.toString()"); assert_equals(e.toString(), '[object MessageEvent]', "message e.toString()");
assert_equals(e.bubbles, false, 'message e.bubbles'); assert_equals(e.bubbles, false, 'message e.bubbles');
assert_equals(e.cancelable, false, 'message e.cancelable'); assert_equals(e.cancelable, false, 'message e.cancelable');
}), false); }), false);
ws.addEventListener('error', t.step_func(function(e) { }, "message event");
async_test(function(t) {
ws.addEventListener('error', t.step_func_done(function(e) {
assert_equals(e.toString(), '[object Event]', "error e.toString()"); assert_equals(e.toString(), '[object Event]', "error e.toString()");
assert_equals(e.bubbles, false, 'error e.bubbles'); assert_equals(e.bubbles, false, 'error e.bubbles');
assert_equals(e.cancelable, false, 'error e.cancelable'); assert_equals(e.cancelable, false, 'error e.cancelable');
}), false); }), false);
ws.addEventListener('close', t.step_func(function(e) { }, "error event");
async_test(function(t) {
ws.addEventListener('close', t.step_func_done(function(e) {
assert_equals(e.toString(), '[object CloseEvent]', "close e.toString()"); assert_equals(e.toString(), '[object CloseEvent]', "close e.toString()");
assert_equals(e.bubbles, false, 'close e.bubbles'); assert_equals(e.bubbles, false, 'close e.bubbles');
assert_equals(e.cancelable, false, 'close e.cancelable'); assert_equals(e.cancelable, false, 'close e.cancelable');
t.done();
}), false); }), false);
}); }, "close event");
</script> </script>