Unreviewed, rolling out r231899.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2018 22:15:06 +0000 (22:15 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2018 22:15:06 +0000 (22:15 +0000)
Caused flakiness in two existing modern-media-controls tests.

Reverted changeset:

"[modern-media-controls] AirPlaySupport should be disabled by
default"
https://bugs.webkit.org/show_bug.cgi?id=185658
https://trac.webkit.org/changeset/231899

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play-expected.txt [deleted file]
LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/airplay-support.js

index 16257f2..3899dc5 100644 (file)
@@ -1,3 +1,16 @@
+2018-05-17  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r231899.
+
+        Caused flakiness in two existing modern-media-controls tests.
+
+        Reverted changeset:
+
+        "[modern-media-controls] AirPlaySupport should be disabled by
+        default"
+        https://bugs.webkit.org/show_bug.cgi?id=185658
+        https://trac.webkit.org/changeset/231899
+
 2018-05-17  Jer Noble  <jer.noble@apple.com>
 
         CRASH in ImageDecoderAVFObjC::sampleAtIndex()
diff --git a/LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play-expected.txt b/LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play-expected.txt
deleted file mode 100644 (file)
index 1fc8c57..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Testing AirPlaySupport is only enabled once media has started playing.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Starting test, the media can be played but hasn't started playing.
-
-Making AirPlay routes available.
-
-Airplay routes are available and controls are visible on the screen, but since the media hasn't played yet, AirplaySupport should be disabled.
-PASS controls.airplayButton.uiDelegate is undefined.
-PASS controls.visible is true
-PASS controls.faded is false
-
-We play the media so that the Airplay button can be enabled.
-
-Media played, AirplaySupport should become enabled now.
-PASS !!controls.airplayButton.uiDelegate became true
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html b/LayoutTests/media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html
deleted file mode 100644 (file)
index 58b2c3a..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<script src="../../../resources/js-test-pre.js"></script>
-<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
-<body>
-<video src="../../content/test.mp4" style="width: 320px; height: 240px;" preload controls></video>
-<div id="host"></div>
-<script type="text/javascript">
-
-window.jsTestIsAsync = true;
-
-description("Testing <code>AirPlaySupport</code> is only enabled once media has started playing.");
-
-const container = document.querySelector("div#host");
-const media = document.querySelector("video");
-const mediaController = createControls(container, media, null);
-const controls = mediaController.controls;
-
-controls.autoHideController.autoHideDelay = 100;
-
-media.addEventListener("canplay", startTest);
-
-function startTest()
-{
-    debug("Starting test, the media can be played but hasn't started playing.");
-
-    makeAirPlayAvailable();
-}
-
-function makeAirPlayAvailable()
-{
-    debug("");
-    debug("Making AirPlay routes available.");
-    media.addEventListener("webkitplaybacktargetavailabilitychanged", playbackTargetAvailabilityChangedOnce, true);
-    window.internals.setMockMediaPlaybackTargetPickerEnabled(true);
-}
-
-function playbackTargetAvailabilityChangedOnce(event)
-{
-    media.removeEventListener('webkitplaybacktargetavailabilitychanged', playbackTargetAvailabilityChangedOnce, true);
-    media.addEventListener('webkitplaybacktargetavailabilitychanged', playbackTargetAvailabilityChangedAgain, true);
-
-    window.internals.setMockMediaPlaybackTargetPickerState('Sleepy TV', 'DeviceAvailable');
-}
-
-function playbackTargetAvailabilityChangedAgain(event)
-{
-    // setMockMediaPlaybackTargetPickerState happens asynchronously in WK2 and a
-    // "webkitplaybacktargetavailabilitychanged" is always sent when an event listener
-    // is added, so we may get a "not available" event first.
-    if (event.availability == 'not-available')
-        return;
-
-    media.removeEventListener('webkitplaybacktargetavailabilitychanged', playbackTargetAvailabilityChangedAgain, true);
-
-    debug("");
-    debug("Airplay routes are available and controls are visible on the screen, but since the media hasn't played yet, AirplaySupport should be disabled.");
-    shouldBeUndefined("controls.airplayButton.uiDelegate");
-    shouldBeTrue("controls.visible");
-    shouldBeFalse("controls.faded");
-
-    debug("");
-    debug("We play the media so that the Airplay button can be enabled.");
-    media.addEventListener("play", mediaDidPlay);
-    media.play();
-}
-
-function mediaDidPlay()
-{
-    debug("");
-    debug("Media played, AirplaySupport should become enabled now.");
-    shouldBecomeEqual("!!controls.airplayButton.uiDelegate", "true", finishTest);
-}
-
-function finishTest()
-{
-    debug("");
-    container.remove();
-    media.remove();
-    finishJSTest();
-}
-
-</script>
-<script src="../../../resources/js-test-post.js"></script>
-</body>
index 5486ffd..03065f4 100644 (file)
@@ -1,3 +1,16 @@
+2018-05-17  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r231899.
+
+        Caused flakiness in two existing modern-media-controls tests.
+
+        Reverted changeset:
+
+        "[modern-media-controls] AirPlaySupport should be disabled by
+        default"
+        https://bugs.webkit.org/show_bug.cgi?id=185658
+        https://trac.webkit.org/changeset/231899
+
 2018-05-17  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Update AirPlay route monitoring
index 473e73d..248e576 100644 (file)
@@ -38,12 +38,6 @@ class AirplaySupport extends MediaControllerSupport
         return ["webkitplaybacktargetavailabilitychanged", "webkitcurrentplaybacktargetiswirelesschanged"];
     }
 
-    enable()
-    {
-        if (this._shouldBeEnabled())
-            super.enable();
-    }
-
     buttonWasPressed(control)
     {
         this.mediaController.media.webkitShowPlaybackTargetPicker();
@@ -51,7 +45,8 @@ class AirplaySupport extends MediaControllerSupport
 
     controlsUserVisibilityDidChange()
     {
-        if (this._shouldBeEnabled())
+        const controls = this.mediaController.controls;
+        if (controls.visible && !controls.faded)
             this.enable();
         else
             this.disable();
@@ -72,15 +67,4 @@ class AirplaySupport extends MediaControllerSupport
         this.mediaController.controls.muteButton.enabled = !this.control.on;
     }
 
-    // Private
-
-    _shouldBeEnabled()
-    {
-        if (!this.mediaController.hasPlayed)
-            return false;
-
-        const controls = this.mediaController.controls;
-        return controls.visible && !controls.faded;
-    }
-
 }