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..542a7603c98f3397b498e100ad7247664a35df6d 100644 |
--- a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
+++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html |
@@ -22,31 +22,57 @@ 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); |
+ localPeerConnection.close(); |
+ var counter = 0; |
+ events = []; |
+ Promise.resolve().then(_ => events[counter++] = 1); |
+ var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); |
+ localPeerConnection.setLocalDescription(sessionDescription, 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]'); |
+ }); |
+} |
+ |
+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; |