Modified: trunk/LayoutTests/ChangeLog (188345 => 188346)
--- trunk/LayoutTests/ChangeLog 2015-08-12 19:22:49 UTC (rev 188345)
+++ trunk/LayoutTests/ChangeLog 2015-08-12 19:22:58 UTC (rev 188346)
@@ -1,3 +1,16 @@
+2015-08-11 Matt Rajca <[email protected]>
+
+ Media Session: add test for Content media session focus
+ https://bugs.webkit.org/show_bug.cgi?id=147902
+
+ Reviewed by Eric Carlson.
+
+ Playing a media element that belongs to a Content media session should pause other media elements that belong
+ to Content media sessions.
+
+ * media/session/content-session-focus-expected.txt: Added.
+ * media/session/content-session-focus.html: Added.
+
2015-08-12 Brent Fulgham <[email protected]>
REGRESSION(r185606): ASSERT in WebCore::RenderElement::styleWillChange
Added: trunk/LayoutTests/media/session/content-session-focus-expected.txt (0 => 188346)
--- trunk/LayoutTests/media/session/content-session-focus-expected.txt (rev 0)
+++ trunk/LayoutTests/media/session/content-session-focus-expected.txt 2015-08-12 19:22:58 UTC (rev 188346)
@@ -0,0 +1,22 @@
+Playing a media element belonging to a Content media session should pause other playing Content media elements.
+
+
+EVENT(canplaythrough)
+EXPECTED (video1.paused == 'true') OK
+Begin playing first video.
+EVENT(playing)
+First video began playing.
+EXPECTED (video1.paused == 'false') OK
+
+Setting up second video.
+EVENT(canplaythrough)
+EXPECTED (video1.paused == 'false') OK
+EXPECTED (video2.paused == 'true') OK
+Begin playing second video.
+EVENT(playing)
+Second video began playing.
+EXPECTED (video2.paused == 'false') OK
+EVENT(pause)
+EXPECTED (video1.paused == 'true') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/session/content-session-focus.html (0 => 188346)
--- trunk/LayoutTests/media/session/content-session-focus.html (rev 0)
+++ trunk/LayoutTests/media/session/content-session-focus.html 2015-08-12 19:22:58 UTC (rev 188346)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+ <script type="text/_javascript_">
+ var session, video1, video2;
+
+ function runTest()
+ {
+ session = new MediaSession("content");
+
+ video1 = document.getElementById("video1");
+ waitForEvent('canplaythrough', beginPlayingVideo1, false, true, video1);
+ video1.src = "" "../content/counting");
+ video1.session = session;
+ waitForEvent('playing', beganPlayingVideo1, false, true, video1);
+ }
+
+ function beginPlayingVideo1(event)
+ {
+ testExpected('video1.paused', true);
+
+ consoleWrite("Begin playing first video.");
+ video1.play();
+ }
+
+ function beganPlayingVideo1(event)
+ {
+ consoleWrite("First video began playing.");
+ testExpected('video1.paused', false);
+
+ consoleWrite("");
+ consoleWrite("Setting up second video.");
+
+ video2 = document.getElementById("video2");
+ waitForEvent('canplaythrough', beginPlayingVideo2, false, true, video2);
+ video2.src = "" "../content/counting");
+ video2.session = session;
+ waitForEvent('playing', beganPlayingVideo2, false, true, video2);
+ }
+
+ function beginPlayingVideo2(event)
+ {
+ testExpected('video1.paused', false);
+ testExpected('video2.paused', true);
+ waitForEvent('pause', pausedVideo1, false, true, video1);
+
+ consoleWrite("Begin playing second video.");
+ video2.play();
+ }
+
+ function pausedVideo1(event)
+ {
+ testExpected('video1.paused', true);
+ endTest();
+ }
+
+ function beganPlayingVideo2(event)
+ {
+ consoleWrite("Second video began playing.");
+ testExpected('video2.paused', false);
+ }
+ </script>
+</head>
+<body _onload_="runTest()">
+ <p>Playing a media element belonging to a Content media session should pause other playing Content media elements.</p>
+ <video id="video1" />
+ <video id="video2" />
+</body>
+</html>