Bug 1150821 - Update web-platform-tests to revision 1bb38c25b4720fbfd8ca086ef9275ac3e465c659, a=testonly

--HG--
rename : testing/web-platform/tests/.gitmodules => testing/web-platform/tests/tools/.gitmodules
This commit is contained in:
James Graham 2015-04-02 14:45:28 +01:00
Родитель da908aba36
Коммит 1d9588519d
21 изменённых файлов: 311 добавлений и 290 удалений

Просмотреть файл

@ -8955,11 +8955,6 @@
"path": "IndexedDB/key_invalid.htm",
"url": "/IndexedDB/key_invalid.htm"
},
{
"path": "IndexedDB/key_valid.html",
"timeout": "long",
"url": "/IndexedDB/key_valid.html"
},
{
"path": "IndexedDB/keygenerator-constrainterror.htm",
"url": "/IndexedDB/keygenerator-constrainterror.htm"
@ -9820,38 +9815,6 @@
"path": "content-security-policy/img-src/img-src-4_1.html",
"url": "/content-security-policy/img-src/img-src-4_1.html"
},
{
"path": "content-security-policy/media-src/media-src-7_1.html",
"url": "/content-security-policy/media-src/media-src-7_1.html"
},
{
"path": "content-security-policy/media-src/media-src-7_1_2.html",
"url": "/content-security-policy/media-src/media-src-7_1_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_2.html",
"url": "/content-security-policy/media-src/media-src-7_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_2_2.html",
"url": "/content-security-policy/media-src/media-src-7_2_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_3.html",
"url": "/content-security-policy/media-src/media-src-7_3.html"
},
{
"path": "content-security-policy/media-src/media-src-7_3_2.html",
"url": "/content-security-policy/media-src/media-src-7_3_2.html"
},
{
"path": "content-security-policy/object-src/object-src-2_1.html",
"url": "/content-security-policy/object-src/object-src-2_1.html"
},
{
"path": "content-security-policy/object-src/object-src-2_2.html",
"url": "/content-security-policy/object-src/object-src-2_2.html"
},
{
"path": "content-security-policy/script-src/script-src-1_1.html",
"url": "/content-security-policy/script-src/script-src-1_1.html"
@ -14192,10 +14155,6 @@
"path": "html/semantics/forms/the-textarea-element/textarea-type.html",
"url": "/html/semantics/forms/the-textarea-element/textarea-type.html"
},
{
"path": "html/semantics/grouping-content/the-blockquote-element/grouping-blockquote.sub.html",
"url": "/html/semantics/grouping-content/the-blockquote-element/grouping-blockquote.sub.html"
},
{
"path": "html/semantics/grouping-content/the-dd-element/grouping-dd.html",
"url": "/html/semantics/grouping-content/the-dd-element/grouping-dd.html"
@ -18803,6 +18762,11 @@
"timeout": "long",
"url": "/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm"
},
{
"path": "IndexedDB/key_valid.html",
"timeout": "long",
"url": "/IndexedDB/key_valid.html"
},
{
"path": "IndexedDB/keypath_maxsize.htm",
"timeout": "long",
@ -18828,6 +18792,46 @@
"timeout": "long",
"url": "/ambient-light/AmbientLight_tests.html"
},
{
"path": "content-security-policy/media-src/media-src-7_1.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_1.html"
},
{
"path": "content-security-policy/media-src/media-src-7_1_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_1_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_2_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_2_2.html"
},
{
"path": "content-security-policy/media-src/media-src-7_3.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_3.html"
},
{
"path": "content-security-policy/media-src/media-src-7_3_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_3_2.html"
},
{
"path": "content-security-policy/object-src/object-src-2_1.html",
"timeout": "long",
"url": "/content-security-policy/object-src/object-src-2_1.html"
},
{
"path": "content-security-policy/object-src/object-src-2_2.html",
"timeout": "long",
"url": "/content-security-policy/object-src/object-src-2_2.html"
},
{
"path": "cors/status-async.htm",
"timeout": "long",
@ -19500,66 +19504,7 @@
},
"local_changes": {
"deleted": [],
"items": {
"testharness": {
"content-security-policy/media-src/media-src-7_1.html": [
{
"path": "content-security-policy/media-src/media-src-7_1.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_1.html"
}
],
"content-security-policy/media-src/media-src-7_1_2.html": [
{
"path": "content-security-policy/media-src/media-src-7_1_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_1_2.html"
}
],
"content-security-policy/media-src/media-src-7_2.html": [
{
"path": "content-security-policy/media-src/media-src-7_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_2.html"
}
],
"content-security-policy/media-src/media-src-7_2_2.html": [
{
"path": "content-security-policy/media-src/media-src-7_2_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_2_2.html"
}
],
"content-security-policy/media-src/media-src-7_3.html": [
{
"path": "content-security-policy/media-src/media-src-7_3.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_3.html"
}
],
"content-security-policy/media-src/media-src-7_3_2.html": [
{
"path": "content-security-policy/media-src/media-src-7_3_2.html",
"timeout": "long",
"url": "/content-security-policy/media-src/media-src-7_3_2.html"
}
],
"content-security-policy/object-src/object-src-2_1.html": [
{
"path": "content-security-policy/object-src/object-src-2_1.html",
"timeout": "long",
"url": "/content-security-policy/object-src/object-src-2_1.html"
}
],
"content-security-policy/object-src/object-src-2_2.html": [
{
"path": "content-security-policy/object-src/object-src-2_2.html",
"timeout": "long",
"url": "/content-security-policy/object-src/object-src-2_2.html"
}
]
}
},
"items": {},
"reftest_nodes": {}
},
"reftest_nodes": {
@ -24628,7 +24573,7 @@
}
]
},
"rev": "1defdd7213b52589e4b7a259e53f4fff359c301a",
"rev": "1bb38c25b4720fbfd8ca086ef9275ac3e465c659",
"url_base": "/",
"version": 2
}
}

Просмотреть файл

@ -1 +1 @@
26a547de76bfb10335b5a3ba5dfd88a77088da84
6b7e4ef6d1fc15effa2576de3aec04b818b3f58f

17
testing/web-platform/tests/.gitmodules поставляемый
Просмотреть файл

@ -1,18 +1,7 @@
[submodule "resources"]
path = resources
url = https://github.com/w3c/testharness.js.git
ignore = dirty
[submodule "tools/wptserve"]
path = tools/wptserve
url = https://github.com/w3c/wptserve.git
ignore = dirty
[submodule "tools/pywebsocket"]
path = tools/pywebsocket
url = https://github.com/w3c/pywebsocket.git
ignore = dirty
[submodule "html5lib"]
path = tools/html5lib
url = https://github.com/html5lib/html5lib-python.git
[submodule "tools/six"]
path = tools/six
url = https://github.com/jgraham/six.git
[submodule "tools"]
path = tools
url = https://github.com/w3c/wpt-tools.git

Просмотреть файл

@ -1,5 +1,7 @@
language: python
python:
- "2.7"
before_install:
- git submodule update --init --recursive
# command to run tests, e.g. python setup.py test
script: ./lint

Просмотреть файл

@ -7,15 +7,56 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function testNode(node) {
function testNode(create, type) {
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData("test")
assert_equals(node.data, "testtest")
})
node.appendData("bar")
assert_equals(node.data, "testbar")
}, type + ".appendData('bar')")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData("")
assert_equals(node.data, "test")
}, type + ".appendData('')")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData(null)
assert_equals(node.data, "testnull")
}, type + ".appendData(null)")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData(undefined)
assert_equals(node.data, "testundefined")
}, type + ".appendData(undefined)")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData("", "bar")
assert_equals(node.data, "test")
}, type + ".appendData('', 'bar')")
test(function() {
var node = create()
assert_equals(node.data, "test")
assert_throws(new TypeError(), function() { node.appendData() });
assert_equals(node.data, "test")
}, type + ".appendData()")
}
test(function() {
testNode(document.createTextNode("test"))
testNode(document.createComment("test"))
})
testNode(function() { return document.createTextNode("test") }, "Text")
testNode(function() { return document.createComment("test") }, "Comment")
</script>

Просмотреть файл

@ -58,12 +58,13 @@
<img srcset='data:,a 1w 1w' data-expect=''>
<img srcset='data:,a 1w 1x' data-expect=''>
<img srcset='data:,a 1x 1w' data-expect=''>
<img srcset='data:,a 1w 1h' data-expect='data:,a'>
<img srcset='data:,a 1h 1w' data-expect='data:,a'>
<img srcset='data:,a 1w 1h' data-expect='data:,a'><!-- should fail for x-only impl -->
<img srcset='data:,a 1h 1w' data-expect='data:,a'><!-- should fail for x-only impl -->
<img srcset='data:,a 1h 1h' data-expect=''>
<img srcset='data:,a 1h 1x' data-expect=''>
<img srcset='data:,a 1h 1w 1x' data-expect=''>
<img srcset='data:,a 1x 1w 1h' data-expect=''>
<img srcset='data:,a 1w' data-expect='data:,a'><!-- should fail for x-only impl -->
<img srcset='data:,a 1h' data-expect=''>
<img srcset='data:,a 1h foo' data-expect=''>
<img srcset='data:,a foo 1h' data-expect=''>

Просмотреть файл

@ -1,103 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the blockquote element</title>
<link rel="author" title="dzenana" href="mailto:dzenana.trenutak@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-blockquote-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the blockquote element.</p>
<div id="log"></div>
<hr>
<blockquote>0- Cite is not provided.</blockquote>
<blockquote cite="blehblah">1- Cite = "blehblah" </blockquote>
<blockquote cite="http://{{host}}/">2- Cite = "http://{{host}}/"</blockquote>
<blockquote cite="http://{{domains[www2]}}/">3- Cite = "http://{{domains[www2]}}/"</blockquote>
<blockquote cite="http://天気の良い日.{{host}}/">4- Cite = "http://天気の良い日.{{host}}/"</blockquote>
<blockquote cite="http://élève.{{host}}/">5- Cite = "http://élève.{{host}}/"</blockquote>
<blockquote cite="https://{{domains[www]}}/">6- Cite = "https://{{domains[www]}}/"</blockquote>
<blockquote cite=" http://{{host}}/ ">7- Cite = "http://{{host}}/" w/ spaces </blockquote>
<blockquote cite=" http://{{host}}/ ">8- Cite = "http://{{host}}/" w/ tabs </blockquote>
<blockquote cite="&#x20http://{{host}}/&#x20">9- Cite = "http://{{host}}/" w/ Unicode space </blockquote>
<blockquote cite="&#x09http://{{host}}/&#x09">10- Cite = "http://{{host}}/" w/ Unicode tab</blockquote>
<blockquote cite="&#x0Ahttp://{{host}}/&#x0A">11- Cite = "http://{{host}}/" w/ Unicode newline</blockquote>
<blockquote cite="&#x0Chttp://{{host}}/&#x0C">12- Cite = "http://{{host}}/" w/ Unicode formfeed</blockquote>
<blockquote cite="&#x0Dhttp://{{host}}/&#x0D">13- Cite = "http://{{host}}/" w/ Unicode carriage return </blockquote>
<blockquote cite=" &#x20&#x09&#x0A http://{{host}}/ &#x0C &#x0D ">14- Cite = "http://{{host}}/" w/ combo spaces </blockquote>
<script>
"use strict";
var testURLs = [{actual: "", resolved: ""},
{actual: "blehblah", resolved: document.location.protocol + "//" + document.location.host + "/blehblah"},
{actual: "http://{{host}}/", resolved: "http://{{host}}/"},
{actual: "http://{{domains[www2]}}/", resolved: "http://{{domains[www2]}}/"},
{actual: "http://天気の良い日.{{host}}/", resolved: "http://天気の良い日.{{host}}/"},
{actual: "http://élève.{{host}}/", resolved: "http://élève.{{host}}/"},
{actual: "https://{{domains[www]}}/", resolved: "https://{{domains[www]}}/"},
{actual: " http://{{host}}/ ", resolved: "http://{{host}}/"}, // with spaces
{actual: " http://{{host}}/ ", resolved: "http://{{host}}/"}, // with tabs
{actual: "\u0020http://{{host}}/\u0020", resolved: "http://{{host}}/"}, // with unicode space
{actual: "\u0009http://{{host}}/\u0009", resolved: "http://{{host}}/"}, // with unicode tab
{actual: "\u000Ahttp://{{host}}/\u000A", resolved: "http://{{host}}/"}, // with unicode newline
{actual: "\u000Chttp://{{host}}/\u000C", resolved: "http://{{host}}/"}, // with unicode formfeed
{actual: "\u000Dhttp://{{host}}/\u000D", resolved: "http://{{host}}/"}, // with unicode carriage return
{actual: " \u0020\u0009\u000A http://{{host}}/ \u000C \u000D ", resolved: "http://{{host}}/"} // with combo unicode spaces
];
var testElement = {}, testQuotes = [];
setup(function () {
testQuotes = document.getElementsByTagName("blockquote");
testElement = testQuotes[0];
});
// check that prototype matches spec's DOM interface
test(function () {
assert_equals(Object.getPrototypeOf(testElement), HTMLQuoteElement.prototype, "HTMLQuoteElement.prototype should be used for blockquote.");
}, "The prototype for blockquote is HTMLQuoteElement.prototype");
// check that "cite" is an "own" property
test(function () {
assert_own_property(testElement, "cite", "blockquote should have 'cite' as own property.");
}, "blockquote should have 'cite' as own property.");
// If the content attribute is absent, the IDL attribute must return the default value, if the content attribute has one, or else the empty string.
test(function () {
assert_equals(testElement.cite, "", "If the cite content attribute is absent, the IDL attribute must return the empty string.");
}, "If the cite content attribute is absent, the IDL attribute must return the empty string.");
// On setting, the IDL attribute must set the content attribute to the specified literal value.
test(function () {
testElement.cite = "foo bar";
assert_equals(testElement.attributes["cite"].value, "foo bar", "Setting cite IDL sets content attribute to specified literal value.");
}, "Setting cite IDL sets content attribute to specified literal value.");
// All other testQuote examples have content attributes to test vis-a-vis registering and resolving
for (var i = 1; i < testQuotes.length; i++) {
// Check that element's cite content attribute registered properly (literally, not resolved)
test(function () {
assert_equals(testQuotes[i].attributes["cite"].value, testURLs[i].actual, "blockquote #" + i + ": content attribute");
}, "blockquote #" + i + ": cite content attribute registers markup.");
}
for (var i = 1; i < testQuotes.length; i++) {
// The cite IDL attribute must reflect the element's cite content attribute (resolving URLs relative to the element)...
test(function () {
assert_equals(testQuotes[i].cite, testURLs[i].resolved, "blockquote #" + i + ": cite IDL reflects content attribute.");
}, "blockquote #" + i + ": cite IDL reflects content attribute.");
}
// Not checking: Is a sectioning root
</script>
</body>
</html>

Просмотреть файл

@ -1,6 +1,8 @@
#!/usr/bin/env python
import os
import sys
from tools.manifest import update
update.main()
update.main(default_tests_root=
os.path.abspath(os.path.dirname(__file__)))

Просмотреть файл

@ -9,16 +9,15 @@
<!-- Additional helper script for common checks across event types -->
<script type="text/javascript" src="pointerevent_support.js"></script>
</head>
<body onload="run()">
<body>
<h1>PointerEvent: Dispatch custom event</h1>
<h4>Test Description: This test checks if PointerEvent constructor works properly using synthetic pointerover and pointerout events. For valid results, this test must be run without generating real (trusted) pointerover or pointerout events on the black rectangle below.</h4>
<div id="target0"></div>
<script>
var eventTested = false;
var detected_pointertypes = {};
setup({ explicit_done: true });
add_completion_callback(showPointerTypes);
function run() {
async_test(function() {
var target0 = document.getElementById("target0");
// set values for non-default constructor
var testBubbles = true;
@ -33,10 +32,8 @@
var testTiltY = 30;
var testPressure = 0.4;
var testIsPrimary = true;
var pointerEventCustom;
var pointerEventDefault;
on_event(target0, "pointerover", function(event) {
on_event(target0, "pointerover", this.step_func(function(event) {
detected_pointertypes[ event.pointerType ] = true;
generate_tests(assert_equals, [
["custom bubbles", event.bubbles, testBubbles],
@ -54,9 +51,9 @@
test(function() {
assert_approx_equals(event.pressure, testPressure, 0.00000001, "custom pressure: ");
}, "custom pressure: ");
});
}));
on_event(target0, "pointerout", function(event) {
on_event(target0, "pointerout", this.step_func(function(event) {
generate_tests(assert_equals, [
["default pointerId", event.pointerId, 0],
["default pointerType", event.pointerType, ""],
@ -67,12 +64,12 @@
["default pressure", event.pressure, 0],
["default isPrimary", event.isPrimary, false]
]);
});
}));
test(function() {
on_event(window, "load", this.step_func_done(function() {
assert_not_equals(window.PointerEvent, undefined);
pointerEventCustom = new PointerEvent("pointerover",
var pointerEventCustom = new PointerEvent("pointerover",
{bubbles: testBubbles,
cancelable: testCancelable,
pointerId: testPointerId,
@ -90,11 +87,10 @@
// For attributes where values are not provided to the constructor, the corresponding default values must be used.
// TA: 12.1
target0.dispatchEvent(pointerEventCustom);
pointerEventDefault = new PointerEvent("pointerout");
var pointerEventDefault = new PointerEvent("pointerout");
target0.dispatchEvent(pointerEventDefault);
done();
}, "PointerEvent constructor");
}
}, "PointerEvent constructor"));
})
</script>
<div id="complete-notice">
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>

Просмотреть файл

@ -147,6 +147,42 @@ with a TypeError:
return promise_rejects(t, new TypeError(), bar);
}, "Another example");
`EventWatcher` is a constructor function that allows DOM events to be handled
using Promises, which can make it a lot easier to test a very specific series
of events, including ensuring that unexpected events are not fired at any point.
Here's an example of how to use `EventWatcher`:
var t = async_test("Event order on animation start");
var animation = watchedNode.getAnimations()[0];
var eventWatcher = new EventWatcher(watchedNode, ['animationstart',
'animationiteration',
'animationend']);
eventWatcher.wait_for(t, 'animationstart').then(t.step_func(function() {
assertExpectedStateAtStartOfAnimation();
animation.currentTime = END_TIME; // skip to end
// We expect two animationiteration events then an animationend event on
// skipping to the end of the animation.
return eventWatcher.wait_for(['animationiteration',
'animationiteration',
'animationend']);
})).then(t.step_func(function() {
assertExpectedStateAtEndOfAnimation();
test.done();
}));
`wait_for` either takes the name of a single event and returns a Promise that
will resolve after that event is fired at the watched node, or else it takes an
array of the names of a series of events and returns a Promise that will
resolve after that specific series of events has been fired at the watched node.
`EventWatcher` will assert if an event occurs while there is no `wait_for`()
created Promise waiting to be fulfilled, or if the event is of a different type
to the type currently expected. This ensures that only the events that are
expected occur, in the correct order, and with the correct timing.
## Single Page Tests ##
Sometimes, particularly when dealing with asynchronous behaviour,

Просмотреть файл

@ -470,6 +470,74 @@ policies and contribution forms [3].
});
}
/**
* This constructor helper allows DOM events to be handled using Promises,
* which can make it a lot easier to test a very specific series of events,
* including ensuring that unexpected events are not fired at any point.
*/
function EventWatcher(test, watchedNode, eventTypes)
{
if (typeof eventTypes == 'string') {
eventTypes = [eventTypes];
}
var waitingFor = null;
var eventHandler = test.step_func(function(evt) {
assert_true(!!waitingFor,
'Not expecting event, but got ' + evt.type + ' event');
assert_equals(evt.type, waitingFor.types[0],
'Expected ' + waitingFor.types[0] + ' event, but got ' +
evt.type + ' event instead');
if (waitingFor.types.length > 1) {
// Pop first event from array
waitingFor.types.shift();
return;
}
// We need to null out waitingFor before calling the resolve function
// since the Promise's resolve handlers may call wait_for() which will
// need to set waitingFor.
var resolveFunc = waitingFor.resolve;
waitingFor = null;
resolveFunc(evt);
});
for (var i = 0; i < eventTypes.length; i++) {
watchedNode.addEventListener(eventTypes[i], eventHandler);
}
/**
* Returns a Promise that will resolve after the specified event or
* series of events has occured.
*/
this.wait_for = function(types) {
if (waitingFor) {
return Promise.reject('Already waiting for an event or events');
}
if (typeof types == 'string') {
types = [types];
}
return new Promise(function(resolve, reject) {
waitingFor = {
types: types,
resolve: resolve,
reject: reject
};
});
};
function stop_watching() {
for (var i = 0; i < eventTypes.length; i++) {
watchedNode.removeEventListener(eventTypes[i], eventHandler);
}
};
test.add_cleanup(stop_watching);
return this;
}
expose(EventWatcher, 'EventWatcher');
function setup(func_or_properties, maybe_properties)
{
var func = null;

14
testing/web-platform/tests/tools/.gitmodules поставляемый Normal file
Просмотреть файл

@ -0,0 +1,14 @@
[submodule "tools/wptserve"]
path = wptserve
url = https://github.com/w3c/wptserve.git
ignore = dirty
[submodule "tools/pywebsocket"]
path = pywebsocket
url = https://github.com/w3c/pywebsocket.git
ignore = dirty
[submodule "html5lib"]
path = html5lib
url = https://github.com/html5lib/html5lib-python.git
[submodule "tools/six"]
path = six
url = https://github.com/jgraham/six.git

Просмотреть файл

@ -2,6 +2,7 @@
import argparse
import imp
import os
import sys
import manifest
import vcs
@ -82,11 +83,32 @@ def create_parser():
return parser
def main():
def find_top_repo():
path = here
rv = None
while path != "/":
if vcs.is_git_repo(path):
rv = path
path = os.path.abspath(os.path.join(path, os.pardir))
return rv
def main(default_tests_root=None):
opts = create_parser().parse_args()
if opts.tests_root is None:
opts.tests_root = vcs.get_repo_root()
tests_root = None
if default_tests_root is not None:
tests_root = default_tests_root
else:
tests_root = find_top_repo()
if tests_root is None:
print >> sys.stderr, """No git repo found; could not determine test root.
Run again with --test-root"""
sys.exit(1)
opts.tests_root = tests_root
if opts.path is None:
opts.path = os.path.join(opts.tests_root, "MANIFEST.json")

Просмотреть файл

@ -13,9 +13,13 @@ def is_git_repo(tests_root):
_repo_root = None
def get_repo_root():
def get_repo_root(initial_dir=None):
global _repo_root
if initial_dir is None:
initial_dir = os.path.dirname(__file__)
if _repo_root is None:
git = get_git_func(os.path.dirname(__file__))
git = get_git_func(initial_dir)
_repo_root = git("rev-parse", "--show-toplevel").rstrip()
return _repo_root

Просмотреть файл

@ -10,6 +10,10 @@ async_test(function(t) {
if (window.WebSocket) {
document.cookie = 'ws_test_'+cookie_id+'=test; Path=/';
}
t.add_cleanup(function() {
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
});
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie');
ws.onmessage = t.step_func(function(e) {
assert_regexp_match(e.data, new RegExp('ws_test_'+cookie_id+'=test'));
@ -18,6 +22,4 @@ async_test(function(t) {
});
ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)});
});
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
</script>

Просмотреть файл

@ -7,11 +7,13 @@
<script>
var cookie_id = ((new Date())-0) + '.' + Math.random();
async_test(function(t) {
t.add_cleanup(function() {
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
});
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/set-cookie?'+cookie_id);
ws.onopen = t.step_func(function(e) {
assert_regexp_match(document.cookie, new RegExp('ws_test_'+cookie_id+'=test'));
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
ws.close();
t.done();
});

Просмотреть файл

@ -9,25 +9,22 @@ setup({explict_done:true})
var cookie_id = ((new Date())-0) + '.' + Math.random();
var t = async_test(function(t) {
var iframe = document.createElement('iframe');
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=test; Path=/; HttpOnly');
iframe.onload = t.step_func(function() {
var iframe = document.createElement('iframe');
t.add_cleanup(function() {
// remove cookie
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=test; Path=/; HttpOnly');
iframe.onload = t.step_func(function() {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie');
ws.onmessage = t.step_func(function(e) {
ws.close();
assert_regexp_match(e.data, new RegExp('ws_test_'+cookie_id+'=test'));
t.done();;
t.done();
});
ws.onclose = function() { deleteCookie(false, e.type); }
});
var cookie_removed = false;
add_result_callback(function() {
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
document.body.appendChild(iframe);
ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)});
});
document.body.appendChild(iframe);
}, null, {timeout:9900});
</script>

Просмотреть файл

@ -10,6 +10,11 @@ var cookie_id = ((new Date())-0) + '.' + Math.random();
var t = async_test(function(t) {
var iframe = document.createElement('iframe');
t.add_cleanup(function() {
// remove cookie
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
var url = SCHEME_DOMAIN_PORT+'/set-cookie_http?'+cookie_id;
var ws = new WebSocket(url);
ws.onopen = t.step_func(function(e) {
@ -17,13 +22,7 @@ var t = async_test(function(t) {
assert_false(new RegExp('ws_test_'+cookie_id+'=test').test(document.cookie));
t.done();
});
ws.onclose = t.step_func(function(e) {assert_unreached()});
add_result_callback(function() {
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)});
document.body.appendChild(iframe);
}, null, {timeout:9900})
</script>

Просмотреть файл

@ -11,6 +11,11 @@ var cookie_id = ((new Date())-0) + '.' + Math.random();
var t = async_test(function(t) {
var iframe = document.createElement('iframe');
t.add_cleanup(function() {
// remove cookie
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/set-cookie_http?'+cookie_id);
ws.onopen = t.step_func(function(e) {
var ws2 = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie');
@ -21,12 +26,7 @@ var t = async_test(function(t) {
t.done();
});
});
ws.onclose = t.step_func(function() {assert_unreached()});
add_result_callback(function() {
iframe.src = 'support/set-cookie.py?'+encodeURIComponent('ws_test_'+cookie_id+'=; Path=/; HttpOnly; Expires=Sun, 06 Nov 1994 08:49:37 GMT');
iframe.onload = done;
});
ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)});
document.body.appendChild(iframe);
})
</script>

Просмотреть файл

@ -10,6 +10,10 @@ async_test(function(t) {
if (window.WebSocket) {
document.cookie = 'ws_test_'+cookie_id+'=test; Path=/; Secure';
}
t.add_cleanup(function() {
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'=; Path=/; Secure; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
});
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo-cookie');
ws.onmessage = t.step_func(function(e) {
ws.close();
@ -20,8 +24,6 @@ async_test(function(t) {
}
t.done();
})
ws.onclose = t.step_func(function() {assert_unreached()});
ws.onerror = ws.onclose = t.step_func(function(e) {assert_unreached(e.type)});
});
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'; Path=/; Secure; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
</script>

Просмотреть файл

@ -8,15 +8,17 @@
<script>
var cookie_id = ((new Date())-0) + '.' + Math.random();
async_test(function(t) {
t.add_cleanup(function() {
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
});
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/set-cookie?'+cookie_id);
ws.onopen = t.step_func(function(e) {
ws.close();
assert_regexp_match(document.cookie, new RegExp('ws_test_'+cookie_id+'=test'));
// remove cookie
document.cookie = 'ws_test_'+cookie_id+'; Path=/; Expires=Sun, 06 Nov 1994 08:49:37 GMT';
t.done();
});
ws.onclose = t.step_func(function() {assert_unreached()});
ws.onerror = ws.onclose = t.step_func(function() {assert_unreached()});
// sleep for 2 seconds with sync xhr
var sleep = new XMLHttpRequest();