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

Unified Diff: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-unset-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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-unset-handler-notifies-service.html
diff --git a/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-unset-handler-notifies-service.html b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-unset-handler-notifies-service.html
new file mode 100644
index 0000000000000000000000000000000000000000..1ed93f89b38337d75114cff7742ae491d2b29c85
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-unset-handler-notifies-service.html
@@ -0,0 +1,64 @@
+<!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 ],
+ [ 0, false ],
+ [ 1, false ],
+ [ 2, false ],
+ [ 3, false ],
+ [ 4, false ],
+ [ 5, false ],
+ [ 6, false ],
+];
+
+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 = null;
+ // MediaSession events should be propagated.
+ window.navigator.mediaSession.onplay = null;
+ window.navigator.mediaSession.onpause = null;
+ window.navigator.mediaSession.onplaypause = null;
+ window.navigator.mediaSession.onprevioustrack = null;
+ window.navigator.mediaSession.onnexttrack = null;
+ window.navigator.mediaSession.onseekforward = null;
+ window.navigator.mediaSession.onseekbackward = null;
+ });
+}, "test that setting event handler notifies the mojo service");
whywhat 2016/10/18 21:02:57 I think you should only leave this one.
Zhiqiang Zhang (Slow) 2016/10/19 12:52:06 Merged all three into one.
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698