Title: [259850] trunk
Revision
259850
Author
peng.l...@apple.com
Date
2020-04-09 23:55:13 -0700 (Thu, 09 Apr 2020)

Log Message

REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=210134

Reviewed by Eric Carlson.

Source/WebCore:

Call captionPreferencesChanged() directly in CaptionUserPreferences::setCaptionsStyleSheetOverride().

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):

LayoutTests:

Make the test reliable by replacing the timer and testExpected based approach
with the approach based on testExpectedEventually. Also remove unnecessary code.

* media/track/track-css-user-override.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259849 => 259850)


--- trunk/LayoutTests/ChangeLog	2020-04-10 06:48:09 UTC (rev 259849)
+++ trunk/LayoutTests/ChangeLog	2020-04-10 06:55:13 UTC (rev 259850)
@@ -1,3 +1,15 @@
+2020-04-09  Peng Liu  <peng.l...@apple.com>
+
+        REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=210134
+
+        Reviewed by Eric Carlson.
+
+        Make the test reliable by replacing the timer and testExpected based approach
+        with the approach based on testExpectedEventually. Also remove unnecessary code.
+
+        * media/track/track-css-user-override.html:
+
 2020-04-09  Cathie Chen  <cathiec...@igalia.com>
 
         Import test for programmatic scrolling scrollend event

Modified: trunk/LayoutTests/media/track/track-css-user-override.html (259849 => 259850)


--- trunk/LayoutTests/media/track/track-css-user-override.html	2020-04-10 06:48:09 UTC (rev 259849)
+++ trunk/LayoutTests/media/track/track-css-user-override.html	2020-04-10 06:55:13 UTC (rev 259850)
@@ -10,7 +10,7 @@
         <script>
             var seekCount = 0;
 
-            function seeked()
+            async function seeked()
             {
                 var currentCue = textTrackDisplayElement(video, 'cue');
 
@@ -23,34 +23,29 @@
                 document.head.appendChild(styleElement);
                 stylesheet = styleElement.sheet;
                 run("stylesheet.insertRule('video::cue { color: purple; background-color: lime; }', 0)");
-                document.body.offsetTop;
                 testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
                 testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(0, 255, 0)");
 
                 consoleWrite("<br>** Add an override, without '!important' **");
-                document.body.offsetTop;
                 run("internals.setCaptionsStyleSheetOverride('video::cue { color: blue; background-color: yellow; }')");
                 consoleWrite("internals.captionsStyleSheetOverride = " + internals.captionsStyleSheetOverride());
-                document.body.offsetTop;
                 testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
                 testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(0, 255, 0)");
 
                 consoleWrite("<br>** Mark background-color '!important' **");
                 run("internals.setCaptionsStyleSheetOverride('video::cue { color: blue ; background-color: yellow !important; }')");
-                // The style is not immediately updated, schedule the rest of the test with a zero timeout timer.
-                setTimeout(function() {
-                    testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
-                    testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
+                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
+                // The style is not immediately updated.
+                await testExpectedEventually("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
 
-                    consoleWrite("<br>** Mark color '!important' **");
-                    run("stylesheet.insertRule('video::cue { color: blue !important; background-color: yellow  !important; }', 0)");
-                    document.body.offsetTop;
-                    testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(0, 0, 255)");
-                    testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
+                consoleWrite("<br>** Mark color '!important' **");
+                run("stylesheet.insertRule('video::cue { color: blue !important; background-color: yellow  !important; }', 0)");
+                // The style is not immediately updated.
+                await testExpectedEventually("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(0, 0, 255)");
+                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
 
-                    consoleWrite("");
-                    endTest();
-                }, 100);
+                consoleWrite("");
+                endTest();
             }
 
             function loaded()
@@ -64,7 +59,7 @@
                 waitForEvent('canplaythrough', function() { video.currentTime = .5; });
             }
 
-        setCaptionDisplayMode('Automatic');
+            setCaptionDisplayMode('Automatic');
         </script>
     </head>
     <body _onload_="loaded()">

Modified: trunk/Source/WebCore/ChangeLog (259849 => 259850)


--- trunk/Source/WebCore/ChangeLog	2020-04-10 06:48:09 UTC (rev 259849)
+++ trunk/Source/WebCore/ChangeLog	2020-04-10 06:55:13 UTC (rev 259850)
@@ -1,3 +1,15 @@
+2020-04-09  Peng Liu  <peng.l...@apple.com>
+
+        REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=210134
+
+        Reviewed by Eric Carlson.
+
+        Call captionPreferencesChanged() directly in CaptionUserPreferences::setCaptionsStyleSheetOverride().
+
+        * page/CaptionUserPreferences.cpp:
+        (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):
+
 2020-04-09  Cathie Chen  <cathiec...@igalia.com>
 
         Fix up code style for scroll animation

Modified: trunk/Source/WebCore/page/CaptionUserPreferences.cpp (259849 => 259850)


--- trunk/Source/WebCore/page/CaptionUserPreferences.cpp	2020-04-10 06:48:09 UTC (rev 259849)
+++ trunk/Source/WebCore/page/CaptionUserPreferences.cpp	2020-04-10 06:55:13 UTC (rev 259850)
@@ -398,8 +398,7 @@
 
     m_captionsStyleSheetOverride = override;
     updateCaptionStyleSheetOverride();
-    if (!m_timer.isActive())
-        m_timer.startOneShot(0_s);
+    captionPreferencesChanged();
 }
 
 void CaptionUserPreferences::updateCaptionStyleSheetOverride()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to