Chromium Code Reviews

Side by Side Diff: talk/app/webrtc/peerconnectioninterface_unittest.cc

Issue 1538673002: Adding a MediaStream parameter to createSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 1180 matching lines...)
1191 stream->RemoveTrack(stream->GetVideoTracks()[0]); 1191 stream->RemoveTrack(stream->GetVideoTracks()[0]);
1192 1192
1193 scoped_ptr<SessionDescriptionInterface> offer; 1193 scoped_ptr<SessionDescriptionInterface> offer;
1194 ASSERT_TRUE(DoCreateOffer(offer.use(), nullptr)); 1194 ASSERT_TRUE(DoCreateOffer(offer.use(), nullptr));
1195 1195
1196 const cricket::MediaContentDescription* video_desc = 1196 const cricket::MediaContentDescription* video_desc =
1197 cricket::GetFirstVideoContentDescription(offer->description()); 1197 cricket::GetFirstVideoContentDescription(offer->description());
1198 EXPECT_TRUE(video_desc == nullptr); 1198 EXPECT_TRUE(video_desc == nullptr);
1199 } 1199 }
1200 1200
1201 // Test creating a sender with a stream, and ensure the stream ID is populated
1202 // in the offer.
1203 TEST_F(PeerConnectionInterfaceTest, CreateSenderWithStream) {
1204 CreatePeerConnection();
1205 // Start by adding a voice track, then add a video sender with the same stream
1206 // label.
1207 AddVoiceStream(kStreamLabel1);
1208 MediaStreamInterface* stream = pc_->local_streams()->at(0);
1209 pc_->CreateSender("video", stream);
1210
1211 scoped_ptr<SessionDescriptionInterface> offer;
1212 ASSERT_TRUE(DoCreateOffer(offer.use(), nullptr));
1213
1214 const cricket::MediaContentDescription* video_desc =
1215 cricket::GetFirstVideoContentDescription(offer->description());
1216 ASSERT_TRUE(video_desc != nullptr);
1217 ASSERT_EQ(1u, video_desc->streams().size());
1218 EXPECT_EQ(kStreamLabel1, video_desc->streams()[0].sync_label);
1219 }
1220
1201 // Test that we can specify a certain track that we want statistics about. 1221 // Test that we can specify a certain track that we want statistics about.
1202 TEST_F(PeerConnectionInterfaceTest, GetStatsForSpecificTrack) { 1222 TEST_F(PeerConnectionInterfaceTest, GetStatsForSpecificTrack) {
1203 InitiateCall(); 1223 InitiateCall();
1204 ASSERT_LT(0u, pc_->remote_streams()->count()); 1224 ASSERT_LT(0u, pc_->remote_streams()->count());
1205 ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size()); 1225 ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size());
1206 scoped_refptr<MediaStreamTrackInterface> remote_audio = 1226 scoped_refptr<MediaStreamTrackInterface> remote_audio =
1207 pc_->remote_streams()->at(0)->GetAudioTracks()[0]; 1227 pc_->remote_streams()->at(0)->GetAudioTracks()[0];
1208 EXPECT_TRUE(DoGetStats(remote_audio)); 1228 EXPECT_TRUE(DoGetStats(remote_audio));
1209 1229
1210 // Remove the stream. Since we are sending to our selves the local 1230 // Remove the stream. Since we are sending to our selves the local
(...skipping 1180 matching lines...)
2391 FakeConstraints updated_answer_c; 2411 FakeConstraints updated_answer_c;
2392 answer_c.SetMandatoryReceiveAudio(false); 2412 answer_c.SetMandatoryReceiveAudio(false);
2393 answer_c.SetMandatoryReceiveVideo(false); 2413 answer_c.SetMandatoryReceiveVideo(false);
2394 2414
2395 cricket::MediaSessionOptions updated_answer_options; 2415 cricket::MediaSessionOptions updated_answer_options;
2396 EXPECT_TRUE( 2416 EXPECT_TRUE(
2397 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); 2417 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options));
2398 EXPECT_TRUE(updated_answer_options.has_audio()); 2418 EXPECT_TRUE(updated_answer_options.has_audio());
2399 EXPECT_TRUE(updated_answer_options.has_video()); 2419 EXPECT_TRUE(updated_answer_options.has_video());
2400 } 2420 }
OLDNEW

Powered by Google App Engine