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

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

Issue 2767963002: Revert of Remove |remote| and |readonly| members of MediaStreamTrack. (Closed)
Patch Set: rebase Created 3 years, 9 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
Index: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html
new file mode 100644
index 0000000000000000000000000000000000000000..a693e494fe253c8dd4e6fad65db1ee435727413d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html
@@ -0,0 +1,86 @@
+<!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;
+ shouldBeFalse('local_stream.getAudioTracks()[0].remote');
+ shouldBeFalse('local_stream.getVideoTracks()[0].remote');
+ 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);
+ shouldBeTrue('event.stream.active')
+ shouldBeTrue('event.stream.getAudioTracks()[0].remote');
+ shouldBeTrue('event.stream.getVideoTracks()[0].remote');
+ pc.removeStream(local_stream);
+}
+
+function onRemoveStream(event) {
+ testPassed('remote stream was removed');
+ shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
+ shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
+ shouldBeFalse('event.stream.active')
+}
+
+pc = new RTCPeerConnection();
+pc.onaddstream = onAddStream;
+pc.onremovestream = onRemoveStream;
+getUserMedia({audio:true, video:true}, gotStream);
+
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698