Commit 47bfc2a8 authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Implement RTCPeerConnection.canTrickleIceCandidates

This is a read-only attribute revealing a detail from the
SDP offer/answer exchange.

Spec:
https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-cantrickleicecandidates

Bug: chromium:708484
Change-Id: I8fab2050bac0237cb513d70c8c257a54bdc0a4b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2082512Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746378}
parent bc82136c
......@@ -1967,6 +1967,25 @@ String RTCPeerConnection::connectionState() const {
return String();
}
bool RTCPeerConnection::canTrickleIceCandidates(bool& is_null) const {
is_null = true;
if (closed_ || !peer_handler_->RemoteDescription()) {
return false;
}
webrtc::PeerConnectionInterface* native_connection =
peer_handler_->NativePeerConnection();
if (!native_connection) {
return false;
}
absl::optional<bool> can_trickle =
native_connection->can_trickle_ice_candidates();
if (!can_trickle) {
return false;
}
is_null = false;
return *can_trickle;
}
void RTCPeerConnection::restartIce() {
if (closed_)
return;
......
......@@ -227,6 +227,8 @@ class MODULES_EXPORT RTCPeerConnection final
String connectionState() const;
bool canTrickleIceCandidates(bool&) const;
void restartIce();
// A local stream is any stream associated with a sender.
......
......@@ -83,7 +83,7 @@ enum RTCPeerConnectionState {
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;
readonly attribute RTCPeerConnectionState connectionState;
// readonly attribute boolean? canTrickleIceCandidates;
readonly attribute boolean? canTrickleIceCandidates;
void restartIce();
[CallWith=ScriptState] RTCConfiguration getConfiguration();
[CallWith=ScriptState, RaisesException] void setConfiguration(RTCConfiguration configuration);
......
This is a testharness.js-based test.
FAIL canTrickleIceCandidates property is null prior to setRemoteDescription assert_equals: canTrickleIceCandidates property is null expected (object) null but got (undefined) undefined
FAIL canTrickleIceCandidates property is true after setRemoteDescription with a=ice-options:trickle assert_true: canTrickleIceCandidates property is true after setRemoteDescription expected true got undefined
FAIL canTrickleIceCandidates property is false after setRemoteDescription without a=ice-options:trickle assert_false: canTrickleIceCandidates property is false after setRemoteDescription expected false got undefined
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS RTCPeerConnection.length
PASS new RTCPeerConnection()
PASS new RTCPeerConnection(null)
PASS new RTCPeerConnection(undefined)
PASS new RTCPeerConnection({})
PASS new RTCPeerConnection({ certificates: null })
PASS new RTCPeerConnection({ certificates: undefined })
PASS new RTCPeerConnection({ certificates: [] })
PASS new RTCPeerConnection({ certificates: [null] })
PASS new RTCPeerConnection({ certificates: [undefined] })
PASS new RTCPeerConnection({ iceCandidatePoolSize: toNumberThrows })
PASS localDescription initial value
PASS currentLocalDescription initial value
PASS pendingLocalDescription initial value
PASS remoteDescription initial value
PASS currentRemoteDescription initial value
PASS pendingRemoteDescription initial value
PASS signalingState initial value
PASS iceGatheringState initial value
PASS iceConnectionState initial value
PASS connectionState initial value
FAIL canTrickleIceCandidates initial value assert_equals: expected (object) null but got (undefined) undefined
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 496 tests; 472 PASS, 24 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 496 tests; 474 PASS, 22 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS idl_test setup
PASS idl_test validation
PASS Test driver for asyncInitCertificate
......@@ -38,7 +38,7 @@ PASS RTCPeerConnection interface: attribute signalingState
PASS RTCPeerConnection interface: attribute iceGatheringState
PASS RTCPeerConnection interface: attribute iceConnectionState
PASS RTCPeerConnection interface: attribute connectionState
FAIL RTCPeerConnection interface: attribute canTrickleIceCandidates assert_true: The prototype object must have a property "canTrickleIceCandidates" expected true got false
PASS RTCPeerConnection interface: attribute canTrickleIceCandidates
PASS RTCPeerConnection interface: operation restartIce()
PASS RTCPeerConnection interface: operation getConfiguration()
FAIL RTCPeerConnection interface: operation setConfiguration(optional RTCConfiguration) assert_equals: property has wrong .length expected 0 but got 1
......@@ -89,7 +89,7 @@ PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "iceGatheringState" with the proper type
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "iceConnectionState" with the proper type
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "connectionState" with the proper type
FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "canTrickleIceCandidates" with the proper type assert_inherits: property "canTrickleIceCandidates" not found in prototype chain
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "canTrickleIceCandidates" with the proper type
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "restartIce()" with the proper type
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "getConfiguration()" with the proper type
PASS RTCPeerConnection interface: new RTCPeerConnection() must inherit property "setConfiguration(optional RTCConfiguration)" with the proper type
......
......@@ -5346,6 +5346,7 @@ interface RTCIceTransport : EventTarget
interface RTCPeerConnection : EventTarget
static method generateCertificate
attribute @@toStringTag
getter canTrickleIceCandidates
getter connectionState
getter currentLocalDescription
getter currentRemoteDescription
......@@ -9182,6 +9183,7 @@ interface webkitMediaStream : EventTarget
interface webkitRTCPeerConnection : EventTarget
static method generateCertificate
attribute @@toStringTag
getter canTrickleIceCandidates
getter connectionState
getter currentLocalDescription
getter currentRemoteDescription
......
......@@ -6336,6 +6336,7 @@ interface RTCIceTransport : EventTarget
interface RTCPeerConnection : EventTarget
static method generateCertificate
attribute @@toStringTag
getter canTrickleIceCandidates
getter connectionState
getter currentLocalDescription
getter currentRemoteDescription
......@@ -11447,6 +11448,7 @@ interface webkitMediaStream : EventTarget
interface webkitRTCPeerConnection : EventTarget
static method generateCertificate
attribute @@toStringTag
getter canTrickleIceCandidates
getter connectionState
getter currentLocalDescription
getter currentRemoteDescription
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment