Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 ], | |
| 12 [ 1, true ], | |
| 13 [ 2, true ], | |
| 14 [ 3, true ], | |
| 15 [ 4, true ], | |
| 16 [ 5, true ], | |
| 17 [ 6, true ], | |
| 18 ]; | |
| 19 | |
| 20 var nextExpectation = 0; | |
| 21 | |
| 22 async_test(function(t) { | |
| 23 mediaSessionServiceMock.then(m => { | |
| 24 m.setEnableDisableActionCallback(t.step_func(function(action, isEnabled) { | |
| 25 var expectedAction = expectations[nextExpectation][0]; | |
| 26 var expectedIsEnabled = expectations[nextExpectation][1]; | |
| 27 assert_equals(expectedAction, action); | |
| 28 assert_equals(expectedIsEnabled, isEnabled); | |
| 29 if (++nextExpectation >= expectations.length) | |
| 30 t.done(); | |
| 31 })); | |
| 32 | |
| 33 // Unknown function should not be propagated. | |
| 34 window.navigator.mediaSession.onresize = _ => {}; | |
| 35 // MediaSession events should be propagated. | |
| 36 window.navigator.mediaSession.onplay = _ => {}; | |
| 37 window.navigator.mediaSession.onpause = _ => {}; | |
| 38 window.navigator.mediaSession.onplaypause = _ => {}; | |
| 39 window.navigator.mediaSession.onprevioustrack = _ => {}; | |
| 40 window.navigator.mediaSession.onnexttrack = _ => {}; | |
| 41 window.navigator.mediaSession.onseekforward = _ => {}; | |
| 42 window.navigator.mediaSession.onseekbackward = _ => {}; | |
| 43 }); | |
| 44 }, "test that setting event handler notifies the mojo service"); | |
|
whywhat
2016/10/18 21:02:57
what's the service of this test if the one above c
Zhiqiang Zhang (Slow)
2016/10/19 12:52:06
Merged all the three into one.
| |
| 45 | |
| 46 </script> | |
| OLD | NEW |