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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/media/audio_output_devices/setsinkid.html

Issue 1416123005: Implement setSinkId() for media elements without src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More jochen's comments Created 5 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Audio Output Devices</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 // Tests that the API is available.
11 test(function() {
12 var audio = document.createElement('audio');
13 assert_not_equals(audio, null);
14 assert_idl_attribute(audio, 'setSinkId');
15 assert_equals(typeof audio.setSinkId, 'function');
16 assert_idl_attribute(audio, 'sinkId');
17 assert_equals(audio.sinkId, '');
18 }, 'Basic API test');
19
20 // Tests that setting the sink to the default device on an element with sr c succeeds.
21 promise_test(function() {
22 var audio = document.createElement('audio');
23 audio.src = '../resources/media-source/webm/test-a-128k-44100Hz-1ch.webm ';
24 return audio.setSinkId('')
25 }, 'setSinkId("")');
26
27 // Test that setting the sink on an element without src succeeds.
28 promise_test(function() {
29 var audio = document.createElement('audio');
30 return audio.setSinkId('');
31 }, 'empty src setSinkId("")');
32
33 // Tests that setting the sink to a valid device without permission fails.
34 // Note: 'default' is the hashed name Chromium always provides for the def ault device.
35 // It is treated like any other hashed device ID, so it is not automatical ly authorized like ''.
36 promise_test(function() {
37 var audio = document.createElement('audio');
38 return promise_rejects(this, 'SecurityError', audio.setSinkId('default') );
39 }, 'setSinkId("default") without permission' );
40
41 // Test that setting the sink to an invalid device fails
42 promise_test(function() {
43 var audio = document.createElement('audio');
44 return promise_rejects(this, 'NotFoundError', audio.setSinkId('invalid') );
45 }, 'setSinkId("invalid")');
46
47 // Tests that setting the sink to the default device a second time succeed s
48 promise_test(function() {
49 var audio = document.createElement('audio');
50 audio.setSinkId('')
51 .then(function() {
52 return audio.setSinkId('');
53 }).catch(function() {
54 assert_unreached('setSinkId() should have succeeded.');
55 });
56 }, 'setSinkId("") twice.');
57
58 // Test that changing the src of an element with a previous src and settin g the sink
59 // in both cases succeeds.
60 promise_test(function() {
61 var audio = document.createElement('audio');
62 audio.src = '../resources/media-source/webm/test-a-128k-44100Hz-1ch.webm '
63 audio.setSinkId('')
64 .then(function() {
65 audio.src = '../resources/media-source/webm/test-a-192k-44100Hz-1ch. webm'
66 return audio.setSinkId('');
67 }).catch(function() {
68 assert_unreached('setSinkId() should have succeeded.');
69 });
70 }, 'change src setSinkId("").');
71
72 </script>
73 </body>
74 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698