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: LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html

Issue 607523002: Added layouttests for checking that RTCPeerConnection.onaddstream (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed spelling in expected.txt Created 6 years, 2 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 | LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html
diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html b/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html
new file mode 100644
index 0000000000000000000000000000000000000000..8e46faea26198e747e493880c3580c1d37f0aa65
--- /dev/null
+++ b/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description("Tests that an RTCPeerConnection can signal that remote streams are added and removed.");
+
+var pc = null;
+var local_stream = 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 requestSucceeded2()
+{
+ testPassed('requestSucceeded was called.');
+ shouldBeEqualToNumber('pc.getRemoteStreams().length', 0);
+ finishJSTest();
+}
+
+function requestSucceeded1()
+{
+ testPassed('requestSucceeded was called.');
+ shouldBeEqualToNumber('pc.getRemoteStreams().length', 1);
+
+ sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
+ shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailedUnexpectedly);');
+}
+
+function requestFailedUnexpectedly()
+{
+ testFailed('requestFailed was called.');
+ finishJSTest();
+}
+
+function gotStream(stream) {
+ local_stream = stream;
+ pc.addStream(local_stream);
+
+ sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
+ shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailedUnexpectedly);');
+}
+
+function onAddStream(event) {
+ testPassed('remote stream was added');
+ shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1);
+ shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1);
+ pc.removeStream(local_stream);
+}
+
+function onRemoveStream(event) {
+ testPassed('remote stream was removed');
+ shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
+ shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
+}
+
+pc = new webkitRTCPeerConnection(null, null);
+pc.onaddstream = onAddStream;
+pc.onremovestream = onRemoveStream;
+getUserMedia({audio:true, video:true}, gotStream);
+
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698