Commit a71178f2 authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Pass error codes in SetRemoteDescription rejects

Rebases the WPT tests that are affected.

Bug: chromium:589455
Change-Id: Ic7546a30e7640079e4bbcf3502b510221183562c
Reviewed-on: https://chromium-review.googlesource.com/962123
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543107}
parent 1946cf1f
......@@ -1072,11 +1072,7 @@ class RTCPeerConnectionHandler::WebRtcSetRemoteDescriptionObserverImpl
PeerConnectionTracker::ACTION_SET_REMOTE_DESCRIPTION, "OnFailure",
error.message());
}
// TODO(hbos): Use |error.type()| to reject the promise with the
// appropriate DOMException.
web_request_.RequestFailed(
blink::WebRTCError(blink::WebRTCErrorType::kOperationError,
blink::WebString::FromUTF8(error.message())));
web_request_.RequestFailed(ConvertToWebKitRTCError(error));
web_request_.Reset();
return;
}
......
This is a testharness.js-based test.
FAIL setRemoteDescription() with valid state and answer should succeed assert_not_equals: Expect session description to be defined got disallowed value undefined
FAIL Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError assert_throws: function "function() { throw e }" threw object "OperationError: Failed to set remote answer sdp: Called in wrong state: kStable" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
FAIL Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError assert_throws: function "function() { throw e }" threw object "OperationError: Failed to set remote answer sdp: Called in wrong state: kHaveRemoteOffer" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
PASS Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError
PASS Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError
PASS Test onsignalingstatechange event for setRemoteDescription() with valid state and answer should succeed
Harness: the test ran to completion.
......@@ -3,7 +3,7 @@ FAIL setRemoteDescription with valid offer should succeed assert_not_equals: Exp
FAIL setRemoteDescription multiple times should succeed assert_not_equals: Expect session description to be defined got disallowed value undefined
FAIL setRemoteDescription multiple times with different offer should succeed assert_not_equals: Expect session description to be defined got disallowed value undefined
FAIL setRemoteDescription(offer) with invalid SDP should reject with RTCError assert_equals: Expect error detail field to set to sdp-syntax-error expected (string) "sdp-syntax-error" but got (undefined) undefined
FAIL setRemoteDescription(offer) from have-local-offer state should reject with InvalidStateError assert_throws: function "function() { throw e }" threw object "OperationError: Failed to set remote offer sdp: Called in wrong state: kHaveLocalOffer" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
PASS setRemoteDescription(offer) from have-local-offer state should reject with InvalidStateError
PASS Test onsignalingstatechange event for setRemoteDescription with valid offer should succeed
PASS Test onsignalingstatechange event for setRemoteDescription multiple times should succeed
PASS Test onsignalingstatechange event for setRemoteDescription multiple times with different offer should succeed
......
This is a testharness.js-based test.
FAIL setRemoteDescription(pranswer) from stable state should reject with InvalidStateError assert_throws: function "function() { throw e }" threw object "OperationError: Failed to set remote pranswer sdp: Called in wrong state: kStable" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
PASS setRemoteDescription(pranswer) from stable state should reject with InvalidStateError
FAIL setRemoteDescription(pranswer) from have-local-offer state should succeed assert_not_equals: Expect session description to be defined got disallowed value undefined
PASS setRemoteDescription(pranswer) multiple times should succeed
FAIL setRemoteDescription(answer) from have-remote-pranswer state should succeed assert_not_equals: Expect session description to be defined got disallowed value undefined
......
......@@ -61,7 +61,7 @@ promise_test(async t => {
await pc2.setRemoteDescription(offer);
assert_unreached('pc2.setRemote should have thrown');
} catch(e) {
assert_equals(e.name, 'OperationError');
assert_equals(e.name, 'InvalidAccessError');
}
}, 'SDES can\'t connect to default configuration');
......@@ -77,7 +77,7 @@ promise_test(async t => {
await pc2.setRemoteDescription(offer);
assert_unreached('pc2.setRemote should have thrown');
} catch(e) {
assert_equals(e.name, 'OperationError');
assert_equals(e.name, 'InvalidAccessError');
}
}, 'Default configuration can\'t connect to SDES');
......@@ -134,4 +134,3 @@ test(t => {
</script>
</body>
</html>
......@@ -28,11 +28,18 @@ DOMException* CreateDOMExceptionFromWebRTCError(const WebRTCError& error) {
break;
case WebRTCErrorType::kInvalidState:
return DOMException::Create(kInvalidStateError, error.message());
case WebRTCErrorType::kInvalidParameter:
// One use of this value is to signal invalid SDP syntax.
// According to spec, this should return an RTCError with name
// "RTCError" and detail "sdp-syntax-error", with
// "sdpLineNumber" set to indicate the line where the error
// occured.
// TODO(https://crbug.com/821806): Implement the RTCError object.
return DOMException::Create(kInvalidAccessError, error.message());
case WebRTCErrorType::kInternalError:
// Not a straightforward mapping, but used as a fallback at lower layers.
return DOMException::Create(kOperationError, error.message());
break;
case WebRTCErrorType::kInvalidParameter:
case WebRTCErrorType::kUnsupportedParameter:
case WebRTCErrorType::kInvalidRange:
LOG(ERROR) << "Got unhandled WebRTC error "
......
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