LayoutMediaNGContainer: Update rotated-video-has-right-panel-width.html

Ensure we start testing after all videos are loaded and <video>
sizes are finalized.

This CL does not affect production.

Bug: 1353190
Change-Id: I4ff48414c7259ba952c7af3f7721a7c70d83c753
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4015407
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1068965}
diff --git a/third_party/blink/web_tests/media/controls/rotated-video-has-right-panel-width.html b/third_party/blink/web_tests/media/controls/rotated-video-has-right-panel-width.html
index 555ed548..6f7da23 100644
--- a/third_party/blink/web_tests/media/controls/rotated-video-has-right-panel-width.html
+++ b/third_party/blink/web_tests/media/controls/rotated-video-has-right-panel-width.html
@@ -24,7 +24,7 @@
   <video controls width=1200 style="transform:rotate(30deg)"></video>
 </body>
 <script>
-test(_ => {
+promise_test(async _ => {
   const expectedWidth = [
     "400px", // Smaller than viewport so fully visible.
     "800px", // Larger than viewport and horizontal so width=viewport_width.
@@ -37,8 +37,7 @@
   for (var i=0; i < videos.length; ++i) {
     videos[i].src = 'content/test.ogv';
   }
-
-  var forceLayout = document.body.offsetHeight;
+  await new Promise(resolve => {window.onload = resolve;});
 
   for (var i=0; i < videos.length; ++i) {
     var controls = mediaControlsButton(videos[i], 'panel');