Changeset 214532 in webkit


Ignore:
Timestamp:
Mar 29, 2017 2:39:41 AM (7 years ago)
Author:
commit-queue@webkit.org
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 <Antoine Quint> 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:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r214527 r214532  
     12017-03-29  Antoine Quint  <graouts@apple.com>
     2
     3        [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
     4        https://bugs.webkit.org/show_bug.cgi?id=168409
     5        <rdar://problem/30799198>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Opt into ScriptedAnimationController logging.
     10
     11        * media/modern-media-controls/airplay-button/airplay-button-expected.txt:
     12        * media/modern-media-controls/airplay-button/airplay-button.html:
     13
    1142017-03-28  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button-expected.txt

    r214400 r214532  
    44
    55
     6PASS airplayButton.element.localName is "button"
     7PASS airplayButton.element.classList.contains("icon") is true
     8PASS airplayButton.element.classList.contains("airplay") is true
     9PASS airplayButton.iconName is Icons.Airplay
     10PASS airplayButton.width is 0
     11PASS airplayButton.height is 0
     12PASS airplayButton._image is iconService.imageForIconNameAndLayoutTraits(Icons.Airplay.name, LayoutTraits.macOS)
     13PASS airplayButton._image.src is not ""
     14PASS airplayButton._image.complete is false
    615scheduleLayout() - start
    716_requestFrameIfNeeded()
     17[ScriptedAnimationController] raf-register-callback
     18[ScriptedAnimationController] raf-schedule-animation
    819_requestFrameIfNeeded() - registered rAF, _frameID = 1
    920scheduleLayout() - _layoutCallbacks.size = 1
     
    1930scheduleLayout() - _layoutCallbacks.size = 1
    2031scheduleLayout() - end
    21 PASS airplayButton.element.localName is "button"
    22 PASS airplayButton.element.classList.contains("icon") is true
    23 PASS airplayButton.element.classList.contains("airplay") is true
    24 PASS airplayButton.iconName is Icons.Airplay
    25 FAIL airplayButton.width should be 0. Was 25.
    26 FAIL airplayButton.height should be 0. Was 22.
    27 PASS airplayButton._image is iconService.imageForIconNameAndLayoutTraits(Icons.Airplay.name, LayoutTraits.macOS)
    28 PASS airplayButton._image.src is not ""
    29 FAIL airplayButton._image.complete should be false. Was true.
    3032PASS airplayButton.width is not 0
    3133PASS airplayButton.height is not 0
     
    3537PASS scheduler._frameID is not -1
    3638PASS dirtyNodes.has(airplayButton) is true
     39PASS airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@") became true
     40[ScriptedAnimationController] raf-service-scripted-animations
     41[ScriptedAnimationController] raf-will-fire
    3742_frameDidFire() - start
    3843frameWillFire()
     
    4954PASS airplayButton.element.getAttribute('aria-label') is "AirPlay"
    5055_frameDidFire() - end
    51 PASS airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@") became true
     56[ScriptedAnimationController] raf-did-fire
    5257PASS successfullyParsed is true
    5358
  • trunk/LayoutTests/media/modern-media-controls/airplay-button/airplay-button.html

    r214400 r214532  
    66<script type="text/javascript">
    77
     8let reachedEndOfTest = false;
     9let receivedRAFDidFireEvent = false;
     10
    811window.jsTestIsAsync = true;
    912scheduler.debug = debug;
    1013
    1114description("Testing the <code>AirplayButton</code> class.");
     15
     16if (window.internals) {
     17    ["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));
     18    window.internals.settings.setShouldDispatchRequestAnimationFrameEvents(true);
     19}
     20
     21function handleRAFEvent(event)
     22{
     23    debug(`[ScriptedAnimationController] ${event.type}`);
     24    if (event.type === "raf-did-fire") {
     25        receivedRAFDidFireEvent = true;
     26        considerFinishingTest();
     27    }
     28}
     29
     30function considerFinishingTest()
     31{
     32    if (reachedEndOfTest && receivedRAFDidFireEvent)
     33        finishJSTest();
     34}
    1235
    1336const airplayButton = new AirplayButton({ layoutTraits: LayoutTraits.macOS });
     
    4568        shouldBeEqualToString("airplayButton.element.getAttribute('aria-label')", "AirPlay");
    4669    }
    47     shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", finishJSTest);
     70    shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", () => {
     71        reachedEndOfTest = true;
     72        considerFinishingTest();
     73    });
    4874    // shouldBecomeEqual('airplayButton.element.style.webkitMaskImage.includes("macOS/airplay@")', "true", () => {
    4975    //     shouldBecomeEqual('macOSFullscreenAirplayButton.element.style.webkitMaskImage.includes("macOS/airplay-fullscreen@")', "true", () => {
  • trunk/Source/WebCore/ChangeLog

    r214527 r214532  
     12017-03-29  Antoine Quint  <graouts@apple.com>
     2
     3        [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
     4        https://bugs.webkit.org/show_bug.cgi?id=168409
     5        <rdar://problem/30799198>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
     10        through the document. This should allow this flaky test to get information as to why the frame isn't
     11        firing when it times out.
     12
     13        * dom/ScriptedAnimationController.cpp:
     14        (WebCore::ScriptedAnimationController::suspend):
     15        (WebCore::ScriptedAnimationController::resume):
     16        (WebCore::ScriptedAnimationController::addThrottlingReason):
     17        (WebCore::ScriptedAnimationController::removeThrottlingReason):
     18        (WebCore::ScriptedAnimationController::registerCallback):
     19        (WebCore::ScriptedAnimationController::cancelCallback):
     20        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
     21        (WebCore::ScriptedAnimationController::scheduleAnimation):
     22        (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
     23        * dom/ScriptedAnimationController.h:
     24        * page/Settings.in:
     25        * testing/InternalSettings.cpp:
     26        (WebCore::InternalSettings::resetToConsistentState):
     27        (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
     28        (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
     29        * testing/InternalSettings.h:
     30        * testing/InternalSettings.idl:
     31
    1322017-03-28  Youenn Fablet  <youenn@apple.com>
    233
  • trunk/Source/WebCore/dom/ScriptedAnimationController.cpp

    r213169 r214532  
    8282void ScriptedAnimationController::suspend()
    8383{
     84    dispatchLoggingEventIfRequired("raf-suspend");
    8485    ++m_suspendCount;
    8586}
     
    8788void ScriptedAnimationController::resume()
    8889{
     90    dispatchLoggingEventIfRequired("raf-resume");
    8991    // It would be nice to put an ASSERT(m_suspendCount > 0) here, but in WK1 resume() can be called
    9092    // even when suspend hasn't (if a tab was created in the background).
     
    135137
    136138    RELEASE_LOG_IF_ALLOWED("addThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data());
     139    dispatchLoggingEventIfRequired("raf-add-throttling-reason");
    137140
    138141    if (m_animationTimer.isActive()) {
     
    154157
    155158    RELEASE_LOG_IF_ALLOWED("removeThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data());
     159    dispatchLoggingEventIfRequired("raf-remove-throttling-reason");
    156160
    157161    if (m_animationTimer.isActive()) {
     
    181185
    182186    InspectorInstrumentation::didRequestAnimationFrame(m_document, id);
     187    dispatchLoggingEventIfRequired("raf-register-callback");
    183188
    184189    if (!m_suspendCount)
     
    189194void ScriptedAnimationController::cancelCallback(CallbackId id)
    190195{
     196    dispatchLoggingEventIfRequired("raf-cancel-callback");
    191197    for (size_t i = 0; i < m_callbacks.size(); ++i) {
    192198        if (m_callbacks[i]->m_id == id) {
     
    194200            InspectorInstrumentation::didCancelAnimationFrame(m_document, id);
    195201            m_callbacks.remove(i);
     202            dispatchLoggingEventIfRequired("raf-did-cancel-callback");
    196203            return;
    197204        }
     
    201208void ScriptedAnimationController::serviceScriptedAnimations(double timestamp)
    202209{
     210    dispatchLoggingEventIfRequired("raf-service-scripted-animations");
    203211    if (!m_callbacks.size() || m_suspendCount || !requestAnimationFrameEnabled())
    204212        return;
     
    221229            callback->m_firedOrCancelled = true;
    222230            InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_document, callback->m_id);
     231            dispatchLoggingEventIfRequired("raf-will-fire");
    223232            if (callback->m_useLegacyTimeBase)
    224233                callback->handleEvent(legacyHighResNowMs);
     
    226235                callback->handleEvent(highResNowMs);
    227236            InspectorInstrumentation::didFireAnimationFrame(cookie);
     237            dispatchLoggingEventIfRequired("raf-did-fire");
    228238        }
    229239    }
     
    271281void ScriptedAnimationController::scheduleAnimation()
    272282{
     283    dispatchLoggingEventIfRequired("raf-schedule-animation");
    273284    if (!requestAnimationFrameEnabled())
    274285        return;
     
    281292
    282293        m_isUsingTimer = true;
     294        dispatchLoggingEventIfRequired("raf-schedule-animation-display-refresh-monitor");
    283295    }
    284296#endif
     
    289301    double scheduleDelay = std::max<double>(animationInterval.value() - (m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0);
    290302    m_animationTimer.startOneShot(scheduleDelay);
     303    dispatchLoggingEventIfRequired("raf-schedule-animation-timer");
    291304#else
    292305    if (FrameView* frameView = m_document->view())
    293306        frameView->scheduleAnimation();
     307    dispatchLoggingEventIfRequired("raf-schedule-animation-frame-view");
    294308#endif
    295309}
     
    323337#endif
    324338
    325 }
     339void ScriptedAnimationController::dispatchLoggingEventIfRequired(const AtomicString& type)
     340{
     341    if (m_document && m_document->frame() && m_document->frame()->settings().shouldDispatchRequestAnimationFrameEvents())
     342        m_document->dispatchEvent(Event::create(type, false, false));
     343}
     344
     345}
  • trunk/Source/WebCore/dom/ScriptedAnimationController.h

    r213169 r214532  
    3232#include <wtf/RefPtr.h>
    3333#include <wtf/Vector.h>
     34#include <wtf/text/AtomicString.h>
    3435
    3536#if USE(REQUEST_ANIMATION_FRAME_TIMER)
     
    9798
    9899    void scheduleAnimation();
     100    void dispatchLoggingEventIfRequired(const AtomicString&);
    99101
    100102#if USE(REQUEST_ANIMATION_FRAME_TIMER)
  • trunk/Source/WebCore/page/Settings.in

    r213566 r214532  
    275275inputEventsEnabled initial=true
    276276
     277shouldDispatchRequestAnimationFrameEvents initial=false
     278
    277279quickTimePluginReplacementEnabled initial=defaultQuickTimePluginReplacementEnabled
    278280youTubeFlashPluginReplacementEnabled initial=defaultYouTubeFlashPluginReplacementEnabled
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r213519 r214532  
    254254    m_page->setCanStartMedia(true);
    255255
     256    settings().setShouldDispatchRequestAnimationFrameEvents(false);
     257
    256258    settings().setForcePendingWebGLPolicy(false);
    257259#if ENABLE(WIRELESS_PLAYBACK_TARGET)
     
    710712}
    711713
     714bool InternalSettings::shouldDispatchRequestAnimationFrameEvents()
     715{
     716    return settings().shouldDispatchRequestAnimationFrameEvents();
     717}
     718
     719void InternalSettings::setShouldDispatchRequestAnimationFrameEvents(bool shouldDispatchRequestAnimationFrameEvents)
     720{
     721    settings().setShouldDispatchRequestAnimationFrameEvents(shouldDispatchRequestAnimationFrameEvents);
     722}
     723
    712724ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
    713725{
  • trunk/Source/WebCore/testing/InternalSettings.h

    r213519 r214532  
    110110    void setForcedPrefersReducedMotionAccessibilityValue(ForcedAccessibilityValue);
    111111
     112    bool shouldDispatchRequestAnimationFrameEvents();
     113    void setShouldDispatchRequestAnimationFrameEvents(bool);
     114
    112115    // RuntimeEnabledFeatures.
    113116    static void setIndexedDBWorkersEnabled(bool);
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r213410 r214532  
    9797    [MayThrowException] void setDeferredCSSParserEnabled(boolean enabled);
    9898
     99    boolean shouldDispatchRequestAnimationFrameEvents();
     100    void setShouldDispatchRequestAnimationFrameEvents(boolean shouldDispatchRequestAnimationFrameEvents);
     101
    99102    attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;
    100103    attribute ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue;
Note: See TracChangeset for help on using the changeset viewer.