Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-reset-handler-notifies-service.html | 
| diff --git a/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-reset-handler-notifies-service.html b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-reset-handler-notifies-service.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..79b00ead13b4bdec8c47de8b7deb06f386e68230 | 
| --- /dev/null | 
| +++ b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-reset-handler-notifies-service.html | 
| @@ -0,0 +1,71 @@ | 
| +<!DOCTYPE html> | 
| +<title>MediaSession Mojo Test</title> | 
| +<script src="../../../resources/testharness.js"></script> | 
| +<script src="../../../resources/testharnessreport.js"></script> | 
| +<script src="../../../resources/mojo-helpers.js"></script> | 
| +<script src="resources/mediasessionservice-mock.js"></script> | 
| +<script src="resources/utils.js"></script> | 
| +<script> | 
| + | 
| +var expectations = [ | 
| + [ 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.
 
 | 
| + [ 1, true ], | 
| + [ 2, true ], | 
| + [ 3, true ], | 
| + [ 4, true ], | 
| + [ 5, true ], | 
| + [ 6, true ], | 
| + [ 0, false ], | 
| + [ 0, true ], | 
| + [ 1, false ], | 
| + [ 1, true ], | 
| + [ 2, false ], | 
| + [ 2, true ], | 
| + [ 3, false ], | 
| + [ 3, true ], | 
| + [ 4, false ], | 
| + [ 4, true ], | 
| + [ 5, false ], | 
| + [ 5, true ], | 
| + [ 6, false ], | 
| + [ 6, true ], | 
| +]; | 
| + | 
| +var nextExpectation = 0; | 
| + | 
| +async_test(function(t) { | 
| + mediaSessionServiceMock.then(m => { | 
| + m.setEnableDisableActionCallback(t.step_func(function(action, isEnabled) { | 
| + var expectedAction = expectations[nextExpectation][0]; | 
| + var expectedIsEnabled = expectations[nextExpectation][1]; | 
| + assert_equals(expectedAction, action); | 
| + assert_equals(expectedIsEnabled, isEnabled); | 
| + if (++nextExpectation >= expectations.length) | 
| + t.done(); | 
| + })); | 
| + | 
| + // Unknown function should not be propagated. | 
| + window.navigator.mediaSession.onresize = _ => {}; | 
| + // MediaSession events should be propagated. | 
| + window.navigator.mediaSession.onplay = _ => {}; | 
| + window.navigator.mediaSession.onpause = _ => {}; | 
| + window.navigator.mediaSession.onplaypause = _ => {}; | 
| + window.navigator.mediaSession.onprevioustrack = _ => {}; | 
| + window.navigator.mediaSession.onnexttrack = _ => {}; | 
| + window.navigator.mediaSession.onseekforward = _ => {}; | 
| + window.navigator.mediaSession.onseekbackward = _ => {}; | 
| + | 
| + // Unknown function should not be propagated. | 
| + window.navigator.mediaSession.onresize = _ => {}; | 
| 
 
whywhat
2016/10/18 21:02:57
maybe set them to null instead?
 
 | 
| + // MediaSession events should be propagated. | 
| + window.navigator.mediaSession.onplay = _ => {}; | 
| + window.navigator.mediaSession.onpause = _ => {}; | 
| + window.navigator.mediaSession.onplaypause = _ => {}; | 
| + window.navigator.mediaSession.onprevioustrack = _ => {}; | 
| + window.navigator.mediaSession.onnexttrack = _ => {}; | 
| + window.navigator.mediaSession.onseekforward = _ => {}; | 
| + window.navigator.mediaSession.onseekbackward = _ => {}; | 
| + }); | 
| +}, "test that setting event handler notifies the mojo service"); | 
| + | 
| +</script> |