Update web-platform-tests to revision acd60f9e55532f03fc905e61591b7fd7db2f08d1

This commit is contained in:
Ms2ger 2015-08-26 09:41:40 +02:00
parent a1cd27e6a3
commit be4f0ad8de
44 changed files with 544 additions and 663 deletions

View file

@ -1049,6 +1049,10 @@
"path": "screen-orientation/page-visibility-manual.html", "path": "screen-orientation/page-visibility-manual.html",
"url": "/screen-orientation/page-visibility-manual.html" "url": "/screen-orientation/page-visibility-manual.html"
}, },
{
"path": "selection/dir-manual.html",
"url": "/selection/dir-manual.html"
},
{ {
"path": "svg/import/animate-dom-01-f-manual.svg", "path": "svg/import/animate-dom-01-f-manual.svg",
"url": "/svg/import/animate-dom-01-f-manual.svg" "url": "/svg/import/animate-dom-01-f-manual.svg"
@ -12203,22 +12207,6 @@
"path": "ambient-light/idlharness.html", "path": "ambient-light/idlharness.html",
"url": "/ambient-light/idlharness.html" "url": "/ambient-light/idlharness.html"
}, },
{
"path": "animation-timing/callback-invoked.html",
"url": "/animation-timing/callback-invoked.html"
},
{
"path": "animation-timing/cancel-invoked.html",
"url": "/animation-timing/cancel-invoked.html"
},
{
"path": "animation-timing/idlharness.html",
"url": "/animation-timing/idlharness.html"
},
{
"path": "animation-timing/same-dispatch-time.html",
"url": "/animation-timing/same-dispatch-time.html"
},
{ {
"path": "battery-status/battery-interface-idlharness.html", "path": "battery-status/battery-interface-idlharness.html",
"url": "/battery-status/battery-interface-idlharness.html" "url": "/battery-status/battery-interface-idlharness.html"
@ -15475,6 +15463,10 @@
"path": "html/dom/elements/global-attributes/the-translate-attribute-012.html", "path": "html/dom/elements/global-attributes/the-translate-attribute-012.html",
"url": "/html/dom/elements/global-attributes/the-translate-attribute-012.html" "url": "/html/dom/elements/global-attributes/the-translate-attribute-012.html"
}, },
{
"path": "html/editing/activation/click.html",
"url": "/html/editing/activation/click.html"
},
{ {
"path": "html/editing/dnd/dom/draggable.html", "path": "html/editing/dnd/dom/draggable.html",
"url": "/html/editing/dnd/dom/draggable.html" "url": "/html/editing/dnd/dom/draggable.html"
@ -17843,6 +17835,26 @@
"path": "html/syntax/serializing-html-fragments/outerHTML.html", "path": "html/syntax/serializing-html-fragments/outerHTML.html",
"url": "/html/syntax/serializing-html-fragments/outerHTML.html" "url": "/html/syntax/serializing-html-fragments/outerHTML.html"
}, },
{
"path": "html/webappapis/animation-frames/callback-exception.html",
"url": "/html/webappapis/animation-frames/callback-exception.html"
},
{
"path": "html/webappapis/animation-frames/callback-invoked.html",
"url": "/html/webappapis/animation-frames/callback-invoked.html"
},
{
"path": "html/webappapis/animation-frames/cancel-invoked.html",
"url": "/html/webappapis/animation-frames/cancel-invoked.html"
},
{
"path": "html/webappapis/animation-frames/idlharness.html",
"url": "/html/webappapis/animation-frames/idlharness.html"
},
{
"path": "html/webappapis/animation-frames/same-dispatch-time.html",
"url": "/html/webappapis/animation-frames/same-dispatch-time.html"
},
{ {
"path": "html/webappapis/atob/base64.html", "path": "html/webappapis/atob/base64.html",
"url": "/html/webappapis/atob/base64.html" "url": "/html/webappapis/atob/base64.html"
@ -24987,10 +24999,6 @@
"path": "selection/deleteFromDocument.html", "path": "selection/deleteFromDocument.html",
"url": "/selection/deleteFromDocument.html" "url": "/selection/deleteFromDocument.html"
}, },
{
"path": "selection/dir.manual.html",
"url": "/selection/dir.manual.html"
},
{ {
"path": "selection/extend.html", "path": "selection/extend.html",
"url": "/selection/extend.html" "url": "/selection/extend.html"
@ -25139,10 +25147,6 @@
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html", "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html",
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html" "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html"
}, },
{
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html",
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html"
},
{ {
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html", "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html",
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html" "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html"
@ -25159,10 +25163,6 @@
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html", "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html",
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html" "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html"
}, },
{
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html",
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html"
},
{ {
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html", "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html",
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html" "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html"
@ -25671,6 +25671,10 @@
"path": "webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html", "path": "webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html",
"url": "/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html" "url": "/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html"
}, },
{
"path": "webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html",
"url": "/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html"
},
{ {
"path": "webgl/bufferSubData.html", "path": "webgl/bufferSubData.html",
"url": "/webgl/bufferSubData.html" "url": "/webgl/bufferSubData.html"
@ -27555,6 +27559,10 @@
"path": "workers/semantics/encodings/004.html", "path": "workers/semantics/encodings/004.html",
"url": "/workers/semantics/encodings/004.html" "url": "/workers/semantics/encodings/004.html"
}, },
{
"path": "workers/semantics/encodings/004.worker.js",
"url": "/workers/semantics/encodings/004.worker"
},
{ {
"path": "workers/semantics/interface-objects/001.worker.js", "path": "workers/semantics/interface-objects/001.worker.js",
"url": "/workers/semantics/interface-objects/001.worker" "url": "/workers/semantics/interface-objects/001.worker"
@ -29097,14 +29105,7 @@
] ]
}, },
"local_changes": { "local_changes": {
"deleted": [ "deleted": [],
"shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html",
"shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html",
"shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html",
"shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html",
"2dcontext/transformations/canvas_transformations_reset_001.htm",
"shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html"
],
"items": {}, "items": {},
"reftest_nodes": {} "reftest_nodes": {}
}, },
@ -34582,7 +34583,7 @@
} }
] ]
}, },
"rev": "58133dd71b16037669a0aa011b2afd448b52d434", "rev": "acd60f9e55532f03fc905e61591b7fd7db2f08d1",
"url_base": "/", "url_base": "/",
"version": 2 "version": 2
} }

View file

@ -9,3 +9,15 @@
[XMLHttpRequest: send() - charset parameter of Content-Type 6] [XMLHttpRequest: send() - charset parameter of Content-Type 6]
expected: FAIL expected: FAIL
[charset given but wrong, fix it (unknown MIME, bogus charset)]
expected: FAIL
[charset given but wrong, fix it (known MIME, bogus charset)]
expected: FAIL
[charset given but wrong, fix it (known MIME, actual charset)]
expected: FAIL
[If multiple charset parameters are given, all should be rewritten]
expected: FAIL

View file

@ -0,0 +1,9 @@
[Document.currentScript.html]
type: testharness
expected: TIMEOUT
[Script script-window-error]
expected: FAIL
[Script script-svg]
expected: NOTRUN

View file

@ -5,3 +5,4 @@
[document.forms iteration] [document.forms iteration]
expected: FAIL expected: FAIL

View file

@ -8978,3 +8978,4 @@
[HTMLOptionElement interface: new Option() must inherit property "index" with the proper type (7)] [HTMLOptionElement interface: new Option() must inherit property "index" with the proper type (7)]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,6 @@
[callback-exception.html]
type: testharness
expected: TIMEOUT
[requestAnimationFrame callback exceptions are reported to error handler]
expected: TIMEOUT

View file

@ -1 +1 @@
84c4a26e4d05015da4cbbf1f120b317a23bec0b4 a1cd27e6a3b961129fd4710513cc29e4f7c9cc67

View file

@ -924,3 +924,12 @@
[Parsing: <sc:\\../> against <about:blank>] [Parsing: <sc:\\../> against <about:blank>]
expected: FAIL expected: FAIL
[Parsing: <file:...> against <http://www.example.com/test>]
expected: FAIL
[Parsing: <file:..> against <http://www.example.com/test>]
expected: FAIL
[Parsing: <file:a> against <http://www.example.com/test>]
expected: FAIL

View file

@ -1,5 +1,6 @@
[url-constructor.html] [url-constructor.html]
type: testharness type: testharness
expected: CRASH
[Parsing: <http://f:999999/c> against <http://example.org/foo/bar>] [Parsing: <http://f:999999/c> against <http://example.org/foo/bar>]
expected: FAIL expected: FAIL

View file

@ -56,3 +56,4 @@
[CloseEvent interface: existence and properties of interface prototype object] [CloseEvent interface: existence and properties of interface prototype object]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,3 @@
[004.worker]
type: testharness
expected: TIMEOUT

View file

@ -166,7 +166,7 @@ The way to contribute is just as usual:
* Fork this repository (and make sure you're still relatively in sync * Fork this repository (and make sure you're still relatively in sync
with it if you forked a while ago). with it if you forked a while ago).
* Create a branch for your changes: * Create a branch for your changes:
`git checkout -b your-name/topic`. `git checkout -b topic`.
* Make your changes. * Make your changes.
* Run the lint script described below. * Run the lint script described below.
* Commit locally and push that to your repo. * Commit locally and push that to your repo.

View file

@ -10,7 +10,8 @@
<body> <body>
<div id="log"></div> <div id="log"></div>
<script> <script>
function request(input, output) { function request(input, output, title) {
title = title || document.title + ' - ' + input;
test(function() { test(function() {
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
client.open("POST", "resources/content.py", false) client.open("POST", "resources/content.py", false)
@ -19,39 +20,63 @@
client.send("TEST") client.send("TEST")
assert_equals(client.responseText, "TEST") assert_equals(client.responseText, "TEST")
assert_equals(client.getResponseHeader("x-request-content-type"), output) assert_equals(client.getResponseHeader("x-request-content-type"), output)
}) }, title)
} }
request(
"text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
"text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8"
)
request( request(
"text; charset=ascii", "text; charset=ascii",
"text; charset=ascii" "text; charset=ascii",
"header with invalid MIME type is not changed"
) )
request( request(
"charset=ascii", "charset=ascii",
"charset=ascii" "charset=ascii",
"known charset but bogus header - missing MIME type"
) )
request( request(
"text/x-thepiano;charset= waddup", "charset=bogus",
"text/x-thepiano;charset=UTF-8" "charset=bogus",
) "bogus charset and bogus header - missing MIME type"
request(
"text/x-pink-unicorn",
"text/x-pink-unicorn"
) )
request( request(
"text/plain;charset=utf-8", "text/plain;charset=utf-8",
"text/plain;charset=utf-8" "text/plain;charset=utf-8",
"Correct text/plain MIME with charset"
) )
request( request(
"text/x-pink-unicorn",
"text/x-pink-unicorn",
"If no charset= param is given, implementation should not add one - unknown MIME"
)
request(
"text/plain",
"text/plain",
"If no charset= param is given, implementation should not add one - known MIME"
)
request(
"text/x-thepiano;charset= waddup",
"text/x-thepiano;charset=UTF-8",
"charset given but wrong, fix it (unknown MIME, bogus charset)"
)
request( /**/
"text/plain;charset=utf-8;charset=waddup", "text/plain;charset=utf-8;charset=waddup",
"text/plain;charset=UTF-8;charset=UTF-8" "text/plain;charset=UTF-8;charset=UTF-8",
"charset given but wrong, fix it (known MIME, bogus charset)"
)
request(
"text/plain;charset=shift-jis",
"text/plain;charset=UTF-8",
"charset given but wrong, fix it (known MIME, actual charset)"
)
request(
"text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
"text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8",
"If multiple charset parameters are given, all should be rewritten"
) )
request( request(
null, null,
"text/plain;charset=UTF-8" "text/plain;charset=UTF-8",
"No content type set, give MIME and charset"
) )
</script> </script>
</body> </body>

View file

@ -129,7 +129,7 @@ var commandTests = {
indent: [], indent: [],
insertHorizontalRule: ["id"], insertHorizontalRule: ["id"],
insertHTML: ["<b>hi</b>"], insertHTML: ["<b>hi</b>"],
insertImage: ["http://example.com/some-image"], insertImage: ["../images/green.png"],
insertLineBreak: [], insertLineBreak: [],
insertOrderedList: [], insertOrderedList: [],
insertParagraph: [], insertParagraph: [],

View file

@ -7,39 +7,185 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<div id="log"></div> <div id="log"></div>
<script> <script>
var expected = [ var data = {
"parse-inline", "parse-inline" : [],
"parse-ext", "parse-ext" : [],
"dom-inline", "dom-inline" : [],
"dom-ext", "dom-ext" : [],
]; "nested" : ["nested-outer","nested-inner","nested-outer"],
var tests = {}; "script-exec" : ["script-exec-before-after","script-exec-before-after"],
expected.forEach(function(id) { "script-load-error" : [null],
tests[id] = async_test("Script " + id); "script-window-error" : ["script-error-compile","script-error-runtime"],
"timeout" : [null],
"eval" : [],
"xhr-test" : [],
"script-svg" : [],
"script-async" : [],
"script-defer" : []
};
var expected = {};
var actual = {};
Object.keys(data).forEach(function(id) {
var test_expected = data[id];
if(test_expected.length == 0) {
test_expected = [id];
}
expected[id] = test_expected;
actual[id] = [];
}); });
function verifyScript(id) {
var tests = {};
setup({allow_uncaught_exception : true});
Object.keys(expected).forEach(function(id) {
var testmsg = "Script " + id;
tests[id] = async_test(testmsg);
});
function verify(id) {
tests[id].step(function() { tests[id].step(function() {
assert_equals(document.currentScript, document.getElementById(id)); actual[id].push(document.currentScript);
this.done(); })
});
} }
function finish(id) {
tests[id].step(function() {
assert_array_equals(actual[id],expected[id].map(function(id) {
return document.getElementById(id);
}));
this.done();
})
}
</script> </script>
<!-- Test parser inserted scripts --> <!-- Test parser inserted scripts -->
<script id="parse-inline"> <script id="parse-inline">
verifyScript("parse-inline"); verify('parse-inline');
finish('parse-inline')
</script> </script>
<script id="parse-ext" src="data:text/plain,verifyScript('parse-ext');"></script> <script id="parse-ext" src="data:text/plain,verify('parse-ext')"></script>
<script>finish('parse-ext');</script>
<!-- Test DOM inserted scripts --> <!-- Test DOM inserted scripts -->
<script> <script>
var s = document.createElement("script"); var s = document.createElement("script");
s.textContent = "verifyScript('dom-inline');"; s.textContent = "verify('dom-inline');";
s.id = "dom-inline"; s.id = "dom-inline";
document.body.appendChild(s); document.body.appendChild(s);
finish('dom-inline');
s = document.createElement("script"); s = document.createElement("script");
s.src = "data:text/plain,verifyScript('dom-ext');"; s.src = "data:text/plain,verify('dom-ext');";
s.id = "dom-ext"; s.id = "dom-ext";
s.onload = function() {
finish('dom-ext');
}
document.body.appendChild(s); document.body.appendChild(s);
</script> </script>
<!-- Test Nested scripts -->
<script id="nested-outer">
verify("nested");
var s = document.createElement("script");
s.textContent = "verify('nested')";
s.id = "nested-inner";
document.body.appendChild(s);
verify("nested");
finish('nested');
</script>
<!-- Test beforescriptexecute and afterscriptexecute -->
<script id="script-exec-before-after">
function verifyScriptExec(e) {
verify('script-exec');
}
document.addEventListener('beforescriptexecute', verifyScriptExec, false);
document.addEventListener('afterscriptexecute', verifyScriptExec, false);
var s = document.createElement("script");
s.id = "script-exec-test";
s.textContent = "function nop() { return false }";
document.body.appendChild(s);
document.removeEventListener('beforescriptexecute', verifyScriptExec);
document.removeEventListener('afterscriptexecute', verifyScriptExec);
finish('script-exec');
</script>
<!-- Test script load error event listener -->
<script>
function testLoadFail() {
verify('script-load-error');
finish('script-load-error');
}
</script>
<script src="http://some.nonexistant.test/fail" id="script-load-error" onerror="testLoadFail()">
</script>
<!-- Test for runtime and compile time errors -->
<script>
window.onerror = function() {
verify('script-window-error');
}
var s = document.createElement("script");
s.id = "script-error-compile";
s.textContent = "{";
document.body.appendChild(s);
window.onerror = function() {
verify('script-window-error');
}
s = document.createElement("script");
s.id = "script-error-runtime";
s.textContent = "undefinedfn();";
document.body.appendChild(s);
finish('script-window-error');
</script>
<!-- Verify in setTimeout -->
<script>
setTimeout(function() {
verify('timeout');
finish('timeout');
},0);
</script>
<!-- Verify in eval -->
<script id="eval">
eval('verify("eval")');
finish("eval");
</script>
<!-- Verify in synchronous xhr -->
<script id="xhr-test">
var request = new XMLHttpRequest();
request.open('GET','/',false);
request.send(null);
if(request.status === 200) {
verify('xhr-test');
finish('xhr-test');
}
</script>
<!-- Testing script within svg -->
<svg>
<script id="script-svg">
verify('script-svg');
finish('script-svg');
</script>
</svg>
<!-- Test script async and defer -->
<script id='script-async' async src='data:text/plain,verify("script-async"),finish("script-async")'></script>
<script id='script-defer' defer src='data:text/plain,verify("script-defer"),finish("script-defer")'></script>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLElement#click</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function() {
var element = document.createElement("div");
var received = false;
element.addEventListener("click", this.step_func(function(e) {
received = true;
assert_false(e.isTrusted, "Event should not be trusted")
}));
element.click();
assert_true(received, "click event should have been dispatched synchronously");
})
</script>

View file

@ -25,6 +25,10 @@
var base = document.createElement("base"); var base = document.createElement("base");
base.setAttribute("href", "/foo/bar"); base.setAttribute("href", "/foo/bar");
document.head.appendChild(base); document.head.appendChild(base);
t1.add_cleanup(function () {
document.head.removeChild(base);
});
assert_resolve_url(document, location.href.replace(location.pathname, "/foo")); assert_resolve_url(document, location.href.replace(location.pathname, "/foo"));
assert_equals(document.baseURI, base.href, "The document base URL should be URL of the first base element that has an href attribute."); assert_equals(document.baseURI, base.href, "The document base URL should be URL of the first base element that has an href attribute.");
}); });
@ -55,10 +59,10 @@
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
iframe.onload = this.step_func_done(function () { iframe.onload = this.step_func_done(function () {
var doc = iframe.contentDocument; var doc = iframe.contentDocument;
var base = doc.body.appendChild(document.createElement("base")); var base = doc.body.appendChild(doc.createElement("base"));
base.href = "sub/"; base.href = "sub/";
assert_resolve_url(doc, location.href.replace("/document-base-url.html", "/sub")); assert_resolve_url(doc, location.href.replace("/document-base-url.html", "/sub"));
assert_equals(doc.baseURI, document.baseURI); assert_equals(doc.baseURI, document.baseURI.replace("/document-base-url.html", "/sub/"));
}); });
iframe.setAttribute("src", "about:blank"); iframe.setAttribute("src", "about:blank");
document.body.appendChild(iframe); document.body.appendChild(iframe);

View file

@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<title>requestAnimationFrame callback exception reported to error handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://w3c.github.io/web-performance/specs/RequestAnimationFrame/Overview.html#dom-windowanimationtiming-requestanimationframe"/>
</head>
<body>
<div id="log"></div>
<script>
var custom_exception = 'requestAnimationFrameException';
setup({allow_uncaught_exception : true});
async_test(function (t) {
addEventListener("error",function(e) {
t.step(function() {
assert_equals(e.error.message, custom_exception);
t.done();
})
});
window.requestAnimationFrame(function () {
throw new Error(custom_exception);
});
}, "requestAnimationFrame callback exceptions are reported to error handler");
</script>
</body>
</html>

View file

@ -15,12 +15,12 @@
var manifestFilenameB = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json"; var manifestFilenameB = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json";
var expectationsA = { var expectationsA = {
webm: "{ [0.000, 2.022) }", webm: "{ [0.000, 2.023) }",
mp4: "{ [0.000, 2.043) }", mp4: "{ [0.000, 2.043) }",
}; };
var expectationsB = { var expectationsB = {
webm: "{ [0.000, 2.000) }", webm: "{ [0.000, 2.001) }",
mp4: "{ [0.000, 2.000) }", mp4: "{ [0.000, 2.000) }",
}; };
@ -99,7 +99,7 @@
test.waitForExpectedEvents(function() test.waitForExpectedEvents(function()
{ {
var expectationsAV = { var expectationsAV = {
webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.022) }"], webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.023) }"],
mp4: ["{ [0.000, 2.000) }", "{ [0.000, 2.043) }"], mp4: ["{ [0.000, 2.000) }", "{ [0.000, 2.043) }"],
}; };

View file

@ -32,132 +32,69 @@ function assert_promise_rejects(promise, code, description) {
}); });
} }
// Asserts that two objects |actual| and |expected| are weakly equal under the // Helper for testing with Headers objects. Compares Headers instances
// following definition: // by serializing |expected| and |actual| to arrays and comparing.
// function assert_header_equals(actual, expected, description) {
// |a| and |b| are weakly equal if any of the following are true: assert_class_string(actual, "Headers", description);
// 1. If |a| is not an 'object', and |a| === |b|. var header, actual_headers = [], expected_headers = [];
// 2. If |a| is an 'object', and all of the following are true: for (header of actual)
// 2.1 |a.p| is weakly equal to |b.p| for all own properties |p| of |a|. actual_headers.push(header[0] + ": " + header[1]);
// 2.2 Every own property of |b| is an own property of |a|. for (header of expected)
// expected_headers.push(header[0] + ": " + header[1]);
// This is a replacement for the the version of assert_object_equals() in assert_array_equals(actual_headers, expected_headers,
// testharness.js. The latter doesn't handle own properties correctly. I.e. if description + " Headers differ.");
// |a.p| is not an own property, it still requires that |b.p| be an own }
// property.
//
// Note that |actual| must not contain cyclic references.
self.assert_object_equals = function(actual, expected, description) {
var object_stack = [];
function _is_equal(actual, expected, prefix) { // Helper for testing with Response objects. Compares simple
if (typeof actual !== 'object') { // attributes defined on the interfaces, as well as the headers. It
assert_equals(actual, expected, prefix); // does not compare the response bodies.
return; function assert_response_equals(actual, expected, description) {
} assert_class_string(actual, "Response", description);
assert_true(typeof expected === 'object', prefix); ["type", "url", "status", "ok", "statusText"].forEach(function(attribute) {
assert_equals(object_stack.indexOf(actual), -1, assert_equals(actual[attribute], expected[attribute],
prefix + ' must not contain cyclic references.'); description + " Attributes differ: " + attribute + ".");
object_stack.push(actual);
Object.getOwnPropertyNames(expected).forEach(function(property) {
assert_own_property(actual, property, prefix);
_is_equal(actual[property], expected[property],
prefix + '.' + property);
}); });
Object.getOwnPropertyNames(actual).forEach(function(property) { assert_header_equals(actual.headers, expected.headers, description);
assert_own_property(expected, property, prefix); }
// Assert that the two arrays |actual| and |expected| contain the same
// set of Responses as determined by assert_response_equals. The order
// is not significant.
//
// |expected| is assumed to not contain any duplicates.
function assert_response_array_equivalent(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
expected.forEach(function(expected_element) {
// assert_response_in_array treats the first argument as being
// 'actual', and the second as being 'expected array'. We are
// switching them around because we want to be resilient
// against the |actual| array containing duplicates.
assert_response_in_array(expected_element, actual, description);
}); });
}
object_stack.pop(); // Asserts that two arrays |actual| and |expected| contain the same
} // set of Responses as determined by assert_response_equals(). The
// corresponding elements must occupy corresponding indices in their
// respective arrays.
function assert_response_array_equals(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
actual.forEach(function(value, index) {
assert_response_equals(value, expected[index],
description + " : object[" + index + "]");
});
}
function _brand(object) { // Equivalent to assert_in_array, but uses assert_response_equals.
return Object.prototype.toString.call(object).match(/^\[object (.*)\]$/)[1]; function assert_response_in_array(actual, expected_array, description) {
}
_is_equal(actual, expected,
(description ? description + ': ' : '') + _brand(expected));
};
// Equivalent to assert_in_array, but uses a weaker equivalence relation
// (assert_object_equals) than '==='.
function assert_object_in_array(actual, expected_array, description) {
assert_true(expected_array.some(function(element) { assert_true(expected_array.some(function(element) {
try { try {
assert_object_equals(actual, element); assert_response_equals(actual, element);
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
} }
}), description); }), description);
} }
// Assert that the two arrays |actual| and |expected| contain the same set of
// elements as determined by assert_object_equals. The order is not significant.
//
// |expected| is assumed to not contain any duplicates as determined by
// assert_object_equals().
function assert_array_equivalent(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
expected.forEach(function(expected_element) {
// assert_in_array treats the first argument as being 'actual', and the
// second as being 'expected array'. We are switching them around because
// we want to be resilient against the |actual| array containing
// duplicates.
assert_object_in_array(expected_element, actual, description);
});
}
// Asserts that two arrays |actual| and |expected| contain the same set of
// elements as determined by assert_object_equals(). The corresponding elements
// must occupy corresponding indices in their respective arrays.
function assert_array_objects_equals(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
actual.forEach(function(value, index) {
assert_object_equals(value, expected[index],
description + ' : object[' + index + ']');
});
}
// Asserts that |object| that is an instance of some interface has the attribute
// |attribute_name| following the conditions specified by WebIDL, but it's
// acceptable that the attribute |attribute_name| is an own property of the
// object because we're in the middle of moving the attribute to a prototype
// chain. Once we complete the transition to prototype chains,
// assert_will_be_idl_attribute must be replaced with assert_idl_attribute
// defined in testharness.js.
//
// FIXME: Remove assert_will_be_idl_attribute once we complete the transition
// of moving the DOM attributes to prototype chains. (http://crbug.com/43394)
function assert_will_be_idl_attribute(object, attribute_name, description) {
assert_true(typeof object === "object", description);
assert_true("hasOwnProperty" in object, description);
// Do not test if |attribute_name| is not an own property because
// |attribute_name| is in the middle of the transition to a prototype
// chain. (http://crbug.com/43394)
assert_true(attribute_name in object, description);
}
// Stringifies a DOM object. This function stringifies not only own properties
// but also DOM attributes which are on a prototype chain. Note that
// JSON.stringify only stringifies own properties.
function stringifyDOMObject(object)
{
function deepCopy(src) {
if (typeof src != "object")
return src;
var dst = Array.isArray(src) ? [] : {};
for (var property in src) {
dst[property] = deepCopy(src[property]);
}
return dst;
}
return JSON.stringify(deepCopy(object));
}

View file

@ -109,7 +109,7 @@ var vary_entries = [
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('not-present-in-the-cache') return cache.matchAll('not-present-in-the-cache')
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, [], result, [],
'Cache.matchAll should resolve with an empty array on failure.'); 'Cache.matchAll should resolve with an empty array on failure.');
}); });
@ -126,7 +126,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request.url) return cache.matchAll(entries.a.request.url)
.then(function(result) { .then(function(result) {
assert_array_objects_equals(result, [entries.a.response], assert_response_array_equals(result, [entries.a.response],
'Cache.matchAll should match by URL.'); 'Cache.matchAll should match by URL.');
}); });
}, 'Cache.matchAll with URL'); }, 'Cache.matchAll with URL');
@ -134,7 +134,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request.url) return cache.match(entries.a.request.url)
.then(function(result) { .then(function(result) {
assert_object_equals(result, entries.a.response, assert_response_equals(result, entries.a.response,
'Cache.match should match by URL.'); 'Cache.match should match by URL.');
}); });
}, 'Cache.match with URL'); }, 'Cache.match with URL');
@ -142,7 +142,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request) return cache.matchAll(entries.a.request)
.then(function(result) { .then(function(result) {
assert_array_objects_equals( assert_response_array_equals(
result, [entries.a.response], result, [entries.a.response],
'Cache.matchAll should match by Request.'); 'Cache.matchAll should match by Request.');
}); });
@ -151,7 +151,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request) return cache.match(entries.a.request)
.then(function(result) { .then(function(result) {
assert_object_equals(result, entries.a.response, assert_response_equals(result, entries.a.response,
'Cache.match should match by Request.'); 'Cache.match should match by Request.');
}); });
}, 'Cache.match with Request'); }, 'Cache.match with Request');
@ -159,7 +159,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(new Request(entries.a.request.url)) return cache.matchAll(new Request(entries.a.request.url))
.then(function(result) { .then(function(result) {
assert_array_objects_equals( assert_response_array_equals(
result, [entries.a.response], result, [entries.a.response],
'Cache.matchAll should match by Request.'); 'Cache.matchAll should match by Request.');
}); });
@ -168,7 +168,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(new Request(entries.a.request.url)) return cache.match(new Request(entries.a.request.url))
.then(function(result) { .then(function(result) {
assert_object_equals(result, entries.a.response, assert_response_equals(result, entries.a.response,
'Cache.match should match by Request.'); 'Cache.match should match by Request.');
}); });
}, 'Cache.match with new Request'); }, 'Cache.match with new Request');
@ -177,7 +177,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request, return cache.matchAll(entries.a.request,
{ignoreSearch: true}) {ignoreSearch: true})
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
entries.a.response, entries.a.response,
@ -194,7 +194,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request, return cache.match(entries.a.request,
{ignoreSearch: true}) {ignoreSearch: true})
.then(function(result) { .then(function(result) {
assert_object_in_array( assert_response_in_array(
result, result,
[ [
entries.a.response, entries.a.response,
@ -211,7 +211,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a_with_query.request, return cache.matchAll(entries.a_with_query.request,
{ignoreSearch: true}) {ignoreSearch: true})
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
entries.a.response, entries.a.response,
@ -227,7 +227,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a_with_query.request, return cache.match(entries.a_with_query.request,
{ignoreSearch: true}) {ignoreSearch: true})
.then(function(result) { .then(function(result) {
assert_object_in_array( assert_response_in_array(
result, result,
[ [
entries.a.response, entries.a.response,
@ -242,7 +242,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.cat.request.url + '#mouse') return cache.matchAll(entries.cat.request.url + '#mouse')
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
entries.cat.response, entries.cat.response,
@ -254,7 +254,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.cat.request.url + '#mouse') return cache.match(entries.cat.request.url + '#mouse')
.then(function(result) { .then(function(result) {
assert_object_equals(result, entries.cat.response, assert_response_equals(result, entries.cat.response,
'Cache.match should ignore URL fragment.'); 'Cache.match should ignore URL fragment.');
}); });
}, 'Cache.match with URL containing fragment'); }, 'Cache.match with URL containing fragment');
@ -262,7 +262,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('http') return cache.matchAll('http')
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, [], result, [],
'Cache.matchAll should treat query as a URL and not ' + 'Cache.matchAll should treat query as a URL and not ' +
'just a string fragment.'); 'just a string fragment.');
@ -282,7 +282,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.secret_cat.request.url) return cache.matchAll(entries.secret_cat.request.url)
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, [entries.secret_cat.response], result, [entries.secret_cat.response],
'Cache.matchAll should not ignore embedded credentials'); 'Cache.matchAll should not ignore embedded credentials');
}); });
@ -291,7 +291,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) { prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.secret_cat.request.url) return cache.match(entries.secret_cat.request.url)
.then(function(result) { .then(function(result) {
assert_object_equals( assert_response_equals(
result, entries.secret_cat.response, result, entries.secret_cat.response,
'Cache.match should not ignore embedded credentials'); 'Cache.match should not ignore embedded credentials');
}); });
@ -300,7 +300,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(vary_entries, function(cache, entries) { prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c') return cache.matchAll('http://example.com/c')
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
entries.vary_cookie_absent.response entries.vary_cookie_absent.response
@ -316,7 +316,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
{headers: {'Cookies': 'none-of-the-above'}})); {headers: {'Cookies': 'none-of-the-above'}}));
}) })
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
], ],
@ -331,7 +331,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
{headers: {'Cookies': 'is-for-cookie'}})); {headers: {'Cookies': 'is-for-cookie'}}));
}) })
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[entries.vary_cookie_is_cookie.response], [entries.vary_cookie_is_cookie.response],
'Cache.matchAll should match the entire header if a vary header ' + 'Cache.matchAll should match the entire header if a vary header ' +
@ -342,7 +342,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
prepopulated_cache_test(vary_entries, function(cache, entries) { prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.match('http://example.com/c') return cache.match('http://example.com/c')
.then(function(result) { .then(function(result) {
assert_object_in_array( assert_response_in_array(
result, result,
[ [
entries.vary_cookie_absent.response entries.vary_cookie_absent.response
@ -355,7 +355,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c', return cache.matchAll('http://example.com/c',
{ignoreVary: true}) {ignoreVary: true})
.then(function(result) { .then(function(result) {
assert_array_equivalent( assert_response_array_equivalent(
result, result,
[ [
entries.vary_cookie_is_cookie.response, entries.vary_cookie_is_cookie.response,
@ -383,7 +383,7 @@ cache_test(function(cache) {
return cache.match(request.url); return cache.match(request.url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals( assert_response_equals(
result, response, result, response,
'Cache.match should return a Response object that has the same ' + 'Cache.match should return a Response object that has the same ' +
'properties as the stored response.'); 'properties as the stored response.');

View file

@ -30,7 +30,7 @@ cache_test(function(cache) {
return cache.match(test_url); return cache.match(test_url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, response, assert_response_equals(result, response,
'Cache.put should update the cache with ' + 'Cache.put should update the cache with ' +
'new request and response.'); 'new request and response.');
return result.text(); return result.text();
@ -75,7 +75,7 @@ cache_test(function(cache) {
return cache.match(test_url); return cache.match(test_url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, response, assert_response_equals(result, response,
'Cache.put should update the cache with ' + 'Cache.put should update the cache with ' +
'new Request and Response.'); 'new Request and Response.');
}); });
@ -118,7 +118,7 @@ cache_test(function(cache) {
return cache.match(test_url); return cache.match(test_url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, response, assert_response_equals(result, response,
'Cache.put should update the cache with ' + 'Cache.put should update the cache with ' +
'new request and response.'); 'new request and response.');
return result.text(); return result.text();
@ -142,7 +142,7 @@ cache_test(function(cache) {
return cache.match(test_url); return cache.match(test_url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, alternate_response, assert_response_equals(result, alternate_response,
'Cache.put should replace existing ' + 'Cache.put should replace existing ' +
'response with new response.'); 'response with new response.');
return result.text(); return result.text();
@ -168,7 +168,7 @@ cache_test(function(cache) {
return cache.match(test_url); return cache.match(test_url);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, alternate_response, assert_response_equals(result, alternate_response,
'Cache.put should replace existing ' + 'Cache.put should replace existing ' +
'response with new response.'); 'response with new response.');
return result.text(); return result.text();
@ -248,7 +248,7 @@ cache_test(function(cache) {
return cache.match(new URL('relative-url', location.href).href); return cache.match(new URL('relative-url', location.href).href);
}) })
.then(function(result) { .then(function(result) {
assert_object_equals(result, response, assert_response_equals(result, response,
'Cache.put should accept a relative URL ' + 'Cache.put should accept a relative URL ' +
'as the request.'); 'as the request.');
}); });

View file

@ -30,7 +30,7 @@ cache_test(function(cache) {
return self.caches.match(transaction.request); return self.caches.match(transaction.request);
}) })
.then(function(response) { .then(function(response) {
assert_object_equals(response, transaction.response, assert_response_equals(response, transaction.response,
'The response should not have changed.'); 'The response should not have changed.');
}); });
}, 'CacheStorageMatch with no cache name provided'); }, 'CacheStorageMatch with no cache name provided');
@ -49,7 +49,7 @@ cache_test(function(cache) {
return self.caches.match(transaction.request); return self.caches.match(transaction.request);
}) })
.then(function(response) { .then(function(response) {
assert_object_equals(response, transaction.response, assert_response_equals(response, transaction.response,
'The response should not have changed.'); 'The response should not have changed.');
}); });
}, 'CacheStorageMatch from one of many caches'); }, 'CacheStorageMatch from one of many caches');
@ -70,7 +70,7 @@ promise_test(function(test) {
return self.caches.match(transaction.request, {cacheName: 'x'}); return self.caches.match(transaction.request, {cacheName: 'x'});
}) })
.then(function(response) { .then(function(response) {
assert_object_equals(response, transaction.response, assert_response_equals(response, transaction.response,
'The response should not have changed.'); 'The response should not have changed.');
}) })
.then(function() { .then(function() {
@ -89,7 +89,7 @@ cache_test(function(cache) {
return self.caches.match(transaction.request); return self.caches.match(transaction.request);
}) })
.then(function(response) { .then(function(response) {
assert_object_equals(response, transaction.response, assert_response_equals(response, transaction.response,
'The response should not have changed.'); 'The response should not have changed.');
}); });
}, 'CacheStorageMatch a string request'); }, 'CacheStorageMatch a string request');

View file

@ -1,163 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_10_04_04</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#content-element">
<meta name="assert" content="The content HTML element: reset-style-inheritance attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
</head>
<body>
<div id="log"></div>
<script>
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.body.innerHTML =
'<ul id="shHost">' +
'<li id="li1" class="shadow">1</li>' +
'<li id="li2" class="shadow2">2</li>' +
'<li id="li3" class="shadow">3</li>' +
'<li id="li4">4</li>' +
'<li id="li5" class="shadow">5</li>' +
'<li id="li6" class="shadow2">6</li>' +
'</ul>';
var defHeight1 = d.querySelector('#li1').offsetHeight;
var defHeight2 = d.querySelector('#li2').offsetHeight;
var defHeight3 = d.querySelector('#li3').offsetHeight;
var defHeight4 = d.querySelector('#li4').offsetHeight;
var defHeight5 = d.querySelector('#li5').offsetHeight;
var defHeight6 = d.querySelector('#li6').offsetHeight;
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
var host = d.querySelector('#shHost');
d.body.setAttribute('style', 'font-size: 30px');
var height1 = d.querySelector('#li1').offsetHeight;
var height2 = d.querySelector('#li2').offsetHeight;
var height3 = d.querySelector('#li3').offsetHeight;
var height4 = d.querySelector('#li4').offsetHeight;
var height5 = d.querySelector('#li5').offsetHeight;
var height6 = d.querySelector('#li6').offsetHeight;
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
//Shadow root to play with
var s = host.createShadowRoot();
var div = d.createElement('div');
div.innerHTML ='<ul><content select=".shadow" reset-style-inheritance=true></content></ul>';
s.appendChild(div);
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
}), 'A_10_04_04_T01');
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.body.innerHTML =
'<ul id="shHost">' +
'<li id="li1" class="shadow">1</li>' +
'<li id="li2" class="shadow2">2</li>' +
'<li id="li3" class="shadow">3</li>' +
'<li id="li4">4</li>' +
'<li id="li5" class="shadow">5</li>' +
'<li id="li6" class="shadow2">6</li>' +
'</ul>';
var defHeight1 = d.querySelector('#li1').offsetHeight;
var defHeight2 = d.querySelector('#li2').offsetHeight;
var defHeight3 = d.querySelector('#li3').offsetHeight;
var defHeight4 = d.querySelector('#li4').offsetHeight;
var defHeight5 = d.querySelector('#li5').offsetHeight;
var defHeight6 = d.querySelector('#li6').offsetHeight;
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
var host = d.querySelector('#shHost');
d.body.setAttribute('style', 'font-size: 30px');
var height1 = d.querySelector('#li1').offsetHeight;
var height2 = d.querySelector('#li2').offsetHeight;
var height3 = d.querySelector('#li3').offsetHeight;
var height4 = d.querySelector('#li4').offsetHeight;
var height5 = d.querySelector('#li5').offsetHeight;
var height6 = d.querySelector('#li6').offsetHeight;
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
//Shadow root to play with
var s = host.createShadowRoot();
var div = d.createElement('div');
div.innerHTML ='<ul><content select=".shadow" reset-style-inheritance></content></ul>';
s.appendChild(div);
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
}), 'A_10_04_04_T02');
</script>
</body>
</html>

View file

@ -1,189 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_10_05_03</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-element">
<meta name="assert" content="The shadow HTML element: reset-style-inheritance attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
</head>
<body>
<div id="log"></div>
<script>
// test reset-style-inheritance=true
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.body.innerHTML =
'<ul id="shHost">' +
'<li id="li1" class="shadow">1</li>' +
'<li id="li2" class="shadow2">2</li>' +
'<li id="li3" class="shadow">3</li>' +
'<li id="li4">4</li>' +
'<li id="li5" class="shadow">5</li>' +
'<li id="li6" class="shadow2">6</li>' +
'</ul>';
var defHeight1 = d.querySelector('#li1').offsetHeight;
var defHeight2 = d.querySelector('#li2').offsetHeight;
var defHeight3 = d.querySelector('#li3').offsetHeight;
var defHeight4 = d.querySelector('#li4').offsetHeight;
var defHeight5 = d.querySelector('#li5').offsetHeight;
var defHeight6 = d.querySelector('#li6').offsetHeight;
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
var host = d.querySelector('#shHost');
d.body.setAttribute('style', 'font-size: 30px');
var height1 = d.querySelector('#li1').offsetHeight;
var height2 = d.querySelector('#li2').offsetHeight;
var height3 = d.querySelector('#li3').offsetHeight;
var height4 = d.querySelector('#li4').offsetHeight;
var height5 = d.querySelector('#li5').offsetHeight;
var height6 = d.querySelector('#li6').offsetHeight;
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
//Shadow root to play with
var s = host.createShadowRoot();
var div = d.createElement('div');
div.innerHTML ='<ul><content select=".shadow"></content></ul>';
s.appendChild(div);
assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
//Young tree
var s2 = host.createShadowRoot();
var div2 = d.createElement('div');
div2.innerHTML = '<shadow reset-style-inheritance=true></shadow>';
s2.appendChild(div2);
//styles should be reset
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
'element style should be reset');
}), 'A_10_05_03_T01');
//test reset-style-inheritance
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.body.innerHTML =
'<ul id="shHost">' +
'<li id="li1" class="shadow">1</li>' +
'<li id="li2" class="shadow2">2</li>' +
'<li id="li3" class="shadow">3</li>' +
'<li id="li4">4</li>' +
'<li id="li5" class="shadow">5</li>' +
'<li id="li6" class="shadow2">6</li>' +
'</ul>';
var defHeight1 = d.querySelector('#li1').offsetHeight;
var defHeight2 = d.querySelector('#li2').offsetHeight;
var defHeight3 = d.querySelector('#li3').offsetHeight;
var defHeight4 = d.querySelector('#li4').offsetHeight;
var defHeight5 = d.querySelector('#li5').offsetHeight;
var defHeight6 = d.querySelector('#li6').offsetHeight;
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
var host = d.querySelector('#shHost');
d.body.setAttribute('style', 'font-size: 30px');
var height1 = d.querySelector('#li1').offsetHeight;
var height2 = d.querySelector('#li2').offsetHeight;
var height3 = d.querySelector('#li3').offsetHeight;
var height4 = d.querySelector('#li4').offsetHeight;
var height5 = d.querySelector('#li5').offsetHeight;
var height6 = d.querySelector('#li6').offsetHeight;
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
//Shadow root to play with
var s = host.createShadowRoot();
var div = d.createElement('div');
div.innerHTML ='<ul><content select=".shadow"></content></ul>';
s.appendChild(div);
assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
//Young tree
var s2 = host.createShadowRoot();
var div2 = d.createElement('div');
div2.innerHTML = '<shadow reset-style-inheritance></shadow>';
s2.appendChild(div2);
//styles should be reset
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
'element style should be reset');
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
'element style should be reset');
}), 'A_10_05_03_T02');
</script>
</body>
</html>

View file

@ -101,13 +101,13 @@ A_05_05_01_T03.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #volume-slider relative target #volume-slider //For #volume-slider relative target #volume-shadow-host
roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click', roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
A_05_05_01_T03.step_func(function(event) { A_05_05_01_T03.step_func(function(event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong target'); 'Wrong target');
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider', assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider',
'Wrong currentTarget'); 'Wrong currentTarget');
}), false); }), false);
@ -135,13 +135,13 @@ A_05_05_01_T04.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #volume-slider-container relative target #volume-slider //For #volume-slider-container relative target #volume-shadow-host
roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click', roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
A_05_05_01_T04.step_func(function(event) { A_05_05_01_T04.step_func(function(event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong target'); 'Wrong target');
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider', assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider-container',
'Wrong currentTarget'); 'Wrong currentTarget');
}), false); }), false);
@ -168,13 +168,13 @@ A_05_05_01_T05.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #controls relative target #volume-slider //For #controls relative target #volume-shadow-host
roots.playerShadowRoot.querySelector('#controls').addEventListener('click', roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
A_05_05_01_T05.step_func(function(event) { A_05_05_01_T05.step_func(function(event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong target'); 'Wrong target');
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider', assert_equals(event.currentTarget.getAttribute('id'), 'controls',
'Wrong currentTarget'); 'Wrong currentTarget');
}), false); }), false);
@ -201,13 +201,13 @@ A_05_05_01_T06.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #player-shadow-root relative target #volume-slider //For #player-shadow-host relative target #player-shadow-host
roots.playerShadowRoot.addEventListener('click', d.querySelector('#player-shadow-host').addEventListener('click',
A_05_05_01_T06.step_func(function(event) { A_05_05_01_T06.step_func(function(event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
'Wrong target'); 'Wrong target');
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider', assert_equals(event.currentTarget.getAttribute('id'), 'player-shadow-host',
'Wrong currentTarget'); 'Wrong currentTarget');
}), false); }), false);
@ -235,13 +235,13 @@ A_05_05_01_T07.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #player relative target #player //For #player relative target #player-shadow-host
d.querySelector('#player').addEventListener('click', d.querySelector('#player').addEventListener('click',
A_05_05_01_T07.step_func(function(event) { A_05_05_01_T07.step_func(function(event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'player', assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
'Wrong target'); 'Wrong target');
assert_true(event.currentTarget.getAttribute('id'), 'player', assert_equals(event.currentTarget.getAttribute('id'), 'player',
'Wrong currentTarget'); 'Wrong currentTarget');
}), false); }), false);

View file

@ -60,11 +60,11 @@ A_05_01_04_T02.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #volume-shadow-root relative target is #volume-slider-thumb //For #volume-shadow-host relative target is #volume-shadow-host
roots.volumeShadowRoot.addEventListener('click', roots.playerShadowRoot.querySelector('#volume-shadow-host').addEventListener('click',
A_05_01_04_T02.step_func(function (event) { A_05_01_04_T02.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider-thumb', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -90,11 +90,11 @@ A_05_01_04_T03.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #volume-slider relative target is #volume-slider //For #volume-slider relative target is #volume-shadow-host
roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click', roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
A_05_01_04_T03.step_func(function (event) { A_05_01_04_T03.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -118,11 +118,11 @@ A_05_01_04_T04.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #volume-slider-container relative target is #volume-slider //For #volume-slider-container relative target is #volume-shadow-host
roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click', roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
A_05_01_04_T04.step_func(function (event) { A_05_01_04_T04.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -146,11 +146,11 @@ A_05_01_04_T05.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #controls relative target is #volume-slider //For #controls relative target is #volume-shadow-host
roots.playerShadowRoot.querySelector('#controls').addEventListener('click', roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
A_05_01_04_T05.step_func(function (event) { A_05_01_04_T05.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -174,11 +174,11 @@ A_05_01_04_T06.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #player-shadow-root relative target is #volume-slider //For #player-shadow-host relative target is #player-shadow-host
roots.playerShadowRoot.addEventListener('click', roots.playerShadowRoot.addEventListener('click',
A_05_01_04_T06.step_func(function (event) { A_05_01_04_T06.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'volume-slider', assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -203,11 +203,11 @@ A_05_01_04_T07.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #player relative target is #player //For #player relative target is #player-shadow-host
d.querySelector('#player').addEventListener('click', d.querySelector('#player').addEventListener('click',
A_05_01_04_T07.step_func(function (event) { A_05_01_04_T07.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'player', assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);
@ -344,11 +344,11 @@ A_05_01_04_T12.step(unit(function (ctx) {
//expected result of what relative target should be see //expected result of what relative target should be see
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
//For #player relative target is #player //For #player relative target is #player-shadow-host
d.querySelector('#player').addEventListener('click', d.querySelector('#player').addEventListener('click',
A_05_01_04_T12.step_func(function (event) { A_05_01_04_T12.step_func(function (event) {
invoked = true; invoked = true;
assert_equals(event.target.getAttribute('id'), 'player', assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
'Wrong related target'); 'Wrong related target');
}), false); }), false);

View file

@ -228,30 +228,30 @@ function createTestMediaPlayer(d) {
d.body.innerHTML = '' + d.body.innerHTML = '' +
'<div id="player">' + '<div id="player">' +
'<input type="checkbox" id="outside-control">' + '<input type="checkbox" id="outside-control">' +
'<div id="player-shadow-root">' + '<div id="player-shadow-host">' +
'</div>' + '</div>' +
'</div>'; '</div>';
var playerShadowRoot = d.querySelector('#player-shadow-root').createShadowRoot(); var playerShadowRoot = d.querySelector('#player-shadow-host').createShadowRoot();
playerShadowRoot.innerHTML = '' + playerShadowRoot.innerHTML = '' +
'<div id="controls">' + '<div id="controls">' +
'<button class="play-button">PLAY</button>' + '<button class="play-button">PLAY</button>' +
'<input type="range" id="timeline">' + '<div tabindex="0" id="timeline">' +
'<div id="timeline-shadow-root">' + '<div id="timeline-shadow-host">' +
'</div>' +
'</div>' + '</div>' +
'</input>' +
'<div class="volume-slider-container" id="volume-slider-container">' + '<div class="volume-slider-container" id="volume-slider-container">' +
'<input type="range" class="volume-slider" id="volume-slider">' + '<div tabindex="0" class="volume-slider" id="volume-slider">' +
'<div id="volume-shadow-root">' + '<div id="volume-shadow-host">' +
'</div>' +
'</div>' + '</div>' +
'</input>' +
'</div>' + '</div>' +
'</div>'; '</div>';
var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-root').createShadowRoot(); var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-host').createShadowRoot();
timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-slider-thumb"></div>'; timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-slider-thumb"></div>';
var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-root').createShadowRoot(); var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-host').createShadowRoot();
volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slider-thumb"></div>'; volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slider-thumb"></div>';
return { return {

View file

@ -115,6 +115,11 @@ class Webidl2Regexp(Regexp):
pattern = "webidl2\.js" pattern = "webidl2\.js"
error = "WEBIDL2.JS" error = "WEBIDL2.JS"
class ConsoleRegexp(Regexp):
pattern = "console\.[a-zA-Z]+\s*\("
error = "CONSOLE"
file_extensions = [".html", ".htm", ".js", ".xht", ".html", ".svg"]
class PrintRegexp(Regexp): class PrintRegexp(Regexp):
pattern = "print(?:\s|\s*\()" pattern = "print(?:\s|\s*\()"
error = "PRINT STATEMENT" error = "PRINT STATEMENT"
@ -126,6 +131,7 @@ regexps = [item() for item in
CRRegexp, CRRegexp,
W3CTestOrgRegexp, W3CTestOrgRegexp,
Webidl2Regexp, Webidl2Regexp,
ConsoleRegexp,
PrintRegexp]] PrintRegexp]]
def check_regexp_line(path, f): def check_regexp_line(path, f):

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -233,6 +233,11 @@ class WebTestRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.logger.debug("%s %s" % (request.method, request.request_path)) self.logger.debug("%s %s" % (request.method, request.request_path))
handler = self.server.router.get_handler(request) handler = self.server.router.get_handler(request)
# If the handler we used for the request had a non-default base path
# set update the doc_root of the request to reflect this
if hasattr(handler, "base_path") and handler.base_path:
request.doc_root = handler.base_path
if self.server.latency is not None: if self.server.latency is not None:
if callable(self.server.latency): if callable(self.server.latency):
latency = self.server.latency() latency = self.server.latency()

View file

@ -12,7 +12,7 @@ var args = [
/* numbers */ /* numbers */
[NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], [NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0],
[-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], [-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2],
[1, 1], [-0xF1000000, 0xF000000], [1, 1], [-0xF1000000, 0],
/* strings */ /* strings */
["1", 1], ["1e2", 100], ["1", 1], ["1e2", 100],
/* null, undefined, booleans */ /* null, undefined, booleans */

View file

@ -12,7 +12,7 @@ var args = [
/* numbers */ /* numbers */
[NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], // Step 2 [NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], // Step 2
[-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], // Step 3 [-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], // Step 3
[1, 1], [-0xF1000000, 0xF000000], // Step 4 [1, 1], [-0xF1000000, 0], // Step 4
/* strings */ /* strings */
["1", 1], ["1e2", 100], ["1", 1], ["1e2", 100],
/* null, undefined, booleans */ /* null, undefined, booleans */

View file

@ -258,6 +258,9 @@ test.txt s:http h:www.example.com p:/test.txt
\u4E2D/test.txt s:http h:www.example.com p:/%E4%B8%AD/test.txt \u4E2D/test.txt s:http h:www.example.com p:/%E4%B8%AD/test.txt
http://www.example2.com s:http h:www.example2.com p:/ http://www.example2.com s:http h:www.example2.com p:/
//www.example2.com s:http h:www.example2.com p:/ //www.example2.com s:http h:www.example2.com p:/
file:... s:file h: p:/...
file:.. s:file h: p:/
file:a s:file h: p:/a
# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>Test currentTime at completion of OfflineAudioContext rendering</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function() {
// sampleRate is a power of two so that time can be represented exactly
// in double currentTime.
var context = new OfflineAudioContext(1, 1, 65536);
return context.startRendering().
then(function(buffer) {
assert_equals(buffer.length, 1, "buffer length");
assert_equals(context.currentTime, 128 / context.sampleRate,
"currentTime at completion");
});
});
</script>

View file

@ -0,0 +1,5 @@
importScripts("/resources/testharness.js");
test(function() {
assert_equals("ÿ", "\ufffd");
}, "Decoding invalid utf-8");
done();