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

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

Issue 2280283002: Convert RTCPeerConnection-AddRemoveStream tests from js-test to testharness.js (Closed)
Patch Set: 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-AddRemoveStream-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-AddRemoveStream.html
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
index 6e8564a6386d135c43a74b532c430d7641274379..9190a62c9af4110421d0bc9cd424888046ee2254 100644
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
@@ -1,81 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
-<script src="../../resources/js-test.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
-description("Tests RTCPeerConnection [add|remove]Stream.");
+var testRTC = async_test('Tests RTCPeerConnection [add|remove]Stream.');
-var stream = null;
-var stream2 = null;
var pc = null;
-
-function error() {
- testFailed('Stream generation failed.');
- finishJSTest();
-}
-
-function getUserMedia(dictionary, callback) {
- try {
- navigator.webkitGetUserMedia(dictionary, callback, error);
- } catch (e) {
- testFailed('webkitGetUserMedia threw exception :' + e);
- finishJSTest();
- }
-}
-
-function onErroneousNegotiationNeeded() {
- testFailed('onErroneousNegotiationNeeded was called.');
- finishJSTest();
-}
-
-function onRemoveStream(event) {
- testPassed('onRemoveStream was called.');
-
- shouldBe('pc.getLocalStreams().length', '0');
-
- finishJSTest();
-}
-
-function onAddStream(event) {
- testPassed('onAddStream was called.');
-
- shouldBe('pc.getStreamById(stream.id)', 'stream');
- shouldBe('pc.getStreamById(stream2.id)', 'null');
-
- pc.onnegotiationneeded = onErroneousNegotiationNeeded;
- pc.addStream(stream);
- shouldBe('pc.getLocalStreams().length', '1');
- pc.removeStream(stream2);
- shouldBe('pc.getLocalStreams().length', '1');
-
- pc.onnegotiationneeded = onRemoveStream;
- pc.removeStream(stream);
-}
-
-function gotStream2(s) {
- testPassed('Got another stream.');
- stream2 = s;
-
- shouldBeFalse("stream.id === stream2.id");
-
- pc = new webkitRTCPeerConnection(null, null);
- pc.onnegotiationneeded = onAddStream;
- pc.addStream(stream);
-}
-
-function gotStream1(s) {
- testPassed('Got a stream.');
- stream = s;
-
- getUserMedia({audio:true, video:true}, gotStream2);
-}
-
-getUserMedia({audio:true, video:true}, gotStream1);
-
-window.jsTestIsAsync = true;
-window.successfullyParsed = true;
+var options = {audio: true, video: true};
+var errorCallback = () => assert_unreached('Stream generation failed.');
+
+navigator.webkitGetUserMedia(options, (stream1) => {
+ navigator.webkitGetUserMedia(options, (stream2) => {
+ assert_false(stream1.id === stream2.id);
+
+ pc = new webkitRTCPeerConnection(null, null);
+
+ pc.onnegotiationneeded = (event) => {
+ assert_equals(pc.getStreamById(stream1.id), stream1);
+ assert_equals(pc.getStreamById(stream2.id), null);
+
+ pc.onnegotiationneeded = () => {
+ assert_unreached('onErroneousNegotiationNeeded was called.');
+ };
+
+ pc.addStream(stream1);
+ assert_equals(pc.getLocalStreams().length, 1);
+ pc.removeStream(stream2);
+ assert_equals(pc.getLocalStreams().length, 1);
+
+ pc.onnegotiationneeded = (event) => {
+ assert_equals(pc.getLocalStreams().length, 0);
+ testRTC.done();
+ };
+ pc.removeStream(stream1);
+ };
+
+ pc.addStream(stream1);
+ }, errorCallback);
+}, errorCallback);
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698