Index: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html |
diff --git a/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e155b85e674f3ac38491a8509b0ae9f8ab02eb56 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html |
@@ -0,0 +1,46 @@ |
+<!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 ], |
+ [ 1, true ], |
+ [ 2, true ], |
+ [ 3, true ], |
+ [ 4, true ], |
+ [ 5, true ], |
+ [ 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 = _ => {}; |
+ }); |
+}, "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.
|
+ |
+</script> |