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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer-promise.html

Issue 2077323003: Support legacy offerToReceiveAudio/offerToReceiveVideo fields in RTCOfferOptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>RTCPeerConnection.createOffer</title> 4 <title>RTCPeerConnection.createOffer</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 // Note: createOffer() calls in the test runner are successful if the 10 // Note: createOffer() calls in the test runner are successful if the
11 // voiceActivityDetection and iceRestart options are passed with a value 11 // voiceActivityDetection and iceRestart options are passed with a value
12 // of true. In all other cases, createOffer() fails in the test runner. 12 // of true and offerToReceiveAudio and offerToReceiveVideo are passed with
13 // a positive value. In all other cases, createOffer() fails in the test
14 // runner.
13 15
14 defaultError = new DOMException('TEST_ERROR', 'OperationError') 16 defaultError = new DOMException('TEST_ERROR', 'OperationError')
15 pc = new webkitRTCPeerConnection(null); 17 pc = new webkitRTCPeerConnection(null);
16 18
17 // Test that creating an offer with voiceActivityDetection and iceRestart 19 // Test that creating an offer with voiceActivityDetection, iceRestart,
18 // returns an accepted promise. 20 // offerToReceiveAudio and offerToReceiveVideo returns an accepted promise .
19 promise_test(function() { 21 promise_test(function() {
20 return pc.createOffer({voiceActivityDetection:true, iceRestart:true}) 22 return pc.createOffer({voiceActivityDetection:true, iceRestart:true, off erToReceiveAudio:1, offerToReceiveVideo:1})
21 }, 'createOffer({voiceActivityDetection:true, iceRestart:true})'); 23 }, 'createOffer({voiceActivityDetection:true, iceRestart:true})');
22 24
23 // Test that only setting iceRestart to true results in an accepted 25 // Test that not explicitly setting voiceActivityDetection results in an
24 // promise, since the default value for voiceActivityDetection is true 26 // accepted promise, since the default value for voiceActivityDetection
27 // is true.
25 promise_test(function() { 28 promise_test(function() {
26 return pc.createOffer({voiceActivityDetection:true, iceRestart:true}) 29 return pc.createOffer({iceRestart:true, offerToReceiveAudio:1, offerToRe ceiveVideo:1})
27 }, 'createOffer({iceRestart:true})'); 30 }, 'createOffer({iceRestart:true})');
28 31
29 // Test that the other combinations return a rejected promise 32 // Test that other combinations return a rejected promise.
33 promise_test(function() {
34 return promise_rejects(this, defaultError,
35 pc.createOffer({voiceActivityDetection:true, iceRestart:true}));
36 }, 'createOffer({voiceActivityDetection:false, iceRestart:false})' );
37
38 promise_test(function() {
39 return promise_rejects(this, defaultError,
40 pc.createOffer({voiceActivityDetection:true, iceRestart:true, offerToR eceiveAudio:0, offerToReceiveVideo: 0}));
foolip 2016/06/20 13:59:05 An extra space here if you need to make another ch
41 }, 'createOffer({voiceActivityDetection:false, iceRestart:false})' );
42
30 promise_test(function() { 43 promise_test(function() {
31 return promise_rejects(this, defaultError, 44 return promise_rejects(this, defaultError,
32 pc.createOffer({voiceActivityDetection:false, iceRestart:false})); 45 pc.createOffer({voiceActivityDetection:false, iceRestart:false}));
33 }, 'createOffer({voiceActivityDetection:false, iceRestart:false})' ); 46 }, 'createOffer({voiceActivityDetection:false, iceRestart:false})' );
34 47
35 promise_test(function() { 48 promise_test(function() {
36 return promise_rejects(this, defaultError, 49 return promise_rejects(this, defaultError,
37 pc.createOffer({voiceActivityDetection:false, iceRestart:true})); 50 pc.createOffer({voiceActivityDetection:false, iceRestart:true}));
38 }, 'createOffer({voiceActivityDetection:false, iceRestart:true})' ); 51 }, 'createOffer({voiceActivityDetection:false, iceRestart:true})' );
39 52
(...skipping 18 matching lines...) Expand all
58 // Test closed connection 71 // Test closed connection
59 closedPC = new webkitRTCPeerConnection(null); 72 closedPC = new webkitRTCPeerConnection(null);
60 closedPC.close(); 73 closedPC.close();
61 promise_test(function() { 74 promise_test(function() {
62 var invalidStateError = new DOMException('', 'InvalidStateError'); 75 var invalidStateError = new DOMException('', 'InvalidStateError');
63 return promise_rejects(this, invalidStateError, closedPC.createOffer({ic eRestart:true})); 76 return promise_rejects(this, invalidStateError, closedPC.createOffer({ic eRestart:true}));
64 }, 'createOffer() with closed peer connection' ); 77 }, 'createOffer() with closed peer connection' );
65 </script> 78 </script>
66 </body> 79 </body>
67 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698