Title: [214532] trunk
Revision
214532
Author
commit-qu...@webkit.org
Date
2017-03-29 02:39:41 -0700 (Wed, 29 Mar 2017)

Log Message

[mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=168409
<rdar://problem/30799198>

Patch by Antoine Quint <grao...@apple.com> on 2017-03-29
Reviewed by Dean Jackson.

Source/WebCore:

Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
through the document. This should allow this flaky test to get information as to why the frame isn't
firing when it times out.

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::suspend):
(WebCore::ScriptedAnimationController::resume):
(WebCore::ScriptedAnimationController::addThrottlingReason):
(WebCore::ScriptedAnimationController::removeThrottlingReason):
(WebCore::ScriptedAnimationController::registerCallback):
(WebCore::ScriptedAnimationController::cancelCallback):
(WebCore::ScriptedAnimationController::serviceScriptedAnimations):
(WebCore::ScriptedAnimationController::scheduleAnimation):
(WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
* dom/ScriptedAnimationController.h:
* page/Settings.in:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::resetToConsistentState):
(WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
(WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

LayoutTests:

Opt into ScriptedAnimationController logging.

* media/modern-media-controls/airplay-button/airplay-button-expected.txt:
* media/modern-media-controls/airplay-button/airplay-button.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214531 => 214532)


--- trunk/LayoutTests/ChangeLog	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/LayoutTests/ChangeLog	2017-03-29 09:39:41 UTC (rev 214532)
@@ -1,3 +1,16 @@
+2017-03-29  Antoine Quint  <grao...@apple.com>
+
+        [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
+        https://bugs.webkit.org/show_bug.cgi?id=168409
+        <rdar://problem/30799198>
+
+        Reviewed by Dean Jackson.
+
+        Opt into ScriptedAnimationController logging.
+
+        * media/modern-media-controls/airplay-button/airplay-button-expected.txt:
+        * media/modern-media-controls/airplay-button/airplay-button.html:
+
 2017-03-28  Youenn Fablet  <you...@apple.com>
 
         [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary

Modified: trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button-expected.txt (214531 => 214532)


--- trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button-expected.txt	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button-expected.txt	2017-03-29 09:39:41 UTC (rev 214532)
@@ -3,8 +3,19 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS airplayButton.element.localName is "button"
+PASS airplayButton.element.classList.contains("icon") is true
+PASS airplayButton.element.classList.contains("airplay") is true
+PASS airplayButton.iconName is Icons.Airplay
+PASS airplayButton.width is 0
+PASS airplayButton.height is 0
+PASS airplayButton._image is iconService.imageForIconNameAndLayoutTraits(Icons.Airplay.name, LayoutTraits.macOS)
+PASS airplayButton._image.src is not ""
+PASS airplayButton._image.complete is false
 scheduleLayout() - start
 _requestFrameIfNeeded()
+[ScriptedAnimationController] raf-register-callback
+[ScriptedAnimationController] raf-schedule-animation
 _requestFrameIfNeeded() - registered rAF, _frameID = 1
 scheduleLayout() - _layoutCallbacks.size = 1
 scheduleLayout() - end
@@ -18,15 +29,6 @@
 _requestFrameIfNeeded() - failed to register rAF call, _frameID = 1, _layoutCallbacks.size = 1
 scheduleLayout() - _layoutCallbacks.size = 1
 scheduleLayout() - end
-PASS airplayButton.element.localName is "button"
-PASS airplayButton.element.classList.contains("icon") is true
-PASS airplayButton.element.classList.contains("airplay") is true
-PASS airplayButton.iconName is Icons.Airplay
-FAIL airplayButton.width should be 0. Was 25.
-FAIL airplayButton.height should be 0. Was 22.
-PASS airplayButton._image is iconService.imageForIconNameAndLayoutTraits(Icons.Airplay.name, LayoutTraits.macOS)
-PASS airplayButton._image.src is not ""
-FAIL airplayButton._image.complete should be false. Was true.
 PASS airplayButton.width is not 0
 PASS airplayButton.height is not 0
 PASS airplayButton.needsLayout is true
@@ -34,6 +36,9 @@
 PASS scheduler._layoutCallbacks.size is 1
 PASS scheduler._frameID is not -1
 PASS dirtyNodes.has(airplayButton) is true
+PASS airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@") became true
+[ScriptedAnimationController] raf-service-scripted-animations
+[ScriptedAnimationController] raf-will-fire
 _frameDidFire() - start
 frameWillFire()
 PASS dirtyNodes.has(airplayButton) is true
@@ -48,7 +53,7 @@
 PASS airplayButton.needsLayout is false
 PASS airplayButton.element.getAttribute('aria-label') is "AirPlay"
 _frameDidFire() - end
-PASS airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@") became true
+[ScriptedAnimationController] raf-did-fire
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button.html (214531 => 214532)


--- trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button.html	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button.html	2017-03-29 09:39:41 UTC (rev 214532)
@@ -5,11 +5,34 @@
 <body>
 <script type="text/_javascript_">
 
+let reachedEndOfTest = false;
+let receivedRAFDidFireEvent = false;
+
 window.jsTestIsAsync = true;
 scheduler.debug = debug;
 
 description("Testing the <code>AirplayButton</code> class.");
 
+if (window.internals) {
+    ["raf-suspend", "raf-resume", "raf-add-throttling-reason", "raf-remove-throttling-reason", "raf-register-callback", "raf-cancel-callback", "raf-did-cancel-callback", "raf-service-scripted-animations", "raf-will-fire", "raf-did-fire", "raf-schedule-animation", "raf-schedule-animation-display-refresh-monitor", "raf-schedule-animation-timer", "raf-schedule-animation-frame-view"].forEach(eventType => document.addEventListener(eventType, handleRAFEvent));
+    window.internals.settings.setShouldDispatchRequestAnimationFrameEvents(true);
+}
+
+function handleRAFEvent(event)
+{
+    debug(`[ScriptedAnimationController] ${event.type}`);
+    if (event.type === "raf-did-fire") {
+        receivedRAFDidFireEvent = true;
+        considerFinishingTest();
+    }
+}
+
+function considerFinishingTest()
+{
+    if (reachedEndOfTest && receivedRAFDidFireEvent)
+        finishJSTest();
+}
+
 const airplayButton = new AirplayButton({ layoutTraits: LayoutTraits.macOS });
 
 shouldBeEqualToString("airplayButton.element.localName", "button");
@@ -44,7 +67,10 @@
         shouldBeFalse("airplayButton.needsLayout");
         shouldBeEqualToString("airplayButton.element.getAttribute('aria-label')", "AirPlay");
     }
-    shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", finishJSTest);
+    shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", () => {
+        reachedEndOfTest = true;
+        considerFinishingTest();
+    });
     // shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", () => {
     //     shouldBecomeEqual('macOSFullscreenAirplayButton.element.style.webkitMaskImage.includes("macOS/airplay-fullscreen@")', "true", () => {
     //         shouldBecomeEqual('iOSAirplayButton.element.style.webkitMaskImage.includes("iOS/airplay@")', "true", finishJSTest);

Modified: trunk/Source/WebCore/ChangeLog (214531 => 214532)


--- trunk/Source/WebCore/ChangeLog	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/ChangeLog	2017-03-29 09:39:41 UTC (rev 214532)
@@ -1,3 +1,34 @@
+2017-03-29  Antoine Quint  <grao...@apple.com>
+
+        [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
+        https://bugs.webkit.org/show_bug.cgi?id=168409
+        <rdar://problem/30799198>
+
+        Reviewed by Dean Jackson.
+
+        Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
+        through the document. This should allow this flaky test to get information as to why the frame isn't
+        firing when it times out.
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::suspend):
+        (WebCore::ScriptedAnimationController::resume):
+        (WebCore::ScriptedAnimationController::addThrottlingReason):
+        (WebCore::ScriptedAnimationController::removeThrottlingReason):
+        (WebCore::ScriptedAnimationController::registerCallback):
+        (WebCore::ScriptedAnimationController::cancelCallback):
+        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
+        (WebCore::ScriptedAnimationController::scheduleAnimation):
+        (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
+        * dom/ScriptedAnimationController.h:
+        * page/Settings.in:
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::resetToConsistentState):
+        (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
+        (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2017-03-28  Youenn Fablet  <you...@apple.com>
 
         [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (214531 => 214532)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-03-29 09:39:41 UTC (rev 214532)
@@ -81,11 +81,13 @@
 
 void ScriptedAnimationController::suspend()
 {
+    dispatchLoggingEventIfRequired("raf-suspend");
     ++m_suspendCount;
 }
 
 void ScriptedAnimationController::resume()
 {
+    dispatchLoggingEventIfRequired("raf-resume");
     // It would be nice to put an ASSERT(m_suspendCount > 0) here, but in WK1 resume() can be called
     // even when suspend hasn't (if a tab was created in the background).
     if (m_suspendCount > 0)
@@ -134,6 +136,7 @@
     m_throttlingReasons |= reason;
 
     RELEASE_LOG_IF_ALLOWED("addThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data());
+    dispatchLoggingEventIfRequired("raf-add-throttling-reason");
 
     if (m_animationTimer.isActive()) {
         m_animationTimer.stop();
@@ -153,6 +156,7 @@
     m_throttlingReasons -= reason;
 
     RELEASE_LOG_IF_ALLOWED("removeThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data());
+    dispatchLoggingEventIfRequired("raf-remove-throttling-reason");
 
     if (m_animationTimer.isActive()) {
         m_animationTimer.stop();
@@ -180,6 +184,7 @@
     m_callbacks.append(WTFMove(callback));
 
     InspectorInstrumentation::didRequestAnimationFrame(m_document, id);
+    dispatchLoggingEventIfRequired("raf-register-callback");
 
     if (!m_suspendCount)
         scheduleAnimation();
@@ -188,11 +193,13 @@
 
 void ScriptedAnimationController::cancelCallback(CallbackId id)
 {
+    dispatchLoggingEventIfRequired("raf-cancel-callback");
     for (size_t i = 0; i < m_callbacks.size(); ++i) {
         if (m_callbacks[i]->m_id == id) {
             m_callbacks[i]->m_firedOrCancelled = true;
             InspectorInstrumentation::didCancelAnimationFrame(m_document, id);
             m_callbacks.remove(i);
+            dispatchLoggingEventIfRequired("raf-did-cancel-callback");
             return;
         }
     }
@@ -200,6 +207,7 @@
 
 void ScriptedAnimationController::serviceScriptedAnimations(double timestamp)
 {
+    dispatchLoggingEventIfRequired("raf-service-scripted-animations");
     if (!m_callbacks.size() || m_suspendCount || !requestAnimationFrameEnabled())
         return;
 
@@ -220,11 +228,13 @@
         if (!callback->m_firedOrCancelled) {
             callback->m_firedOrCancelled = true;
             InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_document, callback->m_id);
+            dispatchLoggingEventIfRequired("raf-will-fire");
             if (callback->m_useLegacyTimeBase)
                 callback->handleEvent(legacyHighResNowMs);
             else
                 callback->handleEvent(highResNowMs);
             InspectorInstrumentation::didFireAnimationFrame(cookie);
+            dispatchLoggingEventIfRequired("raf-did-fire");
         }
     }
 
@@ -270,6 +280,7 @@
 
 void ScriptedAnimationController::scheduleAnimation()
 {
+    dispatchLoggingEventIfRequired("raf-schedule-animation");
     if (!requestAnimationFrameEnabled())
         return;
 
@@ -280,6 +291,7 @@
             return;
 
         m_isUsingTimer = true;
+        dispatchLoggingEventIfRequired("raf-schedule-animation-display-refresh-monitor");
     }
 #endif
     if (m_animationTimer.isActive())
@@ -288,9 +300,11 @@
     Seconds animationInterval = interval();
     double scheduleDelay = std::max<double>(animationInterval.value() - (m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0);
     m_animationTimer.startOneShot(scheduleDelay);
+    dispatchLoggingEventIfRequired("raf-schedule-animation-timer");
 #else
     if (FrameView* frameView = m_document->view())
         frameView->scheduleAnimation();
+    dispatchLoggingEventIfRequired("raf-schedule-animation-frame-view");
 #endif
 }
 
@@ -322,4 +336,10 @@
 }
 #endif
 
+void ScriptedAnimationController::dispatchLoggingEventIfRequired(const AtomicString& type)
+{
+    if (m_document && m_document->frame() && m_document->frame()->settings().shouldDispatchRequestAnimationFrameEvents())
+        m_document->dispatchEvent(Event::create(type, false, false));
 }
+
+}

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (214531 => 214532)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.h	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h	2017-03-29 09:39:41 UTC (rev 214532)
@@ -31,6 +31,7 @@
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
 
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
 #include "Timer.h"
@@ -96,6 +97,7 @@
     int m_suspendCount { 0 };
 
     void scheduleAnimation();
+    void dispatchLoggingEventIfRequired(const AtomicString&);
 
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
     void animationTimerFired();

Modified: trunk/Source/WebCore/page/Settings.in (214531 => 214532)


--- trunk/Source/WebCore/page/Settings.in	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/page/Settings.in	2017-03-29 09:39:41 UTC (rev 214532)
@@ -274,6 +274,8 @@
 
 inputEventsEnabled initial=true
 
+shouldDispatchRequestAnimationFrameEvents initial=false
+
 quickTimePluginReplacementEnabled initial=defaultQuickTimePluginReplacementEnabled
 youTubeFlashPluginReplacementEnabled initial=defaultYouTubeFlashPluginReplacementEnabled
 

Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (214531 => 214532)


--- trunk/Source/WebCore/testing/InternalSettings.cpp	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp	2017-03-29 09:39:41 UTC (rev 214532)
@@ -253,6 +253,8 @@
     m_page->mainFrame().setPageAndTextZoomFactors(1, 1);
     m_page->setCanStartMedia(true);
 
+    settings().setShouldDispatchRequestAnimationFrameEvents(false);
+
     settings().setForcePendingWebGLPolicy(false);
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     settings().setAllowsAirPlayForMediaPlayback(false);
@@ -709,6 +711,16 @@
 #endif
 }
 
+bool InternalSettings::shouldDispatchRequestAnimationFrameEvents()
+{
+    return settings().shouldDispatchRequestAnimationFrameEvents();
+}
+
+void InternalSettings::setShouldDispatchRequestAnimationFrameEvents(bool shouldDispatchRequestAnimationFrameEvents)
+{
+    settings().setShouldDispatchRequestAnimationFrameEvents(shouldDispatchRequestAnimationFrameEvents);
+}
+
 ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
 {
     if (!m_page)

Modified: trunk/Source/WebCore/testing/InternalSettings.h (214531 => 214532)


--- trunk/Source/WebCore/testing/InternalSettings.h	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/testing/InternalSettings.h	2017-03-29 09:39:41 UTC (rev 214532)
@@ -109,6 +109,9 @@
     ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue() const;
     void setForcedPrefersReducedMotionAccessibilityValue(ForcedAccessibilityValue);
 
+    bool shouldDispatchRequestAnimationFrameEvents();
+    void setShouldDispatchRequestAnimationFrameEvents(bool);
+
     // RuntimeEnabledFeatures.
     static void setIndexedDBWorkersEnabled(bool);
     static void setCSSGridLayoutEnabled(bool);

Modified: trunk/Source/WebCore/testing/InternalSettings.idl (214531 => 214532)


--- trunk/Source/WebCore/testing/InternalSettings.idl	2017-03-29 06:15:23 UTC (rev 214531)
+++ trunk/Source/WebCore/testing/InternalSettings.idl	2017-03-29 09:39:41 UTC (rev 214532)
@@ -96,6 +96,9 @@
     [MayThrowException] boolean deferredCSSParserEnabled();
     [MayThrowException] void setDeferredCSSParserEnabled(boolean enabled);
 
+    boolean shouldDispatchRequestAnimationFrameEvents();
+    void setShouldDispatchRequestAnimationFrameEvents(boolean shouldDispatchRequestAnimationFrameEvents);
+
     attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;
     attribute ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue;
     attribute ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to