Index: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
diff --git a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
index a8987914665129244a44fbb560021f856629ebcc..29cc4ea56886cbc63ebfb8cfe8e703d4beb57e3a 100644 |
--- a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
+++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
@@ -22,31 +22,64 @@ function requestFailed2() |
finishJSTest(); |
} |
-function requestSucceeded2() |
+function requestSucceeded1() |
{ |
- testFailed('requestSucceeded was called.'); |
- finishJSTest(); |
+ testPassed('requestSucceeded was called.'); |
+ |
+ sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}); |
+ shouldNotThrow('pc.setLocalDescription(sessionDescription, unexpectedCallback, requestFailed2);'); |
} |
-function requestFailed1() |
+function unexpectedCallback() |
{ |
- testFailed('requestFailed was called.'); |
+ testFailed('unexpectedCallback was called.'); |
finishJSTest(); |
} |
-function requestSucceeded1() |
+function expectedTypeError(error) |
{ |
- testPassed('requestSucceeded was called.'); |
+ window.error = error; |
+ shouldBe('error.name', '"TypeError"') |
+ testPassed('expectedTypeError was called.') |
+} |
- sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}); |
- shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded2, requestFailed2);'); |
+function expectedInvalidSessionDescription(error) |
+{ |
+ testPassed('expectedInvalidSessionDescription was called.') |
} |
+function testExecutionOrderClosedConnection() |
+{ |
+ var localPeerConnection = new webkitRTCPeerConnection(null, null); |
+ orderCounter = 0; |
+ localPeerConnection.setLocalDescription().catch(function(error) { |
+ window.error = error; |
+ shouldBe('error.name', '"TypeError"'); |
+ orderCounter++; |
+ shouldBeEqualToNumber('orderCounter', 1) |
+ }) |
+ localPeerConnection.close(); |
+ var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); |
+ localPeerConnection.setLocalDescription(sessionDescription, unexpectedCallback, function(error) { |
+ window.error = error; |
+ shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\'."'); |
+ orderCounter++; |
+ shouldBeEqualToNumber('orderCounter', 2); |
+ }); |
+ localPeerConnection.setLocalDescription().catch(function(error) { |
+ window.error = error; |
+ shouldBe('error.name', '"TypeError"'); |
+ orderCounter++; |
+ shouldBeEqualToNumber('orderCounter', 3) |
+ }); |
+} |
+ |
+shouldNotThrow('testExecutionOrderClosedConnection()'); |
pc = new webkitRTCPeerConnection(null, null); |
-shouldThrow('pc.setLocalDescription(null)'); |
+shouldNotThrow('pc.setLocalDescription().catch(expectedTypeError)'); |
+shouldNotThrow('pc.setLocalDescription(null).catch(expectedInvalidSessionDescription)'); |
var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); |
-shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, requestFailed1);'); |
- |
+shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, unexpectedCallback);'); |
window.jsTestIsAsync = true; |
window.successfullyParsed = true; |