Changeset 261709 in webkit


Ignore:
Timestamp:
May 14, 2020 1:38:44 PM (4 years ago)
Author:
eric.carlson@apple.com
Message:

[Cocoa] Don't clear NowPlaying state unless it was set
https://bugs.webkit.org/show_bug.cgi?id=211899
<rdar://problem/62249870>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/now-playing-status-without-media.html

  • platform/audio/PlatformMediaSessionManager.h:

(WebCore::PlatformMediaSessionManager::haveEverRegisteredAsNowPlayingApplication const): Method
added for testing.

  • platform/audio/cocoa/MediaSessionManagerCocoa.h:
  • platform/audio/cocoa/MediaSessionManagerCocoa.mm:

(WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Don't clear NowPlaying state unless
it was setup in the first place.

  • testing/Internals.cpp:

(WebCore::Internals::nowPlayingState const): Add new property.

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

  • media/now-playing-status-without-media-expected.txt: Added.
  • media/now-playing-status-without-media.html: Added.
  • gpu-process/TestExpectations: Skip test because media session isn't fully functional in GPUP.
  • platform/mac-wk1/TestExpectations: Skip test because media session manager is a singleton.
  • platform/gtk/TestExpectations: Skip Cocoa-only test.
  • platform/win/TestExpectations: Ditto.
  • platform/wpe/TestExpectations: Ditto.
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261708 r261709  
     12020-05-14  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Cocoa] Don't clear NowPlaying state unless it was set
     4        https://bugs.webkit.org/show_bug.cgi?id=211899
     5        <rdar://problem/62249870>
     6
     7        Reviewed by Jer Noble.
     8
     9        * media/now-playing-status-without-media-expected.txt: Added.
     10        * media/now-playing-status-without-media.html: Added.
     11
     12        * gpu-process/TestExpectations: Skip test because media session isn't fully functional in GPUP.
     13        * platform/mac-wk1/TestExpectations: Skip test because media session manager is a singleton.
     14        * platform/gtk/TestExpectations: Skip Cocoa-only test.
     15        * platform/win/TestExpectations: Ditto.
     16        * platform/wpe/TestExpectations: Ditto.
     17
    1182020-05-14  Myles C. Maxfield  <mmaxfield@apple.com>
    219
  • trunk/LayoutTests/gpu-process/TestExpectations

    r261160 r261709  
    249249media/muted-video-is-playing-audio.html [ Skip ]
    250250media/navigate-with-pip-should-not-crash.html [ Skip ]
     251media/now-playing-status-without-media.html [ Skip ]
    251252media/picture-in-picture/picture-in-picture-api-css-selector.html [ Skip ]
    252253media/picture-in-picture/picture-in-picture-api-enter-pip-4.html [ Skip ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r261688 r261709  
    11631163# Currently enabled on Mac only
    11641164media/media-usage-state.html [ Skip ]
     1165media/now-playing-status-without-media.html [ Skip ]
    11651166
    11661167# No support for WebGPU yet
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r261702 r261709  
    197197imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/color.html [ Skip ]
    198198
    199 # Audio session is a singleton
     199# Audio session and media session manager are a singletons
    200200platform/mac/media/media-source/media-source-change-source.html [ Skip ]
     201media/now-playing-status-without-media.html [ Skip ]
    201202
    202203#//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/win/TestExpectations

    r261708 r261709  
    11641164# Currently enabled on Mac only
    11651165media/media-usage-state.html [ Skip ]
     1166media/now-playing-status-without-media.html [ Skip ]
    11661167
    11671168################################################################################
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r261609 r261709  
    725725# Currently enabled on Mac only
    726726media/media-usage-state.html [ Skip ]
     727media/now-playing-status-without-media.html [ Skip ]
    727728
    728729webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r261705 r261709  
     12020-05-14  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Cocoa] Don't clear NowPlaying state unless it was set
     4        https://bugs.webkit.org/show_bug.cgi?id=211899
     5        <rdar://problem/62249870>
     6
     7        Reviewed by Jer Noble.
     8
     9        Test: media/now-playing-status-without-media.html
     10
     11        * platform/audio/PlatformMediaSessionManager.h:
     12        (WebCore::PlatformMediaSessionManager::haveEverRegisteredAsNowPlayingApplication const): Method
     13        added for testing.
     14
     15        * platform/audio/cocoa/MediaSessionManagerCocoa.h:
     16        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
     17        (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Don't clear NowPlaying state unless
     18        it was setup in the first place.
     19
     20        * testing/Internals.cpp:
     21        (WebCore::Internals::nowPlayingState const): Add new property.
     22        * testing/Internals.h:
     23        * testing/Internals.idl:
     24
    1252020-05-14  Andres Gonzalez  <andresg_22@apple.com>
    226
  • trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h

    r260182 r261709  
    7373    virtual MediaSessionIdentifier lastUpdatedNowPlayingInfoUniqueIdentifier() const { return { }; }
    7474    virtual bool registeredAsNowPlayingApplication() const { return false; }
     75    virtual bool haveEverRegisteredAsNowPlayingApplication() const { return false; }
    7576    virtual void prepareToSendUserMediaPermissionRequest() { }
    7677
  • trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h

    r260182 r261709  
    5656    MediaSessionIdentifier lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; }
    5757    bool registeredAsNowPlayingApplication() const final { return m_registeredAsNowPlayingApplication; }
     58    bool haveEverRegisteredAsNowPlayingApplication() const final { return m_haveEverRegisteredAsNowPlayingApplication; }
     59
    5860    void prepareToSendUserMediaPermissionRequest() final;
    5961
     
    101103    bool m_nowPlayingActive { false };
    102104    bool m_registeredAsNowPlayingApplication { false };
     105    bool m_haveEverRegisteredAsNowPlayingApplication { false };
    103106
    104107    // For testing purposes only.
  • trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm

    r261110 r261709  
    323323
    324324    if (!nowPlayingInfo) {
    325         ALWAYS_LOG(LOGIDENTIFIER, "clearing now playing info");
    326         platformStrategies()->mediaStrategy().clearNowPlayingInfo();
     325
     326        if (m_registeredAsNowPlayingApplication) {
     327            ALWAYS_LOG(LOGIDENTIFIER, "clearing now playing info");
     328            platformStrategies()->mediaStrategy().clearNowPlayingInfo();
     329        }
    327330
    328331        m_registeredAsNowPlayingApplication = false;
     
    336339    }
    337340
    338     ALWAYS_LOG(LOGIDENTIFIER, "title = \"", nowPlayingInfo->title, "\", isPlaying = ", nowPlayingInfo->isPlaying, ", duration = ", nowPlayingInfo->duration, ", now = ", nowPlayingInfo->currentTime, ", id = ", nowPlayingInfo->uniqueIdentifier.toUInt64(), ", registered = ", m_registeredAsNowPlayingApplication);
    339 
     341    m_haveEverRegisteredAsNowPlayingApplication = true;
    340342    platformStrategies()->mediaStrategy().setNowPlayingInfo(!m_registeredAsNowPlayingApplication, *nowPlayingInfo);
    341343
     
    345347    }
    346348
     349    ALWAYS_LOG(LOGIDENTIFIER, "title = \"", nowPlayingInfo->title, "\", isPlaying = ", nowPlayingInfo->isPlaying, ", duration = ", nowPlayingInfo->duration, ", now = ", nowPlayingInfo->currentTime, ", id = ", nowPlayingInfo->uniqueIdentifier.toUInt64(), ", registered = ", m_registeredAsNowPlayingApplication);
     350
    347351    if (!nowPlayingInfo->title.isEmpty())
    348352        m_lastUpdatedNowPlayingTitle = nowPlayingInfo->title;
  • trunk/Source/WebCore/testing/Internals.cpp

    r261679 r261709  
    42834283        PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingInfoUniqueIdentifier().toUInt64(),
    42844284        PlatformMediaSessionManager::sharedManager().hasActiveNowPlayingSession(),
    4285         PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication()
     4285        PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication(),
     4286        PlatformMediaSessionManager::sharedManager().haveEverRegisteredAsNowPlayingApplication()
    42864287    } };
    42874288#else
  • trunk/Source/WebCore/testing/Internals.h

    r261663 r261709  
    831831        bool hasActiveSession;
    832832        bool registeredAsNowPlayingApplication;
     833        bool haveEverRegisteredAsNowPlayingApplication;
    833834    };
    834835    ExceptionOr<NowPlayingState> nowPlayingState() const;
  • trunk/Source/WebCore/testing/Internals.idl

    r261663 r261709  
    106106    JSGenerateToJSObject,
    107107] dictionary NowPlayingState {
    108     boolean hasActiveSession;
    109     boolean registeredAsNowPlayingApplication;
    110108    DOMString title;
    111109    unrestricted double duration;
    112110    unrestricted double elapsedTime;
    113111    unsigned long long uniqueIdentifier;
     112    boolean hasActiveSession;
     113    boolean registeredAsNowPlayingApplication;
     114    boolean haveEverRegisteredAsNowPlayingApplication;
    114115};
    115116
Note: See TracChangeset for help on using the changeset viewer.