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

Side by Side Diff: third_party/WebKit/LayoutTests/media/remoteplayback/cancel-watch-availability.html

Issue 2415723002: [Blink, RemotePlayback] watchAvailability() implementation. (Closed)
Patch Set: Added layout test for callback gc 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Tests various ways to call cancelWatchAvailability()</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../media-file.js"></script>
8 </head>
9 <body>
10 <script>
11 var notFoundErrorException = new DOMException(
12 'A callback with the given id is not found.',
13 'NotFoundError');
14
15 async_test(function(t) {
16 var v = document.createElement('video');
17 v.src = findMediaFile('video', 'content/test');
18 document.body.appendChild(v);
19
20 v.remote.watchAvailability(function() {})
21 .then(t.step_func(function(id) {
22 v.remote.cancelWatchAvailability(id).then(t.step_func(fu nction() {
23 v.remote.cancelWatchAvailability(id).then(
24 t.unreached_func(), t.step_func_done(function(e) {
25 assert_equals(e.name, notFoundErrorException .name);
26 assert_equals(e.message, notFoundErrorExcept ion.message);
27 })
28 );
29 }),
30 t.unreached_func());
31 }),
32 t.unreached_func());
33 }, 'Test that calling cancelWatchAvailability() with an id does remo ve the callback.');
34
35 async_test(function(t) {
36 var v = document.createElement('video');
37 v.src = findMediaFile('video', 'content/test');
38 document.body.appendChild(v);
39
40 Promise.all([
41 v.remote.watchAvailability(function() {}),
42 v.remote.watchAvailability(function() {})
43 ]).then(t.step_func(function(ids) {
44 v.remote.cancelWatchAvailability().then(t.step_func(function () {
45 v.remote.cancelWatchAvailability(ids[0]).then(t.unreache d_func(), t.step_func(function(e) {
46 assert_equals(e.name, notFoundErrorException.name);
47 assert_equals(e.message, notFoundErrorException.mess age);
48 v.remote.cancelWatchAvailability(ids[1])
49 .then(t.unreached_func(), t.step_func_done(funct ion(e) {
50 assert_equals(e.name, notFoundErrorException .name);
51 assert_equals(e.message, notFoundErrorExcept ion.message);
52 }));
53 }));
54 }),
55 t.unreached_func());
56 }),
57 t.unreached_func());
58 }, 'Test that calling cancelWatchAvailability() without an id remove s all the callbacks.');
59 </script>
60 </body>
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698