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

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

Issue 2426653002: Adding mojo MediaSessionClient to support media controls (Closed)
Patch Set: Addressed haraken's comments 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 [ 0, true ],
whywhat 2016/10/18 21:02:57 nit: you could define constants for 0-6 to make it
Zhiqiang Zhang (Slow) 2016/10/19 12:52:06 Done.
12 [ 1, true ],
13 [ 2, true ],
14 [ 3, true ],
15 [ 4, true ],
16 [ 5, true ],
17 [ 6, true ],
18 [ 0, false ],
19 [ 0, true ],
20 [ 1, false ],
21 [ 1, true ],
22 [ 2, false ],
23 [ 2, true ],
24 [ 3, false ],
25 [ 3, true ],
26 [ 4, false ],
27 [ 4, true ],
28 [ 5, false ],
29 [ 5, true ],
30 [ 6, false ],
31 [ 6, true ],
32 ];
33
34 var nextExpectation = 0;
35
36 async_test(function(t) {
37 mediaSessionServiceMock.then(m => {
38 m.setEnableDisableActionCallback(t.step_func(function(action, isEnabled) {
39 var expectedAction = expectations[nextExpectation][0];
40 var expectedIsEnabled = expectations[nextExpectation][1];
41 assert_equals(expectedAction, action);
42 assert_equals(expectedIsEnabled, isEnabled);
43 if (++nextExpectation >= expectations.length)
44 t.done();
45 }));
46
47 // Unknown function should not be propagated.
48 window.navigator.mediaSession.onresize = _ => {};
49 // MediaSession events should be propagated.
50 window.navigator.mediaSession.onplay = _ => {};
51 window.navigator.mediaSession.onpause = _ => {};
52 window.navigator.mediaSession.onplaypause = _ => {};
53 window.navigator.mediaSession.onprevioustrack = _ => {};
54 window.navigator.mediaSession.onnexttrack = _ => {};
55 window.navigator.mediaSession.onseekforward = _ => {};
56 window.navigator.mediaSession.onseekbackward = _ => {};
57
58 // Unknown function should not be propagated.
59 window.navigator.mediaSession.onresize = _ => {};
whywhat 2016/10/18 21:02:57 maybe set them to null instead?
60 // MediaSession events should be propagated.
61 window.navigator.mediaSession.onplay = _ => {};
62 window.navigator.mediaSession.onpause = _ => {};
63 window.navigator.mediaSession.onplaypause = _ => {};
64 window.navigator.mediaSession.onprevioustrack = _ => {};
65 window.navigator.mediaSession.onnexttrack = _ => {};
66 window.navigator.mediaSession.onseekforward = _ => {};
67 window.navigator.mediaSession.onseekbackward = _ => {};
68 });
69 }, "test that setting event handler notifies the mojo service");
70
71 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698