Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: sky/tests/framework/flights-app.sky

Issue 817853006: Deflake flights-app.sky. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/tests/framework/flights-app-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/framework/flights-app.sky
diff --git a/sky/tests/framework/flights-app.sky b/sky/tests/framework/flights-app.sky
index e42ff36e275ee78bdd0f8258969f5dafdb00ba9e..826ab772913446f09b7f44ac997e46a8d0f111c6 100644
--- a/sky/tests/framework/flights-app.sky
+++ b/sky/tests/framework/flights-app.sky
@@ -1,10 +1,32 @@
<sky>
+ <import src="../resources/run-after-display.sky" as="runAfterDisplay" />
<import src="/sky/examples/flights-app/flights-app.sky" />
<script>
+ var app;
+
+ function imagesLoaded() {
+ var images = app.shadowRoot.querySelectorAll('img');
+ for (var i = 0; i < images.length; i++) {
+ if (!images[i].complete)
+ return false;
+ }
+ return true;
+ }
+
+ function checkImagesLoaded() {
+ if (!imagesLoaded()) {
+ setTimeout(checkImagesLoaded, 10);
+ return;
+ }
+ runAfterDisplay(function() {
+ internals.notifyTestComplete(internals.renderTreeAsText());
+ });
+ }
+
addEventListener("load", function() {
- var app = document.createElement("flights-app");
+ app = document.createElement("flights-app");
document.querySelector("sky").appendChild(app);
- internals.notifyTestComplete(internals.renderTreeAsText());
+ checkImagesLoaded();
});
</script>
</sky>
« no previous file with comments | « no previous file | sky/tests/framework/flights-app-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698