Commit 3e89d0d3 authored by Steve Anton's avatar Steve Anton Committed by Commit Bot

Revert "Implement RTCIceTransport.onselectedcandidatepairchange"

This reverts commit a9d61b8e.

Reason for revert: flaky test

Original change's description:
> Implement RTCIceTransport.onselectedcandidatepairchange
> 
> Bug: 864871
> Change-Id: I710b18f8644be51d08b33b9852c00f4fbacec286
> Reviewed-on: https://chromium-review.googlesource.com/1208961
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Henrik Boström <hbos@chromium.org>
> Reviewed-by: Harald Alvestrand <hta@chromium.org>
> Commit-Queue: Steve Anton <steveanton@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#595700}

TBR=dcheng@chromium.org,hta@chromium.org,haraken@chromium.org,hbos@chromium.org,steveanton@chromium.org

Change-Id: I946ade2587e49b3273d9dd303a3e383e8f5f16a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 864871
Reviewed-on: https://chromium-review.googlesource.com/1256622Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Steve Anton <steveanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595737}
parent 8f10effc
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
// makeIceTransport // makeIceTransport
// makeGatherAndStartTwoIceTransports // makeGatherAndStartTwoIceTransports
function makeIceTransport(t) {
const iceTransport = new RTCIceTransport();
t.add_cleanup(() => iceTransport.stop());
return iceTransport;
}
test(() => { test(() => {
const iceTransport = new RTCIceTransport(); const iceTransport = new RTCIceTransport();
}, 'RTCIceTransport constructor does not throw'); }, 'RTCIceTransport constructor does not throw');
...@@ -254,49 +260,4 @@ promise_test(async t => { ...@@ -254,49 +260,4 @@ promise_test(async t => {
]); ]);
}, 'Two RTCIceTransports connect to each other'); }, 'Two RTCIceTransports connect to each other');
promise_test(async t => {
async function waitForConnectedThenSelectedCandidatePairChange(t, transport,
transportName) {
const watcher = new EventWatcher(t, localTransport,
[ 'statechange', 'selectedcandidatepairchange' ]);
await watcher.wait_for('statechange');
assert_equals(transport.state, 'connected',
`${transportName} state should be 'connected'`);
await watcher.wait_for('selectedcandidatepairchange');
const selectedCandidatePair = transport.getSelectedCandidatePair();
assert_not_equals(selectedCandidatePair, null,
`${transportName} selected candidate pair should not be null once ` +
'the selectedcandidatepairchange event fires');
assert_true(
transport.getLocalCandidates().some(
({ candidate }) =>
candidate === selectedCandidatePair.local.candidate),
`${transportName} selected candidate pair local should be in the ` +
'list of local candidates');
assert_true(
transport.getRemoteCandidates().some(
({ candidate }) =>
candidate === selectedCandidatePair.remote.candidate),
`${transportName} selected candidate pair local should be in the ` +
'list of remote candidates');
}
const [ localTransport, remoteTransport ] =
makeGatherAndStartTwoIceTransports(t);
await Promise.all([
waitForConnectedThenSelectedCandidatePairChange(t, localTransport,
'local transport'),
waitForConnectedThenSelectedCandidatePairChange(t, remoteTransport,
'remote transport'),
]);
}, 'Selected candidate pair changes once the RTCIceTransports connect.');
promise_test(async t => {
const [ transport, ] = makeGatherAndStartTwoIceTransports(t);
const watcher = new EventWatcher(t, transport, 'selectedcandidatepairchange');
await watcher.wait_for('selectedcandidatepairchange');
transport.stop();
assert_equals(transport.getSelectedCandidatePair(), null);
}, 'getSelectedCandidatePair() returns null once the RTCIceTransport is ' +
'stopped.');
</script> </script>
...@@ -338,7 +338,7 @@ PASS RTCIceTransport interface: operation getLocalParameters() ...@@ -338,7 +338,7 @@ PASS RTCIceTransport interface: operation getLocalParameters()
PASS RTCIceTransport interface: operation getRemoteParameters() PASS RTCIceTransport interface: operation getRemoteParameters()
PASS RTCIceTransport interface: attribute onstatechange PASS RTCIceTransport interface: attribute onstatechange
PASS RTCIceTransport interface: attribute ongatheringstatechange PASS RTCIceTransport interface: attribute ongatheringstatechange
PASS RTCIceTransport interface: attribute onselectedcandidatepairchange FAIL RTCIceTransport interface: attribute onselectedcandidatepairchange assert_true: The prototype object must have a property "onselectedcandidatepairchange" expected true got false
FAIL RTCIceTransport must be primary interface of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined" FAIL RTCIceTransport must be primary interface of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL Stringification of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined" FAIL Stringification of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "role" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined" FAIL RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "role" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
......
...@@ -338,7 +338,7 @@ PASS RTCIceTransport interface: operation getLocalParameters() ...@@ -338,7 +338,7 @@ PASS RTCIceTransport interface: operation getLocalParameters()
PASS RTCIceTransport interface: operation getRemoteParameters() PASS RTCIceTransport interface: operation getRemoteParameters()
PASS RTCIceTransport interface: attribute onstatechange PASS RTCIceTransport interface: attribute onstatechange
PASS RTCIceTransport interface: attribute ongatheringstatechange PASS RTCIceTransport interface: attribute ongatheringstatechange
PASS RTCIceTransport interface: attribute onselectedcandidatepairchange FAIL RTCIceTransport interface: attribute onselectedcandidatepairchange assert_true: The prototype object must have a property "onselectedcandidatepairchange" expected true got false
FAIL RTCIceTransport must be primary interface of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined" FAIL RTCIceTransport must be primary interface of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL Stringification of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined" FAIL Stringification of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "role" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined" FAIL RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "role" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
......
...@@ -5496,7 +5496,6 @@ interface RTCIceTransport : EventTarget ...@@ -5496,7 +5496,6 @@ interface RTCIceTransport : EventTarget
getter gatheringState getter gatheringState
getter ongatheringstatechange getter ongatheringstatechange
getter onicecandidate getter onicecandidate
getter onselectedcandidatepairchange
getter onstatechange getter onstatechange
getter role getter role
getter state getter state
...@@ -5512,7 +5511,6 @@ interface RTCIceTransport : EventTarget ...@@ -5512,7 +5511,6 @@ interface RTCIceTransport : EventTarget
method stop method stop
setter ongatheringstatechange setter ongatheringstatechange
setter onicecandidate setter onicecandidate
setter onselectedcandidatepairchange
setter onstatechange setter onstatechange
interface RTCPeerConnection : EventTarget interface RTCPeerConnection : EventTarget
static method generateCertificate static method generateCertificate
......
...@@ -236,7 +236,6 @@ ...@@ -236,7 +236,6 @@
"seeked", "seeked",
"seeking", "seeking",
"select", "select",
"selectedcandidatepairchange",
"selectionchange", "selectionchange",
"selectstart", "selectstart",
"selectend", "selectend",
......
...@@ -47,12 +47,6 @@ class IceTransportAdapter { ...@@ -47,12 +47,6 @@ class IceTransportAdapter {
// Called asynchronously when the ICE connection state has changed. // Called asynchronously when the ICE connection state has changed.
virtual void OnStateChanged(cricket::IceTransportState new_state) {} virtual void OnStateChanged(cricket::IceTransportState new_state) {}
// Called asynchronously when the ICE agent selects a different candidate
// pair for the active connection.
virtual void OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) {}
}; };
virtual ~IceTransportAdapter() = default; virtual ~IceTransportAdapter() = default;
......
...@@ -106,8 +106,6 @@ IceTransportAdapterImpl::IceTransportAdapterImpl( ...@@ -106,8 +106,6 @@ IceTransportAdapterImpl::IceTransportAdapterImpl(
this, &IceTransportAdapterImpl::OnCandidateGathered); this, &IceTransportAdapterImpl::OnCandidateGathered);
p2p_transport_channel_->SignalStateChanged.connect( p2p_transport_channel_->SignalStateChanged.connect(
this, &IceTransportAdapterImpl::OnStateChanged); this, &IceTransportAdapterImpl::OnStateChanged);
p2p_transport_channel_->SignalNetworkRouteChanged.connect(
this, &IceTransportAdapterImpl::OnNetworkRouteChanged);
// The ICE tiebreaker is used to determine which side is controlling/ // The ICE tiebreaker is used to determine which side is controlling/
// controlled when both sides start in the same role. The number is randomly // controlled when both sides start in the same role. The number is randomly
// generated so that each peer can calculate a.tiebreaker <= b.tiebreaker // generated so that each peer can calculate a.tiebreaker <= b.tiebreaker
...@@ -194,21 +192,4 @@ void IceTransportAdapterImpl::OnStateChanged( ...@@ -194,21 +192,4 @@ void IceTransportAdapterImpl::OnStateChanged(
delegate_->OnStateChanged(p2p_transport_channel_->GetState()); delegate_->OnStateChanged(p2p_transport_channel_->GetState());
} }
void IceTransportAdapterImpl::OnNetworkRouteChanged(
absl::optional<rtc::NetworkRoute> new_network_route) {
const cricket::CandidatePairInterface* selected_connection =
p2p_transport_channel_->selected_connection();
if (!selected_connection) {
// The selected connection will only be null if the ICE connection has
// totally failed, at which point we'll get a StateChanged signal. The
// client will implicitly clear the selected candidate pair when it receives
// the failed state change, so we don't need to give an explicit callback
// here.
return;
}
delegate_->OnSelectedCandidatePairChanged(
std::make_pair(selected_connection->local_candidate(),
selected_connection->remote_candidate()));
}
} // namespace blink } // namespace blink
...@@ -45,8 +45,6 @@ class IceTransportAdapterImpl final : public IceTransportAdapter, ...@@ -45,8 +45,6 @@ class IceTransportAdapterImpl final : public IceTransportAdapter,
void OnCandidateGathered(cricket::IceTransportInternal* transport, void OnCandidateGathered(cricket::IceTransportInternal* transport,
const cricket::Candidate& candidate); const cricket::Candidate& candidate);
void OnStateChanged(cricket::IceTransportInternal* transport); void OnStateChanged(cricket::IceTransportInternal* transport);
void OnNetworkRouteChanged(
absl::optional<rtc::NetworkRoute> new_network_route);
Delegate* const delegate_; Delegate* const delegate_;
std::unique_ptr<cricket::PortAllocator> port_allocator_; std::unique_ptr<cricket::PortAllocator> port_allocator_;
......
...@@ -108,14 +108,4 @@ void IceTransportHost::OnStateChanged(cricket::IceTransportState new_state) { ...@@ -108,14 +108,4 @@ void IceTransportHost::OnStateChanged(cricket::IceTransportState new_state) {
CrossThreadBind(&IceTransportProxy::OnStateChanged, proxy_, new_state)); CrossThreadBind(&IceTransportProxy::OnStateChanged, proxy_, new_state));
} }
void IceTransportHost::OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
PostCrossThreadTask(
*proxy_thread_, FROM_HERE,
CrossThreadBind(&IceTransportProxy::OnSelectedCandidatePairChanged,
proxy_, selected_candidate_pair));
}
} // namespace blink } // namespace blink
...@@ -73,9 +73,6 @@ class IceTransportHost final : public IceTransportAdapter::Delegate { ...@@ -73,9 +73,6 @@ class IceTransportHost final : public IceTransportAdapter::Delegate {
void OnGatheringStateChanged(cricket::IceGatheringState new_state) override; void OnGatheringStateChanged(cricket::IceGatheringState new_state) override;
void OnCandidateGathered(const cricket::Candidate& candidate) override; void OnCandidateGathered(const cricket::Candidate& candidate) override;
void OnStateChanged(cricket::IceTransportState new_state) override; void OnStateChanged(cricket::IceTransportState new_state) override;
void OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) override;
const scoped_refptr<base::SingleThreadTaskRunner> proxy_thread_; const scoped_refptr<base::SingleThreadTaskRunner> proxy_thread_;
std::unique_ptr<IceTransportAdapter> transport_; std::unique_ptr<IceTransportAdapter> transport_;
......
...@@ -140,11 +140,4 @@ void IceTransportProxy::OnStateChanged(cricket::IceTransportState new_state) { ...@@ -140,11 +140,4 @@ void IceTransportProxy::OnStateChanged(cricket::IceTransportState new_state) {
delegate_->OnStateChanged(new_state); delegate_->OnStateChanged(new_state);
} }
void IceTransportProxy::OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
delegate_->OnSelectedCandidatePairChanged(selected_candidate_pair);
}
} // namespace blink } // namespace blink
...@@ -50,9 +50,6 @@ class IceTransportProxy final { ...@@ -50,9 +50,6 @@ class IceTransportProxy final {
} }
virtual void OnCandidateGathered(const cricket::Candidate& candidate) {} virtual void OnCandidateGathered(const cricket::Candidate& candidate) {}
virtual void OnStateChanged(cricket::IceTransportState new_state) {} virtual void OnStateChanged(cricket::IceTransportState new_state) {}
virtual void OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) {}
}; };
// Construct a Proxy with the underlying ICE implementation running on the // Construct a Proxy with the underlying ICE implementation running on the
...@@ -97,9 +94,6 @@ class IceTransportProxy final { ...@@ -97,9 +94,6 @@ class IceTransportProxy final {
void OnGatheringStateChanged(cricket::IceGatheringState new_state); void OnGatheringStateChanged(cricket::IceGatheringState new_state);
void OnCandidateGathered(const cricket::Candidate& candidate); void OnCandidateGathered(const cricket::Candidate& candidate);
void OnStateChanged(cricket::IceTransportState new_state); void OnStateChanged(cricket::IceTransportState new_state);
void OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair);
const scoped_refptr<base::SingleThreadTaskRunner> proxy_thread_; const scoped_refptr<base::SingleThreadTaskRunner> proxy_thread_;
const scoped_refptr<base::SingleThreadTaskRunner> host_thread_; const scoped_refptr<base::SingleThreadTaskRunner> host_thread_;
......
...@@ -79,13 +79,6 @@ struct CrossThreadCopier<std::vector<rtc::scoped_refptr<rtc::RTCCertificate>>> ...@@ -79,13 +79,6 @@ struct CrossThreadCopier<std::vector<rtc::scoped_refptr<rtc::RTCCertificate>>>
STATIC_ONLY(CrossThreadCopier); STATIC_ONLY(CrossThreadCopier);
}; };
template <>
struct CrossThreadCopier<std::pair<cricket::Candidate, cricket::Candidate>>
: public CrossThreadCopierPassThrough<
std::pair<cricket::Candidate, cricket::Candidate>> {
STATIC_ONLY(CrossThreadCopier);
};
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_ADAPTERS_WEB_RTC_CROSS_THREAD_COPIER_H_ #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_ADAPTERS_WEB_RTC_CROSS_THREAD_COPIER_H_
...@@ -380,7 +380,6 @@ void RTCIceTransport::stop() { ...@@ -380,7 +380,6 @@ void RTCIceTransport::stop() {
// Stopping the consumer should cause it to disconnect. // Stopping the consumer should cause it to disconnect.
DCHECK(!HasConsumer()); DCHECK(!HasConsumer());
state_ = RTCIceTransportState::kClosed; state_ = RTCIceTransportState::kClosed;
selected_candidate_pair_ = base::nullopt;
proxy_.reset(); proxy_.reset();
} }
...@@ -456,25 +455,9 @@ void RTCIceTransport::OnStateChanged(cricket::IceTransportState new_state) { ...@@ -456,25 +455,9 @@ void RTCIceTransport::OnStateChanged(cricket::IceTransportState new_state) {
return; return;
} }
state_ = local_new_state; state_ = local_new_state;
if (state_ == RTCIceTransportState::kFailed) {
selected_candidate_pair_ = base::nullopt;
}
DispatchEvent(*Event::Create(EventTypeNames::statechange)); DispatchEvent(*Event::Create(EventTypeNames::statechange));
} }
void RTCIceTransport::OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) {
RTCIceCandidate* local =
ConvertToRtcIceCandidate(selected_candidate_pair.first);
RTCIceCandidate* remote =
ConvertToRtcIceCandidate(selected_candidate_pair.second);
selected_candidate_pair_ = RTCIceCandidatePair();
selected_candidate_pair_->setLocal(local);
selected_candidate_pair_->setRemote(remote);
DispatchEvent(*Event::Create(EventTypeNames::selectedcandidatepairchange));
}
bool RTCIceTransport::RaiseExceptionIfClosed( bool RTCIceTransport::RaiseExceptionIfClosed(
ExceptionState& exception_state) const { ExceptionState& exception_state) const {
if (IsClosed()) { if (IsClosed()) {
......
...@@ -99,7 +99,6 @@ class MODULES_EXPORT RTCIceTransport final ...@@ -99,7 +99,6 @@ class MODULES_EXPORT RTCIceTransport final
ExceptionState& exception_state); ExceptionState& exception_state);
DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(gatheringstatechange); DEFINE_ATTRIBUTE_EVENT_LISTENER(gatheringstatechange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(selectedcandidatepairchange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate);
// EventTarget overrides. // EventTarget overrides.
...@@ -126,9 +125,6 @@ class MODULES_EXPORT RTCIceTransport final ...@@ -126,9 +125,6 @@ class MODULES_EXPORT RTCIceTransport final
void OnGatheringStateChanged(cricket::IceGatheringState new_state) override; void OnGatheringStateChanged(cricket::IceGatheringState new_state) override;
void OnCandidateGathered(const cricket::Candidate& candidate) override; void OnCandidateGathered(const cricket::Candidate& candidate) override;
void OnStateChanged(cricket::IceTransportState new_state) override; void OnStateChanged(cricket::IceTransportState new_state) override;
void OnSelectedCandidatePairChanged(
const std::pair<cricket::Candidate, cricket::Candidate>&
selected_candidate_pair) override;
// Fills in |local_parameters_| with a random usernameFragment and a random // Fills in |local_parameters_| with a random usernameFragment and a random
// password. // password.
......
...@@ -47,7 +47,7 @@ enum RTCIceGatheringState { ...@@ -47,7 +47,7 @@ enum RTCIceGatheringState {
RTCIceParameters? getRemoteParameters(); RTCIceParameters? getRemoteParameters();
attribute EventHandler onstatechange; attribute EventHandler onstatechange;
attribute EventHandler ongatheringstatechange; attribute EventHandler ongatheringstatechange;
attribute EventHandler onselectedcandidatepairchange; // TODO(crbug.com/864871): Implement onselectedcandidatepairchange.
// The following is defined in the WebRTC-ICE extension specification. // The following is defined in the WebRTC-ICE extension specification.
// https://w3c.github.io/webrtc-ice/#rtcicetransport* // https://w3c.github.io/webrtc-ice/#rtcicetransport*
......
...@@ -442,7 +442,6 @@ _CONFIG = [ ...@@ -442,7 +442,6 @@ _CONFIG = [
# AtomicString or HeapVector) are used cross thread. These Blink types # AtomicString or HeapVector) are used cross thread. These Blink types
# are converted to the STL/WebRTC counterparts in the parent directory. # are converted to the STL/WebRTC counterparts in the parent directory.
'allowed': [ 'allowed': [
'absl::.+',
'base::OnTaskRunnerDeleter', 'base::OnTaskRunnerDeleter',
'sigslot::.+', 'sigslot::.+',
], ],
......
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