Index: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
diff --git a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
index f144b9dacfd2914c80f0bf16aa68e458ad49eaf0..ef99d222d1980b65735554ad0bf050f59b1b8ed2 100644 |
--- a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
+++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
@@ -25,24 +25,50 @@ function addIceCandidateSuccess() |
pc.close(); |
} |
-function addIceCandidateFailure() |
+function unexpectedCallback() |
{ |
- testFailed("addIceCandidateFailue was called."); |
+ testFailed("unexpectedCallback was called."); |
finishJSTest(); |
} |
+function expectedTypeError(error) |
+{ |
+ shouldBe(error.name, "TypeError") |
+ testPassed("expectedTypeError was called.") |
+} |
+ |
function onIceChange1() |
{ |
if (pc.iceConnectionState === "completed") { |
testPassed("iceConnectionState is completed"); |
iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
- shouldThrow('pc.addIceCandidate(null, addIceCandidateSuccess, addIceCandidateFailure);'); |
- shouldThrow('pc.addIceCandidate(iceCandidate, null, addIceCandidateFailure);'); |
- shouldThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, null);'); |
- shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, addIceCandidateFailure);'); |
+ shouldNotThrow('pc.addIceCandidate(null, addIceCandidateSuccess, unexpectedCallback).catch(expectedTypeError);'); |
+ shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallback).catch(expectedTypeError);'); |
+ shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, null).catch(expectedTypeError);'); |
+ shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, unexpectedCallback);'); |
} |
} |
+function testExecutionOrderClosedConnection() |
+{ |
+ var localPeerConnection = new webkitRTCPeerConnection(null, null); |
+ localPeerConnection.close(); |
+ var counter = 0; |
+ events = []; |
philipj_slow
2016/02/18 14:39:07
could set window.events for clarity, like window.e
|
+ Promise.resolve().then(_ => events[counter++] = 1); |
+ var iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
+ localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, (error) => { |
+ window.error = error; |
+ shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\'."'); |
+ events[counter++] = 2; |
+ }); |
+ Promise.resolve().then(_ => { |
+ events[counter++] = 3; |
+ shouldBe('events', '[1,2,3]'); |
philipj_slow
2016/02/18 14:39:07
Looks good!
|
+ }); |
+} |
+ |
+shouldNotThrow('testExecutionOrderClosedConnection()'); |
shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); |
pc.oniceconnectionstatechange = onIceChange1; |