Chromium Code Reviews| 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..30232d073d3e698fb243d48c00dddb60608303ab 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
| +++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html |
| @@ -25,24 +25,57 @@ 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); |
| + orderCounter = 0; |
|
philipj_slow
2016/02/18 02:31:56
add var or let here, or it ends up on window
Guido Urdaneta
2016/02/18 12:30:22
If I use var, I cannot check its value with should
|
| + localPeerConnection.addIceCandidate(1).catch(function(error) { |
| + window.error = error; |
| + shouldBe('error.name', '"TypeError"'); |
| + orderCounter++; |
| + shouldBeEqualToNumber('orderCounter', 1); |
| + }); |
| + localPeerConnection.close(); |
| + var iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
| + localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, function(error) { |
| + window.error = error; |
| + shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\'."'); |
|
philipj_slow
2016/02/18 02:31:56
This is testing the right thing, the timing of asy
Guido Urdaneta
2016/02/18 12:30:22
It does fail with the Timer implementation.
|
| + orderCounter++; |
| + shouldBeEqualToNumber('orderCounter', 2); |
| + }); |
| + localPeerConnection.addIceCandidate(1).catch(function(error) { |
| + window.error = error; |
| + shouldBe('error.name', '"TypeError"'); |
| + orderCounter++; |
| + shouldBeEqualToNumber('orderCounter', 3); |
| + }); |
| +} |
| + |
| +shouldNotThrow('testExecutionOrderClosedConnection()'); |
| shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); |
| pc.oniceconnectionstatechange = onIceChange1; |