Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html

Issue 2426653002: Adding mojo MediaSessionClient to support media controls (Closed)
Patch Set: Still rough, depends on "blink media controls" CL Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>MediaSession Mojo Test</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="../../../resources/mojo-helpers.js"></script>
6 <script src="resources/mediasessionservice-mock.js"></script>
7 <script src="resources/utils.js"></script>
8 <script>
9
10 var expectations = [
11 [ "play", true ],
12 [ "pause", false ],
13 [ "playpause", true ],
14 [ "previoustrack", false ],
15 [ "nexttrack", true ],
16 [ "seekforward", false ],
17 [ "seekbackward", true ],
18 ];
19
20 var nextExpectation = 0;
21
22 async_test(function(t) {
23 mediaSessionServiceMock.then(m => {
24 m.setEventHandlerCallback(t.step_func(function(action, is_set) {
25 var expectedAction = expectations[nextExpectation][0];
26 var expectedFlag = expectations[nextExpectation][1];
27
28 assert_equals(expectedAction, action);
29 assert_equals(expectedFlag, is_set);
30 if (++nextExpectation >= expectations.length)
31 t.done();
32 }));
33
34 // Unknown function should not be propagated.
35 window.navigator.mediaSession.onresize = _ => {};
36 // MediaSession events should be propagated.
37 window.navigator.mediaSession.onplay = _ => {};
38 window.navigator.mediaSession.onpause = null;
39 window.navigator.mediaSession.onplaypause = _ => {};
40 window.navigator.mediaSession.onprevioustrack = null;
41 window.navigator.mediaSession.onnexttrack = _ => {};
42 window.navigator.mediaSession.onseekforward = null;
43 window.navigator.mediaSession.onseekbackward = _ => {};
44 });
45 }, "test that setting event handler notifies the mojo service");
46
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698