OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
4 <script type="text/javascript" src="webrtc_test_audio.js"></script> | 4 <script type="text/javascript" src="webrtc_test_audio.js"></script> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 $ = function(id) { | 6 $ = function(id) { |
7 return document.getElementById(id); | 7 return document.getElementById(id); |
8 }; | 8 }; |
9 | 9 |
10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) { | 10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) { |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 544 } |
545 // When all the above events have occurred- the test pass. | 545 // When all the above events have occurred- the test pass. |
546 setAllEventsOccuredHandler(reportTestSuccess); | 546 setAllEventsOccuredHandler(reportTestSuccess); |
547 | 547 |
548 localStream.addTrack(gLocalStream.getAudioTracks()[0]); | 548 localStream.addTrack(gLocalStream.getAudioTracks()[0]); |
549 localStream.removeTrack(localStream.getVideoTracks()[0]); | 549 localStream.removeTrack(localStream.getVideoTracks()[0]); |
550 negotiate(); | 550 negotiate(); |
551 }); | 551 }); |
552 } | 552 } |
553 | 553 |
| 554 // Loads this page inside itself using an iframe, and ensures we can make a |
| 555 // successful getUserMedia + peerconnection call inside the iframe. |
| 556 function callInsideIframe(constraints) { |
| 557 runInsideIframe(function(iframe) { |
| 558 // Run a regular webrtc call inside the iframe. |
| 559 iframe.contentWindow.call(constraints); |
| 560 }); |
| 561 } |
| 562 |
| 563 // Func should accept an iframe as its first argument. |
| 564 function runInsideIframe(func) { |
| 565 var iframe = document.createElement('iframe'); |
| 566 document.body.appendChild(iframe); |
| 567 iframe.onload = onIframeLoaded; |
| 568 iframe.src = window.location; |
| 569 |
| 570 function onIframeLoaded() { |
| 571 var iframe = window.document.querySelector('iframe'); |
| 572 |
| 573 // Propagate test success out of the iframe. |
| 574 iframe.contentWindow.setAllEventsOccuredHandler( |
| 575 window.parent.reportTestSuccess); |
| 576 |
| 577 func(iframe); |
| 578 } |
| 579 } |
| 580 |
554 // This function is used for setting up a test that: | 581 // This function is used for setting up a test that: |
555 // 1. Creates a data channel on |gFirstConnection| and sends data to | 582 // 1. Creates a data channel on |gFirstConnection| and sends data to |
556 // |gSecondConnection|. | 583 // |gSecondConnection|. |
557 // 2. When data is received on |gSecondConnection| a message | 584 // 2. When data is received on |gSecondConnection| a message |
558 // is sent to |gFirstConnection|. | 585 // is sent to |gFirstConnection|. |
559 // 3. When data is received on |gFirstConnection|, the data | 586 // 3. When data is received on |gFirstConnection|, the data |
560 // channel is closed. The test passes when the state transition completes. | 587 // channel is closed. The test passes when the state transition completes. |
561 function setupDataChannel(params) { | 588 function setupDataChannel(params) { |
562 var sendDataString = "send some text on a data channel." | 589 var sendDataString = "send some text on a data channel." |
563 firstDataChannel = gFirstConnection.createDataChannel( | 590 firstDataChannel = gFirstConnection.createDataChannel( |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 <td><canvas width="320" height="240" id="remote-view-2-canvas" | 956 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
930 style="display:none"></canvas></td> | 957 style="display:none"></canvas></td> |
931 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 958 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
932 style="display:none"></canvas></td> | 959 style="display:none"></canvas></td> |
933 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 960 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
934 style="display:none"></canvas></td> | 961 style="display:none"></canvas></td> |
935 </tr> | 962 </tr> |
936 </table> | 963 </table> |
937 </body> | 964 </body> |
938 </html> | 965 </html> |
OLD | NEW |