Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial test for sending/receiving data for RTCDataChannel #6215

Merged
merged 5 commits into from Jun 13, 2017

Conversation

soareschen
Copy link
Contributor

@soareschen soareschen commented Jun 12, 2017

This adds basic testing for sending / receiving messages between two data channels. It has a common commit with #6186 that make use of helper functions to connect between two peer connections.

For now the code only test on sending a few short messages without considering the cases for low buffered amount. It also doesn't test on closing the data channel, which will be tested in separate file.

@soareschen
Copy link
Contributor Author

Most of the tests are straightforward, other than I am not very sure of the behavior for the bufferedAmount attribute. From the spec it seems to suggest that the actual sending of data is asynchronous, and bufferredAmount is increased by send() and should never be synchronously decreased by the underlying data transport returning from send().

The bufferedAmount attribute must return the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but that, as of the last time the event loop started executing a task, had not yet been transmitted to the network. (This thus includes any text sent during the execution of the current task, regardless of whether the user agent is able to transmit text asynchronously with script execution.) This does not include framing overhead incurred by the protocol, or buffering done by the operating system or network hardware. If the channel is closed, this attribute's value will only increase with each call to the send() method (the attribute does not reset to zero once the channel closes).

When testing bufferedAmount, current browsers fail with the amount always set to 0 regardless of how much data is passed to send(). I am not sure if this is because synchronous sending is allowed by the spec and the connection is local, so everything is sent without buffering.

The current assumption for the test is that the earlier interpretation is correct, and the tests fail on current browser because synchronous sending is not allowed. Please correct me if I misunderstood anything.

@w3c-bots
Copy link

w3c-bots commented Jun 12, 2017

View the complete job log.

Firefox (nightly)

Testing web-platform-tests at revision 384256d
Using browser at version BuildID 20170612100241; SourceStamp 27cad9749cddf68e11fdd4e5d73dad84a8f8cf23
Starting 10 test iterations
All results were stable

All results

8 tests ran
/webrtc/RTCDataChannel-bufferedAmount.html
Subtest Results Messages
OK
bufferedAmount should increase to byte length of encoded unicode string sent FAIL assert_equals: Expect bufferedAmount to be the byte length of the unicode string expected 12 but got 0
bufferedAmount should increase to byte length of buffer sent FAIL assert_equals: Expect bufferedAmount to increase to byte length of sent buffer expected 5 but got 0
bufferedAmount should increase to size of blob sent FAIL assert_equals: Expect bufferedAmount to increase to size of sent blob expected 5 but got 0
bufferedAmount should increase by byte length for each message sent FAIL assert_unreached: Unexpected promise rejection: Error: assert_equals: Expect bufferedAmount to be the total length of all messages queued to send expected 5 but got 0 Reached unreachable code
/webrtc/RTCDataChannel-send.html
Subtest Results Messages
OK
Calling send() when data channel is in connecting state should throw InvalidStateError PASS
Data channel should be able to send simple string and receive as string PASS
Data channel should be able to send unicode string and receive as unicode string PASS
Data channel should ignore binaryType and always receive string message as string PASS
Data channel should be able to send Uint8Array message and receive as ArrayBuffer PASS
Data channel should be able to send ArrayBuffer message and receive as ArrayBuffer PASS
Data channel should be able to send Blob message and receive as ArrayBuffer PASS
Data channel should be able to send ArrayBuffer message and receive as Blob PASS
Data channel binaryType should receive message as Blob by default PASS
Sending multiple messages with different types should succeed and be received PASS
/webrtc/RTCPeerConnection-createAnswer.html
Subtest Results Messages
OK
createAnswer() with null remoteDescription should reject with InvalidStateError PASS
createAnswer() after setting remote description should succeed PASS
createAnswer() when connection is closed reject with InvalidStateError PASS
createAnswer() when connection is closed in parallel should never resolve PASS
/webrtc/RTCPeerConnection-createOffer.html
Subtest Results Messages
OK
createOffer() with no argument from newly created RTCPeerConnection should succeed FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
createOffer() and then setLocalDescription() should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
createOffer() after connection is closed should reject with InvalidStateError PASS
createOffer() when connection is closed halfway should never resolve PASS
When media stream is added when createOffer() is running in parallel, the result offer should contain the new media stream FAIL pc.addTransceiver is not a function
createOffer() with offerToReceiveAudio should add audio line to all subsequent created offers FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
createOffer() with offerToReceiveVideo should add video line to all subsequent created offers FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
createOffer() with offerToReceiveAudio:true then offerToReceiveVideo:true should have result offer with both audio and video line FAIL assert_equals: Expect audio line to remain in created offer expected 1 but got 0
Test onsignalingstatechange event for createOffer() and then setLocalDescription() should succeed PASS
/webrtc/RTCPeerConnection-ondatachannel.html
Subtest Results Messages
OK
datachannel event should fire when new data channel is announced to the remote peer FAIL RTCDataChannel is not defined
Data channel created on remote peer should match the same configuration as local peer FAIL assert_equals: expected (number) 1 but got (undefined) undefined
Data channel created with negotiated set to true should not fire datachannel event on remote peer PASS
/webrtc/RTCPeerConnection-setLocalDescription.html
Subtest Results Messages
OK
setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError FAIL assert_throws: function "function() { throw e }" threw object "InvalidStateError: Calling SetLocal without first calling CreateOffer/Answer is not supported." that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
Set created offer other than last offer should reject with InvalidModificationError FAIL assert_throws: function "function() { throw e }" threw object "InvalidSessionDescriptionError: Changing the media-type of m-sections is not allowed" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
Creating and setting offer multiple times should succeed FAIL promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create offer in state have-local-offer"
setLocalDescription(offer) should never resolve if connection is closed in parallel FAIL assert_unreached: Pending promise should never be resolved. Instead it is rejected with: InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel. Reached unreachable code
setLocalDescription() with valid answer should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer FAIL promise_test: Unhandled rejection with value: object "InvalidParameterError: Empty or null SDP provided to setLocalDescription"
setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError FAIL assert_throws: function "function() { throw e }" threw object "InvalidStateError: Calling SetLocal without first calling CreateOffer/Answer is not supported." that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
Calling createOffer() and setLocalDescription() again after one round of local-offer/remote-answer should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
Switching role from answerer to offerer after going back to stable state should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
Calling setLocalDescription(answer) from stable state should reject with InvalidStateError FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidStateError FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
Test onsignalingstatechange event for Creating and setting offer multiple times should succeed PASS
Test onsignalingstatechange event for setLocalDescription() with valid answer should succeed PASS
Test onsignalingstatechange event for Calling createOffer() and setLocalDescription() again after one round of local-offer/remote-answer should succeed PASS
Test onsignalingstatechange event for Switching role from answerer to offerer after going back to stable state should succeed PASS
/webrtc/RTCPeerConnection-setRemoteDescription.html
Subtest Results Messages
TIMEOUT
setRemoteDescription with valid offer should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
Setting remote description multiple times with different offer should succeed FAIL promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot set remote offer or answer in current state have-remote-offer"
setRemoteDescription(offer) should never resolve if connection is closed in parallel FAIL assert_unreached: Pending promise should never be resolved. Instead it is rejected with: InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel. Reached unreachable code
setRemoteDescription(offer) with invalid SDP should reject with RTCError FAIL assert_equals: Expect error detail field to set to sdp-syntax-error expected (string) "sdp-syntax-error" but got (undefined) undefined
setRemoteDescription with invalid type and invalid SDP should reject with TypeError PASS
setRemoteDescription() with invalid SDP and stable state should reject with InvalidStateError PASS
setRemoteDescription() with valid state and answer should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
Calling setRemoteDescription() again after one round of remote-offer/local-answer should succeed FAIL promise_test: Unhandled rejection with value: object "InvalidSessionDescriptionError: Remote description changes the media type of m-line 0"
Switching role from offerer to answerer after going back to stable state should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
Calling setRemoteDescription(offer) from have-local-offer state should reject with InvalidStateError FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError FAIL promise_test: Unhandled rejection with value: object "InternalError: Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
setRemoteDescription should trigger ontrack event when the MSID of the stream is is parsed. FAIL assert_own_property: Expect pc to have ontrack event handler attribute expected property "ontrack" missing
Test onsignalingstatechange event for setRemoteDescription with valid offer should succeed PASS
Test onsignalingstatechange event for Setting remote description multiple times with different offer should succeed PASS
Test onsignalingstatechange event for setRemoteDescription() with valid state and answer should succeed PASS
Test onsignalingstatechange event for Calling setRemoteDescription() again after one round of remote-offer/local-answer should succeed TIMEOUT Test timed out
Test onsignalingstatechange event for Switching role from offerer to answerer after going back to stable state should succeed PASS
/webrtc/RTCSctpTransport-constructor.html
Subtest Results Messages
OK
setRemoteDescription() with answer containing data media should initialize pc.sctp FAIL assert_equals: expected (object) null but got (undefined) undefined
setLocalDescription() with answer containing data media should initialize pc.sctp FAIL assert_equals: expected (object) null but got (undefined) undefined

@w3c-bots
Copy link

w3c-bots commented Jun 12, 2017

View the complete job log.

Sauce (safari)

Testing web-platform-tests at revision 384256d
Using browser at version 10.0
Starting 10 test iterations
All results were stable

All results

8 tests ran
/webrtc/RTCDataChannel-bufferedAmount.html
Subtest Results Messages
OK
bufferedAmount should increase to byte length of encoded unicode string sent FAIL Can't find variable: RTCPeerConnection
bufferedAmount should increase to byte length of buffer sent FAIL Can't find variable: RTCPeerConnection
bufferedAmount should increase to size of blob sent FAIL Can't find variable: RTCPeerConnection
bufferedAmount should increase by byte length for each message sent FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCDataChannel-send.html
Subtest Results Messages
OK
Calling send() when data channel is in connecting state should throw InvalidStateError FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send simple string and receive as string FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send unicode string and receive as unicode string FAIL Can't find variable: RTCPeerConnection
Data channel should ignore binaryType and always receive string message as string FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send Uint8Array message and receive as ArrayBuffer FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send ArrayBuffer message and receive as ArrayBuffer FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send Blob message and receive as ArrayBuffer FAIL Can't find variable: RTCPeerConnection
Data channel should be able to send ArrayBuffer message and receive as Blob FAIL Can't find variable: RTCPeerConnection
Data channel binaryType should receive message as Blob by default FAIL Can't find variable: RTCPeerConnection
Sending multiple messages with different types should succeed and be received FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCPeerConnection-createAnswer.html
Subtest Results Messages
OK
createAnswer() with null remoteDescription should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
createAnswer() after setting remote description should succeed FAIL Can't find variable: RTCPeerConnection
createAnswer() when connection is closed reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
createAnswer() when connection is closed in parallel should never resolve FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCPeerConnection-createOffer.html
Subtest Results Messages
OK
createOffer() with no argument from newly created RTCPeerConnection should succeed FAIL Can't find variable: RTCPeerConnection
createOffer() and then setLocalDescription() should succeed FAIL Can't find variable: RTCPeerConnection
createOffer() after connection is closed should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
createOffer() when connection is closed halfway should never resolve FAIL Can't find variable: RTCPeerConnection
When media stream is added when createOffer() is running in parallel, the result offer should contain the new media stream FAIL Can't find variable: RTCPeerConnection
createOffer() with offerToReceiveAudio should add audio line to all subsequent created offers FAIL Can't find variable: RTCPeerConnection
createOffer() with offerToReceiveVideo should add video line to all subsequent created offers FAIL Can't find variable: RTCPeerConnection
createOffer() with offerToReceiveAudio:true then offerToReceiveVideo:true should have result offer with both audio and video line FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCPeerConnection-ondatachannel.html
Subtest Results Messages
OK
datachannel event should fire when new data channel is announced to the remote peer FAIL Can't find variable: RTCPeerConnection
Data channel created on remote peer should match the same configuration as local peer FAIL Can't find variable: RTCPeerConnection
Data channel created with negotiated set to true should not fire datachannel event on remote peer FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCPeerConnection-setLocalDescription.html
Subtest Results Messages
OK
setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer FAIL Can't find variable: RTCPeerConnection
setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError FAIL Can't find variable: RTCPeerConnection
Set created offer other than last offer should reject with InvalidModificationError FAIL Can't find variable: RTCPeerConnection
Creating and setting offer multiple times should succeed FAIL Can't find variable: RTCPeerConnection
setLocalDescription(offer) should never resolve if connection is closed in parallel FAIL Can't find variable: RTCPeerConnection
setLocalDescription() with valid answer should succeed FAIL Can't find variable: RTCPeerConnection
setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer FAIL Can't find variable: RTCPeerConnection
setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError FAIL Can't find variable: RTCPeerConnection
Calling createOffer() and setLocalDescription() again after one round of local-offer/remote-answer should succeed FAIL Can't find variable: RTCPeerConnection
Switching role from answerer to offerer after going back to stable state should succeed FAIL Can't find variable: RTCPeerConnection
Calling setLocalDescription(answer) from stable state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCPeerConnection-setRemoteDescription.html
Subtest Results Messages
OK
setRemoteDescription with valid offer should succeed FAIL Can't find variable: RTCPeerConnection
Setting remote description multiple times with different offer should succeed FAIL Can't find variable: RTCPeerConnection
setRemoteDescription(offer) should never resolve if connection is closed in parallel FAIL Can't find variable: RTCPeerConnection
setRemoteDescription(offer) with invalid SDP should reject with RTCError FAIL Can't find variable: RTCPeerConnection
setRemoteDescription with invalid type and invalid SDP should reject with TypeError FAIL Can't find variable: RTCPeerConnection
setRemoteDescription() with invalid SDP and stable state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
setRemoteDescription() with valid state and answer should succeed FAIL Can't find variable: RTCPeerConnection
Calling setRemoteDescription() again after one round of remote-offer/local-answer should succeed FAIL Can't find variable: RTCPeerConnection
Switching role from offerer to answerer after going back to stable state should succeed FAIL Can't find variable: RTCPeerConnection
Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
Calling setRemoteDescription(offer) from have-local-offer state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError FAIL Can't find variable: RTCPeerConnection
setRemoteDescription should trigger ontrack event when the MSID of the stream is is parsed. FAIL Can't find variable: RTCPeerConnection
/webrtc/RTCSctpTransport-constructor.html
Subtest Results Messages
OK
setRemoteDescription() with answer containing data media should initialize pc.sctp FAIL Can't find variable: RTCPeerConnection
setLocalDescription() with answer containing data media should initialize pc.sctp FAIL Can't find variable: RTCPeerConnection

@w3c-bots
Copy link

w3c-bots commented Jun 12, 2017

*This report has been truncated because the total content is 124951 characters in length, which is in excess of GitHub.com's limit for comments (65536 characters).

View the complete job log.

Chrome (unstable)

Testing web-platform-tests at revision 384256d
Using browser at version 61.0.3124.4 dev
Starting 10 test iterations
All results were stable

All results

8 tests ran
/webrtc/RTCDataChannel-bufferedAmount.html
Subtest Results Messages
OK
bufferedAmount should increase to byte length of encoded unicode string sent FAIL assert_equals: Expect bufferedAmount to be the byte length of the unicode string expected 12 but got 0
bufferedAmount should increase to byte length of buffer sent FAIL assert_equals: Expect bufferedAmount to increase to byte length of sent buffer expected 5 but got 0
bufferedAmount should increase to size of blob sent FAIL promise_test: Unhandled rejection with value: object "NotSupportedError: Failed to execute 'send' on 'RTCDataChannel': Blob support not implemented yet"
bufferedAmount should increase by byte length for each message sent FAIL assert_unreached: Unexpected promise rejection: Error: assert_equals: Expect bufferedAmount to be the total length of all messages queued to send expected 5 but got 0 Reached unreachable code
/webrtc/RTCDataChannel-send.html
Subtest Results Messages
OK
Calling send() when data channel is in connecting state should throw InvalidStateError PASS
Data channel should be able to send simple string and receive as string PASS
Data channel should be able to send unicode string and receive as unicode string PASS
Data channel should ignore binaryType and always receive string message as string PASS
Data channel should be able to send Uint8Array message and receive as ArrayBuffer PASS
Data channel should be able to send ArrayBuffer message and receive as ArrayBuffer PASS
Data channel should be able to send Blob message and receive as ArrayBuffer FAIL promise_test: Unhandled rejection with value: object "NotSupportedError: Failed to execute 'send' on 'RTCDataChannel': Blob support not implemented yet"
Data channel should be able to send ArrayBuffer message and receive as Blob FAIL promise_test: Unhandled rejection with value: object "NotSupportedError: Failed to set the 'binaryType' property on 'RTCDataChannel': Blob support not implemented yet"
Data channel binaryType should receive message as Blob by default FAIL assert_equals: Expect initial binaryType value to be blob expected "blob" but got "arraybuffer"
Sending multiple messages with different types should succeed and be received FAIL assert_unreached: Unexpected promise rejection: NotSupportedError: Failed to execute 'send' on 'RTCDataChannel': Blob support not implemented yet Reached unreachable code
/webrtc/RTCPeerConnection-createAnswer.html
Subtest Results Messages
OK
createAnswer() with null remoteDescription should reject with InvalidStateError FAIL assert_throws: function "function () { throw e }" threw object "OperationError: CreateAnswer can't be called before SetRemoteDescription." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
createAnswer() after setting remote description should succeed FAIL assert_false: Expect answer to not be instance of RTCSessionDescription expected false got true
createAnswer() when connection is closed reject with InvalidStateError PASS
createAnswer() when connection is closed in parallel should never resolve PASS
/webrtc/RTCPeerConnection-createOffer.html
Subtest Results Messages
OK
createOffer() with no argument from newly created RTCPeerConnection should succeed FAIL assert_false: Expect offer to not be instance of RTCSessionDescription expected false got true
createOffer() and then setLocalDescription() should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
createOffer() after connection is closed should reject with InvalidStateError PASS
createOffer() when connection is closed halfway should never resolve PASS
When media stream is added when createOffer() is running in parallel, the result offer should contain the new media stream FAIL pc.addTransceiver is not a function
createOffer() with offerToReceiveAudio should add audio line to all subsequent created offers FAIL assert_equals: Expect audio line to remain in created offer expected 1 but got 0
createOffer() with offerToReceiveVideo should add video line to all subsequent created offers FAIL assert_equals: Expect video line to remain in created offer expected 1 but got 0
createOffer() with offerToReceiveAudio:true then offerToReceiveVideo:true should have result offer with both audio and video line FAIL assert_equals: Expect audio line to remain in created offer expected 1 but got 0
Test onsignalingstatechange event for createOffer() and then setLocalDescription() should succeed PASS
/webrtc/RTCPeerConnection-ondatachannel.html
Subtest Results Messages
OK
datachannel event should fire when new data channel is announced to the remote peer PASS
Data channel created on remote peer should match the same configuration as local peer FAIL assert_equals: expected (string) "high" but got (undefined) undefined
Data channel created with negotiated set to true should not fire datachannel event on remote peer PASS
/webrtc/RTCPeerConnection-setLocalDescription.html
Subtest Results Messages
OK
setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer FAIL promise_test: Unhandled rejection with value: object "OperationError: Failed to parse SessionDescription. Expect line: v="
setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError FAIL assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 4A:40:99:06:91:67:1B:D0:9B:12:52:95:42:A7:BE:93:FD:27:CC:12:2B:B6:04:C1:27:0A:BF:E6:8E:3E:CA:63 Got: sha-256 FF:D1:5C:77:65:94:C4:0C:4F:AC:DD:6F:AD:7F:3C:B4:A3:2F:CD:C7:B0:69:8D:EB:FA:9D:C9:34:33:EC:47:2C" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 B8:65:2F:87:E6:19:51:2C:15:7E:90:EF:91:2C:68:53:BE:EF:BE:16:94:96:FC:B0:6E:0D:E6:D6:7D:70:B0:67 Got: sha-256 FB:DE:87:DE:2D:28:CC:F3:DB:ED:1C:95:DE:D7:03:09:C6:2A:31:CE:D8:86:4C:F0:15:81:CA:1D:B8:C9:99:DC" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 01:62:F6:52:A2:C2:EB:D7:BC:E3:C1:6E:5D:FD:6D:ED:DD:5B:AA:EB:2F:D8:6A:AE:B2:D8:F9:4F:C6:AC:48:C7 Got: sha-256 2A:91:E0:2B:E7:37:4B:ED:5C:51:66:BF:73:DE:29:39:4F:1C:2D:FC:E4:12:85:3D:D8:C5:61:0A:6A:EB:0D:4C" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 C0:AC:C8:2C:96:C2:04:65:5C:8E:0C:D6:E8:84:1A:25:8E:40:D2:47:27:44:73:D4:8E:96:8C:1E:CF:58:A7:40 Got: sha-256 88:C4:13:89:21:71:AB:BC:4F:8F:5E:A7:CD:58:D9:E8:1F:DD:11:0A:8A:DC:2B:D1:C0:76:5D:BB:3F:40:E9:AA" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 C4:09:13:BC:B5:71:B4:22:AC:F1:77:35:35:1A:6F:76:A1:A0:E8:4A:8A:19:5A:94:BE:25:F7:0A:30:7E:B0:50 Got: sha-256 FD:9C:2E:7E:DE:00:5B:EE:04:1A:BC:B5:CF:80:B4:02:3B:C6:92:EC:97:C9:38:34:10:2B:3D:AD:52:04:20:22" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 C2:30:18:83:F0:69:EB:5B:06:C1:B8:9F:1B:AA:50:79:A8:D0:3D:4E:CB:68:9F:4A:08:1B:55:C4:FF:8C:BA:0D Got: sha-256 6B:DA:55:D7:D7:AA:F6:B7:6E:99:66:7D:B5:C8:40:E1:EC:9D:01:D3:80:98:D8:3D:A1:BC:26:67:BE:73:BC:45" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 A8:E9:DF:09:AE:79:19:53:52:1C:4C:78:C5:2D:DF:7E:13:F0:E8:84:CB:01:FA:01:11:2F:D7:5A:9A:45:EE:53 Got: sha-256 BB:D4:A9:2D:49:4B:8E:5B:DC:47:06:A1:D5:BC:48:DD:2A:6D:FB:E4:0D:F6:64:C9:56:7E:81:C1:24:AE:C4:2C" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 70:B9:6D:3B:75:5D:4C:A7:08:E4:38:77:86:5D:2E:5F:B2:74:06:C2:8A:8D:AA:AC:95:16:D1:A0:F4:CE:44:20 Got: sha-256 59:A5:A0:B6:5C:F6:95:65:D3:AB:0E:B3:C1:CD:E9:07:64:7B:47:0C:04:52:7B:9A:15:D4:73:8A:BC:3F:9C:64" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 69:2D:83:4E:37:97:CA:1D:BD:A9:D7:D8:8D:C7:2A:BC:68:47:88:3E:4D:CE:41:0D:B0:A5:92:FC:1A:68:2D:51 Got: sha-256 0D:32:C7:92:66:99:10:8C:2A:CF:18:75:98:7A:EA:B8:B8:28:1D:59:9D:1D:A6:CE:76:54:C7:0A:E7:5B:D3:94" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13;assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local offer sdp: Failed to push down transport description: Local fingerprint does not match identity. Expected: sha-256 4D:1A:71:68:43:4B:43:C2:F1:C5:75:22:08:98:97:8A:A9:90:ED:19:46:DD:D9:37:4D:D8:1E:F7:DD:14:62:AD Got: sha-256 B5:19:18:C3:17:FB:66:EE:94:4E:0B:F8:28:46:7C:38:96:A9:3C:2F:BD:D0:A9:B0:8D:DF:CE:82:D4:33:A6:58" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
Set created offer other than last offer should reject with InvalidModificationError FAIL assert_unreached: Should have rejected: undefined Reached unreachable code
Creating and setting offer multiple times should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
setLocalDescription(offer) should never resolve if connection is closed in parallel PASS
setLocalDescription() with valid answer should succeed FAIL assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer FAIL promise_test: Unhandled rejection with value: object "OperationError: Failed to parse SessionDescription. Expect line: v="

@w3c-bots
Copy link

w3c-bots commented Jun 12, 2017

View the complete job log.

Sauce (MicrosoftEdge)

Testing web-platform-tests at revision 384256d
Using browser at version 14.14393
Starting 10 test iterations
All results were stable

All results

8 tests ran
/webrtc/RTCDataChannel-bufferedAmount.html
Subtest Results Messages
OK
bufferedAmount should increase to byte length of encoded unicode string sent FAIL 'RTCPeerConnection' is undefined
bufferedAmount should increase to byte length of buffer sent FAIL 'RTCPeerConnection' is undefined
bufferedAmount should increase to size of blob sent FAIL 'RTCPeerConnection' is undefined
bufferedAmount should increase by byte length for each message sent FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCDataChannel-send.html
Subtest Results Messages
OK
Calling send() when data channel is in connecting state should throw InvalidStateError FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send simple string and receive as string FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send unicode string and receive as unicode string FAIL 'RTCPeerConnection' is undefined
Data channel should ignore binaryType and always receive string message as string FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send Uint8Array message and receive as ArrayBuffer FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send ArrayBuffer message and receive as ArrayBuffer FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send Blob message and receive as ArrayBuffer FAIL 'RTCPeerConnection' is undefined
Data channel should be able to send ArrayBuffer message and receive as Blob FAIL 'RTCPeerConnection' is undefined
Data channel binaryType should receive message as Blob by default FAIL 'RTCPeerConnection' is undefined
Sending multiple messages with different types should succeed and be received FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCPeerConnection-createAnswer.html
Subtest Results Messages
OK
createAnswer() with null remoteDescription should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
createAnswer() after setting remote description should succeed FAIL 'RTCPeerConnection' is undefined
createAnswer() when connection is closed reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
createAnswer() when connection is closed in parallel should never resolve FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCPeerConnection-createOffer.html
Subtest Results Messages
OK
createOffer() with no argument from newly created RTCPeerConnection should succeed FAIL 'RTCPeerConnection' is undefined
createOffer() and then setLocalDescription() should succeed FAIL 'RTCPeerConnection' is undefined
createOffer() after connection is closed should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
createOffer() when connection is closed halfway should never resolve FAIL 'RTCPeerConnection' is undefined
When media stream is added when createOffer() is running in parallel, the result offer should contain the new media stream FAIL 'RTCPeerConnection' is undefined
createOffer() with offerToReceiveAudio should add audio line to all subsequent created offers FAIL 'RTCPeerConnection' is undefined
createOffer() with offerToReceiveVideo should add video line to all subsequent created offers FAIL 'RTCPeerConnection' is undefined
createOffer() with offerToReceiveAudio:true then offerToReceiveVideo:true should have result offer with both audio and video line FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCPeerConnection-ondatachannel.html
Subtest Results Messages
OK
datachannel event should fire when new data channel is announced to the remote peer FAIL 'RTCPeerConnection' is undefined
Data channel created on remote peer should match the same configuration as local peer FAIL 'RTCPeerConnection' is undefined
Data channel created with negotiated set to true should not fire datachannel event on remote peer FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCPeerConnection-setLocalDescription.html
Subtest Results Messages
OK
setLocalDescription with type offer and null sdp should use lastOffer generated from createOffer FAIL 'RTCPeerConnection' is undefined
setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError FAIL 'RTCPeerConnection' is undefined
Set created offer other than last offer should reject with InvalidModificationError FAIL 'RTCPeerConnection' is undefined
Creating and setting offer multiple times should succeed FAIL 'RTCPeerConnection' is undefined
setLocalDescription(offer) should never resolve if connection is closed in parallel FAIL 'RTCPeerConnection' is undefined
setLocalDescription() with valid answer should succeed FAIL 'RTCPeerConnection' is undefined
setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer FAIL 'RTCPeerConnection' is undefined
setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError FAIL 'RTCPeerConnection' is undefined
Calling createOffer() and setLocalDescription() again after one round of local-offer/remote-answer should succeed FAIL 'RTCPeerConnection' is undefined
Switching role from answerer to offerer after going back to stable state should succeed FAIL 'RTCPeerConnection' is undefined
Calling setLocalDescription(answer) from stable state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCPeerConnection-setRemoteDescription.html
Subtest Results Messages
OK
setRemoteDescription with valid offer should succeed FAIL 'RTCPeerConnection' is undefined
Setting remote description multiple times with different offer should succeed FAIL 'RTCPeerConnection' is undefined
setRemoteDescription(offer) should never resolve if connection is closed in parallel FAIL 'RTCPeerConnection' is undefined
setRemoteDescription(offer) with invalid SDP should reject with RTCError FAIL 'RTCPeerConnection' is undefined
setRemoteDescription with invalid type and invalid SDP should reject with TypeError FAIL 'RTCPeerConnection' is undefined
setRemoteDescription() with invalid SDP and stable state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
setRemoteDescription() with valid state and answer should succeed FAIL 'RTCPeerConnection' is undefined
Calling setRemoteDescription() again after one round of remote-offer/local-answer should succeed FAIL 'RTCPeerConnection' is undefined
Switching role from offerer to answerer after going back to stable state should succeed FAIL 'RTCPeerConnection' is undefined
Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
Calling setRemoteDescription(offer) from have-local-offer state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError FAIL 'RTCPeerConnection' is undefined
setRemoteDescription should trigger ontrack event when the MSID of the stream is is parsed. FAIL 'RTCPeerConnection' is undefined
/webrtc/RTCSctpTransport-constructor.html
Subtest Results Messages
OK
setRemoteDescription() with answer containing data media should initialize pc.sctp FAIL 'RTCPeerConnection' is undefined
setLocalDescription() with answer containing data media should initialize pc.sctp FAIL 'RTCPeerConnection' is undefined

@rwaldron
Copy link
Contributor

@soareschen there is a conflict in this branch, but it's very minimal:

// Helper function to exchange ice candidates between
// two local peer connections
function exchangeIceCandidates(pc1, pc2) {
<<<<<<< HEAD
=======
  // private function
>>>>>>> 73395d471befa78497bf62ec21bcfd88074c5a78

@rwaldron
Copy link
Contributor

I am not sure if this is because synchronous sending is allowed by the spec and the connection is local, so everything is sent without buffering.

I cannot find spec text to support this

Based on my reading of:

bufferedAmount of type unsigned long, readonly
The bufferedAmount attribute must return the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but that, as of the last time the event loop started executing a task, had not yet been transmitted to the network. (This thus includes any text sent during the execution of the current task, regardless of whether the user agent is able to transmit text asynchronously with script execution.) This does not include framing overhead incurred by the protocol, or buffering done by the operating system or network hardware. If the channel is closed, this attribute's value will only increase with each call to the send() method (the attribute does not reset to zero once the channel closes).

I think that the implementations are just wrong, but I think we need some feedback from spec authors. Can you file an issue on webrtc-pc? Thanks!

Copy link
Contributor

@rwaldron rwaldron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be rebased

// Simple ASCII encoded string
const helloString = 'hello';
// ASCII encoded buffer representation of the string
const helloBuffer = Uint8Array.of(0x68, 0x65, 0x6c, 0x6c, 0x6f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to avoid hand-writing these bytes, you could do this:

Uint8Array.from(helloString, char => char.charCodeAt(0));

(That's not a blocker, just a thought)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we could use the TextEncoder to encode the ASCII and unicode strings. But I think hard coded byte values is better here, since the test strings are short. It avoids additional dependency and demonstrates that nothing can go wrong of using the encoder incorrectly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hard coded byte values is better here, since the test strings are short. It avoids additional dependency and demonstrates that nothing can go wrong of using the encoder incorrectly.

I agree with this rationale, 100%

const pc = new RTCPeerConnection();
const channel = pc.createDataChannel('test');
channel.close();
assert_equals(channel.readyState, 'closing');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing with the following:

In Firefox Nightly:

assert_equals: expected "closing" but got "closed"

In Chrome Canary:

assert_equals: expected "closing" but got "connecting"

In Safari Developer Preview:

assert_equals: expected "closing" but got "closed"

(W/r to the actual state, I think Chrome is incorrect.)

readyState will not be "closing" after you've called the close() method. This is specified here:

An RTCDataChannel object's underlying data transport may be torn down in a non-abrupt manner by running the closing procedure. When that happens the user agent must, unless the procedure was initiated by the close method, queue a task that sets the object's readyState attribute to closing. This will eventually render the data transport closed.

(emphasis added)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closing procedure is initiated by the close method. So the step "queue a task that sets the object's readyState attribute to closing" is not applied.

Step 3 of close() says "Set channel's readyState attribute to closing.", so after synchronous return the readyState should be closing.

I wanted to write a RTCDataChannel-close.html in separate PR. Just happen to write this first and have to call close() in here as well.

// createDataChannelPair
// awaitMessage
// blobToArrayBuffer
// assertEqualsArrayBuffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I truly wish that the convention for assertion functions was camel-case, this breaks consistency with all of testharness.js and all of your own assertion functions.

channel.close();
assert_equals(channel.readyState, 'closing');
channel.send(helloString);
}, 'Calling send() when data channel is in closing state should succeed');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling send() when data channel is in closing state should succeed

I don't understand this test message in the context of 6.2, step 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If channel's underlying data transport is not established yet, or if the closing procedure has started, then abort these steps.

My understanding for this is that if readyState is not connected, the method is aborted without actually sending the data.

The case for "channel's underlying data transport is not established yet" is a bit curious, because step 2 have already guard against connecting state.

I think the reason it is abort in close state is because in the current version, any error sending would abruptly close the connection and the exception is swallowed.

I have raised some comment in w3c/webrtc-pc#1209 that if error sending is changed to throwing, then it should throw error if connection is closed as well. Perhaps this test can be deferred until that is resolved.

@soareschen
Copy link
Contributor Author

I think that the implementations are just wrong, but I think we need some feedback from spec authors. Can you file an issue on webrtc-pc? Thanks!

I did a search and found w3c/webrtc-pc#1111. (Should have done this earlier)

Basically my initial interpretation is correct:

Meaning that within an individual task execution, the value of bufferedAmount doesn't change, unless send() is called, causing it to increase.

Here's one idea for what to say: "Unless otherwise stated, all readonly attributes must behave as though they return the value of an internal slot, which is only updated inside a queued microtask."

But given that both of us get confused by the description in bufferedAmount, I think we can leave a comment there to suggest improvement to the description.

@soareschen
Copy link
Contributor Author

I have filed w3c/webrtc-pc#1376 to ask for improvement to bufferedAmount description.

@soareschen
Copy link
Contributor Author

I have refactored the test for bufferedAmount to a separate file for easier debugging. Firefox now pass all of the send/receive tests, while Chrome fail on sending/receiving blobs.

@rwaldron
Copy link
Contributor

But given that both of us get confused by the description in bufferedAmount, I think we can leave a comment there to suggest improvement to the description.

I have filed w3c/webrtc-pc#1376 to ask for improvement to bufferedAmount description.

Awesome! Thanks for that follow up

rwaldron added a commit to rwaldron/webrtc-pc that referenced this pull request Jun 13, 2017
…bufferedAmount

- web-platform-tests/wpt#6215

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
@rwaldron rwaldron merged commit 17354db into web-platform-tests:master Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants