Bug 1411806 - Move document timeline tests to files corresponding to the sections in the spec they test; r=hiro

I replaced a couple instances of 'var' with 'const' or 'let' but otherwise the
test content is untouched. I will update a few test descriptions in the next
patch.

MozReview-Commit-ID: ASVp54dzQUL

--HG--
extra : rebase_source : d802756159aba9a73f8627b79294950d6e6d79ed
This commit is contained in:
Brian Birtles 2017-10-27 13:37:08 +09:00
parent d9edba8f9a
commit 0ad3fe126d
4 changed files with 97 additions and 53 deletions

View File

@ -354434,12 +354434,6 @@
{}
]
],
"web-animations/interfaces/AnimationTimeline/document-timeline.html": [
[
"/web-animations/interfaces/AnimationTimeline/document-timeline.html",
{}
]
],
"web-animations/interfaces/AnimationTimeline/idlharness.html": [
[
"/web-animations/interfaces/AnimationTimeline/idlharness.html",
@ -354452,6 +354446,12 @@
{}
]
],
"web-animations/interfaces/Document/timeline.html": [
[
"/web-animations/interfaces/Document/timeline.html",
{}
]
],
"web-animations/interfaces/DocumentTimeline/constructor.html": [
[
"/web-animations/interfaces/DocumentTimeline/constructor.html",
@ -354614,6 +354614,18 @@
{}
]
],
"web-animations/timing-model/timelines/document-timelines.html": [
[
"/web-animations/timing-model/timelines/document-timelines.html",
{}
]
],
"web-animations/timing-model/timelines/timelines.html": [
[
"/web-animations/timing-model/timelines/timelines.html",
{}
]
],
"web-nfc/idlharness.https.html": [
[
"/web-nfc/idlharness.https.html",
@ -585417,10 +585429,6 @@
"9a6eae75862dec36b7839dc68edc31891a651284",
"testharness"
],
"web-animations/interfaces/AnimationTimeline/document-timeline.html": [
"2df691f77422d0e64833addf0c099e44f9afe051",
"testharness"
],
"web-animations/interfaces/AnimationTimeline/idlharness.html": [
"80984bce09d54d4c57c4cea3a218b01467e43f9c",
"testharness"
@ -585429,6 +585437,10 @@
"bd39d7f28dd03ba22a32ce09226dc263180254eb",
"testharness"
],
"web-animations/interfaces/Document/timeline.html": [
"dda4f7a2cd4ea428e2df0e28b9a8ef4155635f9f",
"testharness"
],
"web-animations/interfaces/DocumentTimeline/constructor.html": [
"3a626b145f4eb77e816b9020f6fc67630088a00b",
"testharness"
@ -585561,6 +585573,14 @@
"66e2277c77e4bd7b2d8981a725fb5083a8f5e0f6",
"testharness"
],
"web-animations/timing-model/timelines/document-timelines.html": [
"6f1fc4885b4e2fba33c88dac56198221cb2d8e13",
"testharness"
],
"web-animations/timing-model/timelines/timelines.html": [
"d78fdc479bbe5a9c51724f62c58f06b52d4afa58",
"testharness"
],
"web-nfc/OWNERS": [
"d42f3f15d00686bf5a5c7c69169ef5cf2554bd7b",
"support"

View File

@ -0,0 +1,23 @@
<!doctype html>
<meta charset=utf-8>
<title>Document.timeline</title>
<link rel="help" href="https://w3c.github.io/web-animations/#dom-document-timeline">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<iframe width="10" height="10" id="iframe"></iframe>
<script>
'use strict';
test(function() {
assert_equals(document.timeline, document.timeline,
'document.timeline returns the same object every time');
const iframe = document.getElementById('iframe');
assert_not_equals(document.timeline, iframe.contentDocument.timeline,
'document.timeline returns a different object for each document');
assert_not_equals(iframe.contentDocument.timeline, null,
'document.timeline on an iframe is not null');
}, 'document.timeline identity tests');
</script>

View File

@ -0,0 +1,38 @@
<!doctype html>
<meta charset=utf-8>
<title>Document timelines</title>
<link rel="help" href="https://w3c.github.io/web-animations/#document-timelines">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
async_test(function(t) {
assert_true(document.timeline.currentTime > 0,
'document.timeline.currentTime is positive');
// document.timeline.currentTime should be set even before document
// load fires. We expect this code to be run before document load and hence
// the above assertion is sufficient.
// If the following assertion fails, this test needs to be redesigned.
assert_true(document.readyState !== 'complete',
'Test is running prior to document load');
// Test that the document timeline's current time is measured from
// navigationStart.
//
// We can't just compare document.timeline.currentTime to
// window.performance.now() because currentTime is only updated on a sample
// so we use requestAnimationFrame instead.
window.requestAnimationFrame(function(rafTime) {
t.step(function() {
assert_equals(document.timeline.currentTime, rafTime,
'document.timeline.currentTime matches' +
' requestAnimationFrame time');
});
t.done();
});
}, 'document.timeline.currentTime value tests');
</script>

View File

@ -1,54 +1,17 @@
<!doctype html>
<meta charset=utf-8>
<title>Default document timeline tests</title>
<link rel="help" href="https://w3c.github.io/web-animations/#the-documents-default-timeline">
<title>Timelines</title>
<link rel="help" href="https://w3c.github.io/web-animations/#timelines">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<iframe width="10" height="10" id="iframe"></iframe>
<script>
'use strict';
test(function() {
assert_equals(document.timeline, document.timeline,
'document.timeline returns the same object every time');
var iframe = document.getElementById('iframe');
assert_not_equals(document.timeline, iframe.contentDocument.timeline,
'document.timeline returns a different object for each document');
assert_not_equals(iframe.contentDocument.timeline, null,
'document.timeline on an iframe is not null');
}, 'document.timeline identity tests');
async_test(function(t) {
assert_true(document.timeline.currentTime > 0,
'document.timeline.currentTime is positive');
// document.timeline.currentTime should be set even before document
// load fires. We expect this code to be run before document load and hence
// the above assertion is sufficient.
// If the following assertion fails, this test needs to be redesigned.
assert_true(document.readyState !== 'complete',
'Test is running prior to document load');
// Test that the document timeline's current time is measured from
// navigationStart.
//
// We can't just compare document.timeline.currentTime to
// window.performance.now() because currentTime is only updated on a sample
// so we use requestAnimationFrame instead.
window.requestAnimationFrame(function(rafTime) {
t.step(function() {
assert_equals(document.timeline.currentTime, rafTime,
'document.timeline.currentTime matches' +
' requestAnimationFrame time');
});
t.done();
});
}, 'document.timeline.currentTime value tests');
promise_test(function(t) {
var valueAtStart = document.timeline.currentTime;
var timeAtStart = window.performance.now();
const valueAtStart = document.timeline.currentTime;
const timeAtStart = window.performance.now();
while (window.performance.now() - timeAtStart < 50) {
// Wait 50ms
}
@ -87,8 +50,8 @@ async_test(function(t) {
}, 'iframe document.timeline.currentTime liveness tests');
async_test(function(t) {
var startTime = document.timeline.currentTime;
var firstRafTime;
const startTime = document.timeline.currentTime;
let firstRafTime;
requestAnimationFrame(function() {
t.step(function() {