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

Unified Diff: chrome/test/data/webrtc/peerconnection_rtp.js

Issue 2972003002: RTCPeerConnection.ontrack event added. (Closed)
Patch Set: Le merge Created 3 years, 5 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: chrome/test/data/webrtc/peerconnection_rtp.js
diff --git a/chrome/test/data/webrtc/peerconnection_rtp.js b/chrome/test/data/webrtc/peerconnection_rtp.js
index 638ae8a3e48b3f65a1cb2eaf1c4daadf0665399f..adc0f71a2db2f58e946595f9208fbdd51d12ed82 100644
--- a/chrome/test/data/webrtc/peerconnection_rtp.js
+++ b/chrome/test/data/webrtc/peerconnection_rtp.js
@@ -4,6 +4,12 @@
* found in the LICENSE file.
*/
+/**
+ * ...
+ * @private
+ */
+var gOnTrackEvents = [];
+
// Public interface to tests. These are expected to be called with
// ExecuteJavascript invocations from the browser tests and will return answers
// through the DOM automation controller.
@@ -155,6 +161,46 @@ function createAndAddAudioAndVideoTrack(streamArgumentType) {
}
/**
+ * ...
+ */
+function setupOnTrackListener() {
+ peerConnection_().ontrack = function(event) {
+ console.log('HBOS ontrack: ' + event);
+ console.log('HBOS event.receiver: ' + event.receiver);
+ console.log('HBOS event.receiver.track: ' + event.receiver.track);
+ console.log('HBOS event.receiver.track.id: ' + event.receiver.track.id);
+ console.log('HBOS event.track: ' + event.track);
+ console.log('HBOS event.track.id: ' + event.track.id);
+ console.log('HBOS event.streams: ' + event.streams);
+ for (let i = 0; i < event.streams.length; ++i) {
+ console.log('HBOS event.streams[i]: ' + event.streams[i]);
+ console.log('HBOS event.streams[i].id: ' + event.streams[i].id);
+ }
+ gOnTrackEvents.push(event);
+ }
+ returnToTest('ok-ontrack-wired');
+}
+
+/**
+ * ...
+ */
+function getOnTrackEvents() {
+ let result = '';
+ gOnTrackEvents.forEach(function(event) {
+ if (event.receiver.track != event.track)
+ throw failTest('RTCTrackEvent\'s track does not match its receiver\'s.');
+ let eventString = 'RTCTrackEvent ' + event.track.id;
+ event.streams.forEach(function(stream) {
+ eventString += ' ' + stream.id;
+ });
+ if (result.length)
+ result += ' ';
+ result += eventString;
+ });
+ returnToTest('ok-' + result);
+}
+
+/**
* Calls |removeTrack| with the first sender that has the track with |trackId|
* and verifies the SDP is updated accordingly.
*

Powered by Google App Engine
This is Rietveld 408576698