Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html

Issue 2273363004: Convert RTCPeerConnection-ice test from js-test.js to testharness.js (Closed)
Patch Set: Address feedback, assign and address window variables explicitly Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9e08154d75b27c2e3dc6d92df542945b39450df8 100644
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice.html
@@ -1,72 +1,77 @@
<!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;
-
function onIceChange2()
{
- if (pc.iceConnectionState === "closed") {
- testPassed("iceConnectionState is closed.");
- finishJSTest();
+ if (window.pc.iceConnectionState === "closed") {
+ calledCallbacks.push("iceConnectionState closed");
+ assert_array_equals(calledCallbacks, [
+ 'iceConnectionState complete',
+ 'expectedTypeError',
+ 'expectedTypeError',
+ 'expectedTypeError',
+ 'expectedTypeError',
+ 'success1',
+ 'success2',
+ 'success3',
+ 'success4',
+ 'iceConnectionState closed'
+ ]);
+ window.testRTC.done();
qyearsley 2016/09/06 16:09:36 I was experimenting with trying to get convert tes
jeffcarp 2016/09/06 17:26:38 When I was testing this I remember it failing quic
}
}
function addIceCandidateSuccess1()
{
- testPassed("addIceCandidateSuccess1 was called.");
- shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0}, addIceCandidateSuccess2, unexpectedCallback);');
+ calledCallbacks.push('success1');
+ window.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');
+ window.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');
+ window.pc.addIceCandidate({candidate: "candidate", sdpMid: 0, sdpMLineIndex: 0}, addIceCandidateSuccess4, unexpectedCallback);
}
function addIceCandidateSuccess4()
{
- testPassed("addIceCandidateSuccess4 was called.");
- pc.oniceconnectionstatechange = onIceChange2;
- pc.close();
+ calledCallbacks.push('success4');
+ window.pc.oniceconnectionstatechange = onIceChange2;
+ window.pc.close();
}
function unexpectedCallback()
{
- testFailed("unexpectedCallback was called.");
- finishJSTest();
+ calledCallbacks.push('unexpected');
}
function expectedTypeError(error)
{
- window.error = error;
- 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);');
+ if (window.pc.iceConnectionState === "completed") {
+ calledCallbacks.push('iceConnectionState complete');
+ var iceCandidate = new RTCIceCandidate({candidate: "nano nano"});
+ window.pc.addIceCandidate(null, unexpectedCallback, unexpectedCallback).catch(expectedTypeError);
+ window.pc.addIceCandidate({candidate: "candidate"}, unexpectedCallback, unexpectedCallback).catch(expectedTypeError);
+ window.pc.addIceCandidate(iceCandidate, null, unexpectedCallback).catch(expectedTypeError);
+ window.pc.addIceCandidate(iceCandidate, unexpectedCallback, null).catch(expectedTypeError);
+ window.pc.addIceCandidate(iceCandidate, addIceCandidateSuccess1, unexpectedCallback);
}
}
@@ -79,23 +84,22 @@ function testExecutionOrderClosedConnection()
Promise.resolve().then(_ => events[counter++] = 1);
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.calledCallbacks = [];
+window.testRTC = async_test("Tests the RTCPeerConnection Ice functionality.");
-window.jsTestIsAsync = true;
-window.successfullyParsed = true;
+testExecutionOrderClosedConnection();
+window.pc = new webkitRTCPeerConnection(null, null);
+window.pc.oniceconnectionstatechange = onIceChange1;
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ice-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698