Index: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html |
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html |
index aa189d6f9178cd106dc8f9d5bfb6426e35ea9c1f..1f0a03a053f1dff7bf3f649efcedec972e27231a 100644 |
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html |
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html |
@@ -1,72 +1,82 @@ |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
<html> |
<head> |
-<script src="../../resources/js-test.js"></script> |
-<!-- TODO(guidou): Convert test to testharness.js. crbug.com/614963 --> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
</head> |
<body> |
<script> |
-description("Tests the RTCPeerConnection Ice functionality."); |
- |
var pc = null; |
var iceCandidate = null; |
+var calledCallbacks = []; |
function onIceChange2() |
{ |
if (pc.iceConnectionState === "closed") { |
- testPassed("iceConnectionState is closed."); |
- finishJSTest(); |
+ calledCallbacks.push("iceConnectionState closed"); |
+ assert_array_equals(calledCallbacks, [ |
+ 'iceConnectionState complete', |
+ 'expectedTypeError', |
+ 'expectedTypeError', |
+ 'expectedTypeError', |
+ 'expectedTypeError', |
+ 'success1', |
+ 'success2', |
+ 'success3', |
+ 'success4', |
+ 'iceConnectionState closed' |
+ ]); |
+ testRTC.done(); |
qyearsley
2016/08/26 00:49:38
To make this more explicitly refer to the global v
jeffcarp
2016/08/26 01:26:40
I like that.
|
} |
} |
function addIceCandidateSuccess1() |
{ |
- testPassed("addIceCandidateSuccess1 was called."); |
- shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0}, addIceCandidateSuccess2, unexpectedCallback);'); |
+ calledCallbacks.push('success1'); |
+ pc.addIceCandidate({candidate: "candidate", sdpMid: 0}, addIceCandidateSuccess2, unexpectedCallback); |
} |
function addIceCandidateSuccess2() |
{ |
- testPassed("addIceCandidateSuccess2 was called."); |
- shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMLineIndex: 0}, addIceCandidateSuccess3, unexpectedCallback);'); |
+ calledCallbacks.push('success2'); |
+ pc.addIceCandidate({candidate: "candidate", sdpMLineIndex: 0}, addIceCandidateSuccess3, unexpectedCallback); |
} |
function addIceCandidateSuccess3() |
{ |
- testPassed("addIceCandidateSuccess3 was called."); |
- shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0, sdpMLineIndex: 0}, addIceCandidateSuccess4, unexpectedCallback);'); |
+ calledCallbacks.push('success3'); |
+ pc.addIceCandidate({candidate: "candidate", sdpMid: 0, sdpMLineIndex: 0}, addIceCandidateSuccess4, unexpectedCallback); |
} |
function addIceCandidateSuccess4() |
{ |
- testPassed("addIceCandidateSuccess4 was called."); |
+ calledCallbacks.push('success4'); |
pc.oniceconnectionstatechange = onIceChange2; |
pc.close(); |
} |
function unexpectedCallback() |
{ |
- testFailed("unexpectedCallback was called."); |
- finishJSTest(); |
+ calledCallbacks.push('unexpected'); |
} |
function expectedTypeError(error) |
{ |
window.error = error; |
qyearsley
2016/08/26 00:49:38
Looks like we may be able to remove window.error;
jeffcarp
2016/08/26 01:26:40
It's not used elsewhere, so it looks like we can,
|
- shouldBe('error.name', '"TypeError"'); |
- testPassed("expectedTypeError was called."); |
+ assert_equals(error.name, 'TypeError'); |
+ calledCallbacks.push('expectedTypeError'); |
} |
function onIceChange1() |
{ |
if (pc.iceConnectionState === "completed") { |
- testPassed("iceConnectionState is completed"); |
- iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
- shouldNotThrow('pc.addIceCandidate(null, unexpectedCallback, unexpectedCallback).catch(expectedTypeError);'); |
- shouldNotThrow('pc.addIceCandidate({candidate: "candidate"}, unexpectedCallback, unexpectedCallback).catch(expectedTypeError);'); |
- shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallback).catch(expectedTypeError);'); |
- shouldNotThrow('pc.addIceCandidate(iceCandidate, unexpectedCallback, null).catch(expectedTypeError);'); |
- shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess1, unexpectedCallback);'); |
+ calledCallbacks.push('iceConnectionState complete'); |
+ iceCandidate = new RTCIceCandidate({candidate: "nano nano"}); |
+ pc.addIceCandidate(null, unexpectedCallback, unexpectedCallback).catch(expectedTypeError); |
+ pc.addIceCandidate({candidate: "candidate"}, unexpectedCallback, unexpectedCallback).catch(expectedTypeError); |
+ pc.addIceCandidate(iceCandidate, null, unexpectedCallback).catch(expectedTypeError); |
+ pc.addIceCandidate(iceCandidate, unexpectedCallback, null).catch(expectedTypeError); |
+ pc.addIceCandidate(iceCandidate, addIceCandidateSuccess1, unexpectedCallback); |
} |
} |
@@ -80,22 +90,21 @@ function testExecutionOrderClosedConnection() |
var iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, error => { |
window.error = error; |
- shouldBe('error.name', '"InvalidStateError"'); |
- shouldBe('error.toString()', '"InvalidStateError: The RTCPeerConnection\'s signalingState is \'closed\'."'); |
+ assert_equals(error.name, 'InvalidStateError'); |
+ assert_equals(error.toString(), 'InvalidStateError: The RTCPeerConnection\'s signalingState is \'closed\'.'); |
events[counter++] = 2; |
}); |
Promise.resolve().then(_ => { |
- events[counter++] = 3; |
- shouldBe('events', '[1,2,3]'); |
+ events[counter++] = 3; |
+ assert_array_equals(events, [1, 2, 3]); |
}); |
} |
-shouldNotThrow('testExecutionOrderClosedConnection()'); |
-shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); |
-pc.oniceconnectionstatechange = onIceChange1; |
+window.testRTC = async_test("Tests the RTCPeerConnection Ice functionality."); |
qyearsley
2016/08/26 00:49:38
For consistency, it seems like we should declare a
jeffcarp
2016/08/26 01:26:40
I'll check if there's a convention in other tests
|
-window.jsTestIsAsync = true; |
-window.successfullyParsed = true; |
+testExecutionOrderClosedConnection(); |
+pc = new webkitRTCPeerConnection(null, null); |
+pc.oniceconnectionstatechange = onIceChange1; |
</script> |
</body> |
</html> |