Commit f0f67bad authored by David Grogan's avatar David Grogan Committed by Commit Bot

[css-flexbox] Fix possible flakiness in two wpt tests

These tests used script-after-body but also an external stylesheet.
script-after-body can be run before the stylesheet has loaded. The
script-after-body stuff is now in an onload handler.

Bug: 1063749
Change-Id: Id725c51ef2375ba9584cfacfa81e328b2b586ebd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133271Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Commit-Queue: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756106}
parent 34390353
...@@ -8,6 +8,15 @@ ...@@ -8,6 +8,15 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script> <script src="/resources/check-layout-th.js"></script>
<script>
function change() {
document.body.offsetTop;
var flex = document.getElementById("flex");
flex.style.width = "100px";
checkLayout("#container");
}
</script>
<body onload="change()">
<p>There should be a green square below. No red.</p> <p>There should be a green square below. No red.</p>
<!-- #container is just here to make sure the test fails more reliably visually if the bug is present. --> <!-- #container is just here to make sure the test fails more reliably visually if the bug is present. -->
<div id="container" style="width:500px;"> <div id="container" style="width:500px;">
...@@ -18,9 +27,4 @@ ...@@ -18,9 +27,4 @@
</div> </div>
</div> </div>
</div> </div>
<script> </body>
document.body.offsetTop;
var flex = document.getElementById("flex");
flex.style.width = "100px";
checkLayout("#container");
</script>
...@@ -20,21 +20,23 @@ ...@@ -20,21 +20,23 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script> <script src="/resources/check-layout-th.js"></script>
<script>
function change() {
var container = document.getElementById('container');
container.offsetWidth;
container.style.width = "200px";
checkLayout("#container");
}
</script>
</head> </head>
<body> <body onload="change()">
<div id=log></div> <div id=log></div>
<div id="container" style="width: 100px" data-expected-width="200"> <div id="container" style="width: 100px" data-expected-width="200">
<div class="flexbox column" data-expected-width="200"> <div class="flexbox column" data-expected-width="200">
<div class="flexitem" data-expected-width="200"> <div class="flexitem" data-expected-width="200">
<div class="child" data-expected-width="200">This div should be 200px wide.</div> <div class="child" data-expected-width="200">This div should be 200px wide.</div>
</div> </div>
</div>
</div> </div>
</div>
<script>
var container = document.getElementById('container');
container.offsetWidth;
container.style.width = "200px";
checkLayout("#container");
</script>
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment