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

Side by Side Diff: third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-action-reaches-client.html

Issue 2497493005: Reordering MediaSessionAction seek backward/forward (Closed)
Patch Set: rebased Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>MediaSession Mojo Test</title> 2 <title>MediaSession Mojo Test</title>
3 <script src="../../../resources/testharness.js"></script> 3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="../../../resources/mojo-helpers.js"></script> 5 <script src="../../../resources/mojo-helpers.js"></script>
6 <script src="resources/mediasessionservice-mock.js"></script> 6 <script src="resources/mediasessionservice-mock.js"></script>
7 <script src="resources/utils.js"></script> 7 <script src="resources/utils.js"></script>
8 <script> 8 <script>
9 9
10 var mock; 10 var mock;
11 11
12 var expectations = [ 12 var expectations = [
13 "play", 13 "play",
14 "pause", 14 "pause",
15 "playpause", 15 "playpause",
16 "previoustrack", 16 "previoustrack",
17 "nexttrack", 17 "nexttrack",
18 "seekbackward",
18 "seekforward", 19 "seekforward",
19 "seekbackward",
20 ]; 20 ];
21 21
22 var nextExpectation = 0; 22 var nextExpectation = 0;
23 23
24 function checkExpectation(t, event) { 24 function checkExpectation(t, event) {
25 var expectedEvent = expectations[nextExpectation]; 25 var expectedEvent = expectations[nextExpectation];
26 assert_equals(expectedEvent, event.type); 26 assert_equals(expectedEvent, event.type);
27 if (++nextExpectation >= expectations.length) 27 if (++nextExpectation >= expectations.length)
28 t.done(); 28 t.done();
29 } 29 }
30 30
31 function runTests(t) { 31 function runTests(t) {
32 window.navigator.mediaSession.onplay = t.step_func(checkExpectation.bind(null, t)); 32 window.navigator.mediaSession.onplay = t.step_func(checkExpectation.bind(null, t));
33 window.navigator.mediaSession.onpause = t.step_func(checkExpectation.bind(null , t)); 33 window.navigator.mediaSession.onpause = t.step_func(checkExpectation.bind(null , t));
34 window.navigator.mediaSession.onplaypause = t.step_func(checkExpectation.bind( null, t)); 34 window.navigator.mediaSession.onplaypause = t.step_func(checkExpectation.bind( null, t));
35 window.navigator.mediaSession.onprevioustrack = t.step_func(checkExpectation.b ind(null, t)); 35 window.navigator.mediaSession.onprevioustrack = t.step_func(checkExpectation.b ind(null, t));
36 window.navigator.mediaSession.onnexttrack = t.step_func(checkExpectation.bind( null, t)); 36 window.navigator.mediaSession.onnexttrack = t.step_func(checkExpectation.bind( null, t));
37 window.navigator.mediaSession.onseekforward = t.step_func(checkExpectation.bin d(null, t)); 37 window.navigator.mediaSession.onseekforward = t.step_func(checkExpectation.bin d(null, t));
38 window.navigator.mediaSession.onseekbackward = t.step_func(checkExpectation.bi nd(null, t)); 38 window.navigator.mediaSession.onseekbackward = t.step_func(checkExpectation.bi nd(null, t));
39 39
40 mock.getClient().didReceiveAction(MOJOM_ACTION_PLAY); 40 mock.getClient().didReceiveAction(MediaSessionAction.PLAY);
41 mock.getClient().didReceiveAction(MOJOM_ACTION_PAUSE); 41 mock.getClient().didReceiveAction(MediaSessionAction.PAUSE);
42 mock.getClient().didReceiveAction(MOJOM_ACTION_PLAY_PAUSE); 42 mock.getClient().didReceiveAction(MediaSessionAction.PLAY_PAUSE);
43 mock.getClient().didReceiveAction(MOJOM_ACTION_PREVIOUS_TRACK); 43 mock.getClient().didReceiveAction(MediaSessionAction.PREVIOUS_TRACK);
44 mock.getClient().didReceiveAction(MOJOM_ACTION_NEXT_TRACK); 44 mock.getClient().didReceiveAction(MediaSessionAction.NEXT_TRACK);
45 mock.getClient().didReceiveAction(MOJOM_ACTION_SEEK_FORWARD); 45 mock.getClient().didReceiveAction(MediaSessionAction.SEEK_BACKWARD);
46 mock.getClient().didReceiveAction(MOJOM_ACTION_SEEK_BACKWARD); 46 mock.getClient().didReceiveAction(MediaSessionAction.SEEK_FORWARD);
47 } 47 }
48 48
49 // Use async_test to do asynchronous setup since setup() only works for 49 // Use async_test to do asynchronous setup since setup() only works for
50 // synchronous setup. 50 // synchronous setup.
51 async_test(function(t) { 51 async_test(function(t) {
52 mediaSessionServiceMock.then(m => { 52 mediaSessionServiceMock.then(m => {
53 mock = m; 53 mock = m;
54 mock.setClientCallback(t.step_func(runTests.bind(null, t))); 54 mock.setClientCallback(t.step_func(runTests.bind(null, t)));
55 // Touch window.navigator.mediaSession to start the service. 55 // Touch window.navigator.mediaSession to start the service.
56 window.navigator.mediaSession.metadata = null; 56 window.navigator.mediaSession.metadata = null;
57 }); 57 });
58 }, "test that the mock service is setup"); 58 }, "test that the mock service is setup");
59 59
60 </script> 60 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/mediasession/mojo/media-control-set-handler-notifies-service.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698