Changeset 187588 in webkit


Ignore:
Timestamp:
Jul 30, 2015 10:02:13 AM (9 years ago)
Author:
mrajca@apple.com
Message:

Media Session: add infrastructure for testing media control events
https://bugs.webkit.org/show_bug.cgi?id=147412

Reviewed by Eric Carlson.

  • Modules/mediasession/MediaSessionManager.h:
  • testing/Internals.cpp:

(WebCore::Internals::sendMediaControlEvent): Let tests simulate media control events.

  • testing/Internals.h:
  • testing/Internals.idl:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r187587 r187588  
     12015-07-29  Matt Rajca  <mrajca@apple.com>
     2
     3        Media Session: add infrastructure for testing media control events
     4        https://bugs.webkit.org/show_bug.cgi?id=147412
     5
     6        Reviewed by Eric Carlson.
     7
     8        * Modules/mediasession/MediaSessionManager.h:
     9        * testing/Internals.cpp:
     10        (WebCore::Internals::sendMediaControlEvent): Let tests simulate media control events.
     11        * testing/Internals.h:
     12        * testing/Internals.idl:
     13
    1142015-07-30  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.h

    r187004 r187588  
    4242    WEBCORE_EXPORT static MediaSessionManager& singleton();
    4343
    44     void togglePlayback();
    45     void skipToNextTrack();
    46     void skipToPreviousTrack();
     44    WEBCORE_EXPORT void togglePlayback();
     45    WEBCORE_EXPORT void skipToNextTrack();
     46    WEBCORE_EXPORT void skipToPreviousTrack();
    4747
    4848    WEBCORE_EXPORT void didReceiveStartOfInterruptionNotification(MediaSessionInterruptingCategory) override;
  • trunk/Source/WebCore/testing/Internals.cpp

    r187377 r187588  
    28222822    return element->playerVolume();
    28232823}
     2824
     2825void Internals::sendMediaControlEvent(const String& event)
     2826{
     2827    if (event == "play-pause")
     2828        MediaSessionManager::singleton().togglePlayback();
     2829    else if (event == "next-track")
     2830        MediaSessionManager::singleton().skipToNextTrack();
     2831    else if (event == "previous-track")
     2832        MediaSessionManager::singleton().skipToPreviousTrack();
     2833    else
     2834        ASSERT_NOT_REACHED();
     2835}
    28242836#endif // ENABLE(MEDIA_SESSION)
    28252837
  • trunk/Source/WebCore/testing/Internals.h

    r187377 r187588  
    401401    String mediaSessionCurrentState(MediaSession*) const;
    402402    double mediaElementPlayerVolume(HTMLMediaElement*) const;
     403    void sendMediaControlEvent(const String&);
    403404#endif
    404405
  • trunk/Source/WebCore/testing/Internals.idl

    r187377 r187588  
    5252};
    5353
     54enum MediaControlEvent {
     55    "play-pause",
     56    "next-track",
     57    "previous-track"
     58};
     59
    5460[
    5561    NoInterfaceObject,
     
    364370    [Conditional=MEDIA_SESSION] DOMString mediaSessionCurrentState(MediaSession session);
    365371    [Conditional=MEDIA_SESSION] double mediaElementPlayerVolume(HTMLMediaElement element);
     372    [Conditional=MEDIA_SESSION] void sendMediaControlEvent(MediaControlEvent event);
    366373    [Conditional=VIDEO] void applicationWillEnterForeground();
    367374    [Conditional=VIDEO] void applicationWillEnterBackground();
Note: See TracChangeset for help on using the changeset viewer.