Skip to content

Commit 74f5ef3

Browse files
Add timeout for layoutCallback in amp-video test to fix flakes (#40371)
1 parent aa493ca commit 74f5ef3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

extensions/amp-video/0.1/test/test-amp-video.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ describes.realWin(
6666
opt_beforeLayoutCallback(v, impl);
6767
}
6868
try {
69-
await v.layoutCallback();
69+
await Promise.race([
70+
v.layoutCallback(),
71+
// Caps the layoutCallback in test to 500ms to avoid tests timing out due to prolonged layouts.
72+
Services.timerFor(win).promise(500),
73+
]);
7074
return v;
7175
} catch (e) {
7276
// Ignore failed to load errors since sources are fake.

0 commit comments

Comments
 (0)