Skip to content

Commit

Permalink
Make script scheduling tests not depend on clock synchronisation betw…
Browse files Browse the repository at this point in the history
…een client and server
  • Loading branch information
jgraham committed Sep 9, 2015
1 parent 2d62e74 commit 1948232
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 36 deletions.
27 changes: 10 additions & 17 deletions old-tests/submission/Opera/script_scheduling/106.html
@@ -1,27 +1,20 @@
<!DOCTYPE html>
<html><head>
<title> scheduler: stylesheets blocking scripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
<title> scheduler: stylesheets blocking scripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
<!-- this stylesheet blocks scripts -->
<link rel="stylesheet" href="css/import.css?pipe=trickle(d2)">
</head>
<body>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<div id="test">Test</div>

<script>
var t = async_test();
var t0 = Date.now();
</script>

<!-- this stylesheet blocks scripts -->
<link rel="stylesheet" href="css/import.css?pipe=trickle(d2)">

<script>
t.step(function() {
var t1 = Date.now();
assert_true(t1 - t0 > 1000, "Delayed by " + (t1-t0) + "ms expected > 1000ms");
t.done();
test(function() {
assert_equals(getComputedStyle(document.getElementById("test")).position,
"fixed");
});
</script>
</body></html>
22 changes: 8 additions & 14 deletions old-tests/submission/Opera/script_scheduling/107.html
@@ -1,27 +1,21 @@
<!DOCTYPE html>
<html><head>
<title> scheduler: stylesheets blocking scripts document.write</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
<title> scheduler: stylesheets blocking scripts document.write</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
</head>
<body>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<div id="test">Test</div>

<script>
var t = async_test();
var t0 = Date.now();
</script>

<!-- this stylesheet blocks scripts -->
<script>
t.step(function() {
test(function() {
document.write("<link rel='stylesheet' href='css/import.css?pipe=trickle(d2)'>");
var t1 = Date.now();
<!-- note that the pass condition here is not per spec (but does match implementations) as of 2012-06-26 -->
assert_true(t1-t0 < 1000, "Stylesheet blocked scripts, delayed by " + (t1-t0) + "ms expected < 1000ms");
t.done();
assert_equals(getComputedStyle(document.getElementById("test")).position,
"static");
});
</script>
</body></html>
2 changes: 1 addition & 1 deletion old-tests/submission/Opera/script_scheduling/111.html
Expand Up @@ -10,7 +10,7 @@
<div id="test"></div>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>

<script id="async-script" async src="scripts/include-2.js?pipe=trickle(d2)"></script>
<script id="async-script" async src="scripts/include-2.js?pipe=trickle(d3)"></script>

<script>
var t = async_test();
Expand Down
@@ -1,3 +1 @@
#test {background-image:url("1x1-green.png?pipe=trickle(d2)");
background-repeat:repeat;
background-color:orange;}
#test {position:fixed}
@@ -1 +1 @@
@import("background.css")
@import url("background.css")

0 comments on commit 1948232

Please sign in to comment.