Title: [187256] trunk/Source/WebCore
Revision
187256
Author
[email protected]
Date
2015-07-23 15:02:07 -0700 (Thu, 23 Jul 2015)

Log Message

Media Session: add infrastructure for testing ducking https://bugs.webkit.org/show_bug.cgi?id=147080

Reviewed by Jer Noble.

We need to expose a media element's underlying media player's volume to tests so we can test ducking.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::playerVolume):
* html/HTMLMediaElement.h:
* testing/Internals.cpp:
(WebCore::Internals::mediaElementPlayerVolume):
* testing/Internals.h:
* testing/Internals.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187255 => 187256)


--- trunk/Source/WebCore/ChangeLog	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/ChangeLog	2015-07-23 22:02:07 UTC (rev 187256)
@@ -1,3 +1,19 @@
+2015-07-23  Matt Rajca  <[email protected]>
+
+        Media Session: add infrastructure for testing ducking https://bugs.webkit.org/show_bug.cgi?id=147080
+
+        Reviewed by Jer Noble.
+
+        We need to expose a media element's underlying media player's volume to tests so we can test ducking.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::playerVolume):
+        * html/HTMLMediaElement.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::mediaElementPlayerVolume):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2015-07-21  Jer Noble  <[email protected]>
 
         [iOS] Add an explicit API to allow media documents to (temporarily) play inline

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (187255 => 187256)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-07-23 22:02:07 UTC (rev 187256)
@@ -6479,6 +6479,10 @@
 }
 
 #if ENABLE(MEDIA_SESSION)
+double HTMLMediaElement::playerVolume() const
+{
+    return m_player ? m_player->volume() : 0;
+}
 
 MediaSession* HTMLMediaElement::session() const
 {

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (187255 => 187256)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2015-07-23 22:02:07 UTC (rev 187256)
@@ -420,6 +420,8 @@
     void mediaLoadingFailedFatally(MediaPlayerEnums::NetworkState);
 
 #if ENABLE(MEDIA_SESSION)
+    WEBCORE_EXPORT double playerVolume() const;
+
     const String& kind() const { return m_kind; }
     void setKind(const String& kind) { m_kind = kind; }
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (187255 => 187256)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-07-23 22:02:07 UTC (rev 187256)
@@ -2809,6 +2809,12 @@
         return "idle";
     }
 }
+
+double Internals::mediaElementPlayerVolume(HTMLMediaElement* element) const
+{
+    ASSERT_ARG(element, element);
+    return element->playerVolume();
+}
 #endif // ENABLE(MEDIA_SESSION)
 
 #if ENABLE(WEB_AUDIO)

Modified: trunk/Source/WebCore/testing/Internals.h (187255 => 187256)


--- trunk/Source/WebCore/testing/Internals.h	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/testing/Internals.h	2015-07-23 22:02:07 UTC (rev 187256)
@@ -398,6 +398,7 @@
     void sendMediaSessionStartOfInterruptionNotification(const String&);
     void sendMediaSessionEndOfInterruptionNotification(const String&);
     String mediaSessionCurrentState(MediaSession*) const;
+    double mediaElementPlayerVolume(HTMLMediaElement*) const;
 #endif
 
 #if ENABLE(WEB_AUDIO)

Modified: trunk/Source/WebCore/testing/Internals.idl (187255 => 187256)


--- trunk/Source/WebCore/testing/Internals.idl	2015-07-23 22:00:16 UTC (rev 187255)
+++ trunk/Source/WebCore/testing/Internals.idl	2015-07-23 22:02:07 UTC (rev 187256)
@@ -361,6 +361,7 @@
     [Conditional=MEDIA_SESSION] void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory category);
     [Conditional=MEDIA_SESSION] void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory category);
     [Conditional=MEDIA_SESSION] DOMString mediaSessionCurrentState(MediaSession session);
+    [Conditional=MEDIA_SESSION] double mediaElementPlayerVolume(HTMLMediaElement element);
     [Conditional=VIDEO] void applicationWillEnterForeground();
     [Conditional=VIDEO] void applicationWillEnterBackground();
     [Conditional=VIDEO, RaisesException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to