Title: [199515] trunk
Revision
199515
Author
[email protected]
Date
2016-04-13 15:09:43 -0700 (Wed, 13 Apr 2016)

Log Message

[iOS] remote command should be considered user events
https://bugs.webkit.org/show_bug.cgi?id=156546
<rdar://problem/25560877>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/remote-control-command-is-user-gesture.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Increment/decrement
  m_processingRemoteControlCommand around calling remote command method.
(WebCore::HTMLMediaElement::processingUserGesture): Return true if called while handling
  a remote control command.
* html/HTMLMediaElement.h:

LayoutTests:

* media/remote-control-command-is-user-gesture-expected.txt: Added.
* media/remote-control-command-is-user-gesture.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199514 => 199515)


--- trunk/LayoutTests/ChangeLog	2016-04-13 22:02:27 UTC (rev 199514)
+++ trunk/LayoutTests/ChangeLog	2016-04-13 22:09:43 UTC (rev 199515)
@@ -1,3 +1,14 @@
+2016-04-13  Eric Carlson  <[email protected]>
+
+        [iOS] remote command should be considered user events
+        https://bugs.webkit.org/show_bug.cgi?id=156546
+        <rdar://problem/25560877>
+
+        Reviewed by Jer Noble.
+
+        * media/remote-control-command-is-user-gesture-expected.txt: Added.
+        * media/remote-control-command-is-user-gesture.html: Added.
+
 2016-04-13  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r199502 and r199511.

Added: trunk/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt (0 => 199515)


--- trunk/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt	2016-04-13 22:09:43 UTC (rev 199515)
@@ -0,0 +1,17 @@
+Test that a remote control command is treated as a user gesture.
+
+
+RUN(internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange"))
+* set video.src
+EVENT(loadedmetadata)
+
+* video.play() should fail 
+RUN(video.play())
+EXPECTED (video.paused == 'true') OK
+
+* Send a play command, it should succeed.
+RUN(internals.postRemoteControlCommand('play'))
+
+EVENT(timeupdate)
+END OF TEST
+

Added: trunk/LayoutTests/media/remote-control-command-is-user-gesture.html (0 => 199515)


--- trunk/LayoutTests/media/remote-control-command-is-user-gesture.html	                        (rev 0)
+++ trunk/LayoutTests/media/remote-control-command-is-user-gesture.html	2016-04-13 22:09:43 UTC (rev 199515)
@@ -0,0 +1,43 @@
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                findMediaElement();
+
+                run('internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange")');
+
+                waitForEvent('loadedmetadata', loadedmetadata, false, true, document)
+                waitForEventAndEnd('timeupdate')
+
+                consoleWrite('* set video.src');
+                video.src = "" 'content/test');
+            }
+
+            function loadedmetadata()
+            {
+                consoleWrite('<br>* video.play() should fail ');
+                run('video.play()');
+                testExpected('video.paused', true);
+
+                consoleWrite('<br>* Send a play command, it should succeed.');
+                run("internals.postRemoteControlCommand('play')");
+                consoleWrite('');
+            }
+
+        </script>
+    </head>
+
+    <body _onload_="start()">
+        <p>Test that a remote control command is treated as a user gesture.</p>
+        <video controls></video>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (199514 => 199515)


--- trunk/Source/WebCore/ChangeLog	2016-04-13 22:02:27 UTC (rev 199514)
+++ trunk/Source/WebCore/ChangeLog	2016-04-13 22:09:43 UTC (rev 199515)
@@ -1,3 +1,20 @@
+2016-04-13  Eric Carlson  <[email protected]>
+
+        [iOS] remote command should be considered user events
+        https://bugs.webkit.org/show_bug.cgi?id=156546
+        <rdar://problem/25560877>
+
+        Reviewed by Jer Noble.
+
+        Test: media/remote-control-command-is-user-gesture.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Increment/decrement 
+          m_processingRemoteControlCommand around calling remote command method.
+        (WebCore::HTMLMediaElement::processingUserGesture): Return true if called while handling
+          a remote control command.
+        * html/HTMLMediaElement.h:
+
 2016-04-13  Antonio Gomes  <[email protected]>
 
         Non-resizable text field looks resizable

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (199514 => 199515)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-04-13 22:02:27 UTC (rev 199514)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-04-13 22:09:43 UTC (rev 199515)
@@ -85,6 +85,7 @@
 #include "ShadowRoot.h"
 #include "TimeRanges.h"
 #include "UserContentController.h"
+#include "UserGestureIndicator.h"
 #include <limits>
 #include <runtime/Uint8Array.h>
 #include <wtf/CurrentTime.h>
@@ -6640,6 +6641,7 @@
 {
     LOG(Media, "HTMLMediaElement::didReceiveRemoteControlCommand(%p) - %i", this, static_cast<int>(command));
 
+    UserGestureIndicator remoteControlUserGesture(DefinitelyProcessingUserGesture, &document());
     switch (command) {
     case PlatformMediaSession::PlayCommand:
         play();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to