| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <!-- | 2 <!-- |
| 3 This test creates a data channel between two local PeerConnection instances | 3 This test creates a data channel between two local PeerConnection instances |
| 4 and ensures that an empty string sent by one is received by the second. | 4 and ensures that an empty string sent by one is received by the second. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | 9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 10 <title>RTCPeerConnection Data Channel Empty String Test</title> | 10 <title>RTCPeerConnection Data Channel Empty String Test</title> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 var receiveChannel = null; | 26 var receiveChannel = null; |
| 27 | 27 |
| 28 var onReceiveChannel = function (event) { | 28 var onReceiveChannel = function (event) { |
| 29 receiveChannel = event.channel; | 29 receiveChannel = event.channel; |
| 30 receiveChannel.onmessage = onReceiveMessage; | 30 receiveChannel.onmessage = onReceiveMessage; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 | 33 |
| 34 // When the data channel is open, send an empty string message | 34 // When the data channel is open, send an empty string message |
| 35 // followed by a message that contains the string "done". | 35 // followed by a message that contains the string "done". |
| 36 var onSendChannelOpen = function (event) { | 36 var onSendChannelOpen = test.step_func(function (event) { |
| 37 var msgEl = document.getElementById('msg'); | 37 var msgEl = document.getElementById('msg'); |
| 38 sendChannel.send(''); | 38 sendChannel.send(''); |
| 39 msgEl.innerHTML += 'Sent: [empty string]<br>'; | 39 msgEl.innerHTML += 'Sent: [empty string]<br>'; |
| 40 sendChannel.send('done'); | 40 sendChannel.send('done'); |
| 41 msgEl.innerHTML += 'Sent: "done"<br>'; | 41 msgEl.innerHTML += 'Sent: "done"<br>'; |
| 42 }; | 42 }); |
| 43 | 43 |
| 44 // Check the messages received on the other side. | 44 // Check the messages received on the other side. |
| 45 // There should be an empty string message followed by a message that | 45 // There should be an empty string message followed by a message that |
| 46 // contains the string "done". | 46 // contains the string "done". |
| 47 // Pass/Fail the test according to the messages received | 47 // Pass/Fail the test according to the messages received |
| 48 var emptyMessageReceived = false; | 48 var emptyMessageReceived = false; |
| 49 var onReceiveMessage = test.step_func(function (event) { | 49 var onReceiveMessage = test.step_func(function (event) { |
| 50 var msgEl = document.getElementById('msg'); | 50 var msgEl = document.getElementById('msg'); |
| 51 msgEl.innerHTML += 'Received: ' + | 51 msgEl.innerHTML += 'Received: ' + |
| 52 (event.data ? '"' + event.data + '"' : '[empty string]') + '<br>'; | 52 (event.data ? '"' + event.data + '"' : '[empty string]') + '<br>'; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 .then(exchangeDescription(gFirstConnection, gSecondConnection)) | 99 .then(exchangeDescription(gFirstConnection, gSecondConnection)) |
| 100 .catch(test.step_func(function(e) { | 100 .catch(test.step_func(function(e) { |
| 101 assert_unreached('Error ' + e.name + ': ' + e.message); | 101 assert_unreached('Error ' + e.name + ': ' + e.message); |
| 102 })); | 102 })); |
| 103 }); | 103 }); |
| 104 </script> | 104 </script> |
| 105 | 105 |
| 106 </body> | 106 </body> |
| 107 </html> | 107 </html> |
| 108 | 108 |
| OLD | NEW |