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

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1229283003: Refactor the relationship between BaseChannel and MediaChannel so that we send over all the paramet… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove duplication Created 5 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 unified diff | Download patch
« talk/session/media/channel.cc ('K') | « talk/session/media/channel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // Both sides agree on mux. Should no longer be a separate RTCP channel. 611 // Both sides agree on mux. Should no longer be a separate RTCP channel.
612 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); 612 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL);
613 // Only initiator supports mux. Should still have a separate RTCP channel. 613 // Only initiator supports mux. Should still have a separate RTCP channel.
614 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); 614 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL));
615 content.set_rtcp_mux(false); 615 content.set_rtcp_mux(false);
616 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); 616 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL));
617 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); 617 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL));
618 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL); 618 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL);
619 } 619 }
620 620
621 // Test that SetLocalContent and SetRemoteContent properly set
622 // video options to the media channel.
623 void TestSetContentsVideoOptions() {
624 CreateChannels(0, 0);
625 typename T::Content content;
626 CreateContent(0, kPcmuCodec, kH264Codec, &content);
627 content.set_buffered_mode_latency(101);
628 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
629 EXPECT_EQ(0U, media_channel1_->codecs().size());
630 cricket::VideoOptions options;
631 ASSERT_TRUE(media_channel1_->GetOptions(&options));
632 int latency = 0;
633 EXPECT_TRUE(options.buffered_mode_latency.Get(&latency));
634 EXPECT_EQ(101, latency);
635 content.set_buffered_mode_latency(102);
636 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
637 ASSERT_EQ(1U, media_channel1_->codecs().size());
638 EXPECT_TRUE(CodecMatches(content.codecs()[0],
639 media_channel1_->codecs()[0]));
640 ASSERT_TRUE(media_channel1_->GetOptions(&options));
641 EXPECT_TRUE(options.buffered_mode_latency.Get(&latency));
642 EXPECT_EQ(102, latency);
643 }
644
645 // Test that SetRemoteContent properly deals with a content update. 621 // Test that SetRemoteContent properly deals with a content update.
646 void TestSetRemoteContentUpdate() { 622 void TestSetRemoteContentUpdate() {
647 CreateChannels(0, 0); 623 CreateChannels(0, 0);
648 typename T::Content content; 624 typename T::Content content;
649 CreateContent(RTCP | RTCP_MUX | SECURE, 625 CreateContent(RTCP | RTCP_MUX | SECURE,
650 kPcmuCodec, kH264Codec, 626 kPcmuCodec, kH264Codec,
651 &content); 627 &content);
652 EXPECT_EQ(0U, media_channel1_->codecs().size()); 628 EXPECT_EQ(0U, media_channel1_->codecs().size());
653 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 629 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
654 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 630 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 } 2379 }
2404 2380
2405 TEST_F(VideoChannelTest, TestSetContentsRtcpMux) { 2381 TEST_F(VideoChannelTest, TestSetContentsRtcpMux) {
2406 Base::TestSetContentsRtcpMux(); 2382 Base::TestSetContentsRtcpMux();
2407 } 2383 }
2408 2384
2409 TEST_F(VideoChannelTest, TestSetContentsRtcpMuxWithPrAnswer) { 2385 TEST_F(VideoChannelTest, TestSetContentsRtcpMuxWithPrAnswer) {
2410 Base::TestSetContentsRtcpMux(); 2386 Base::TestSetContentsRtcpMux();
2411 } 2387 }
2412 2388
2413 TEST_F(VideoChannelTest, TestSetContentsVideoOptions) {
2414 Base::TestSetContentsVideoOptions();
2415 }
2416
2417 TEST_F(VideoChannelTest, TestSetRemoteContentUpdate) { 2389 TEST_F(VideoChannelTest, TestSetRemoteContentUpdate) {
2418 Base::TestSetRemoteContentUpdate(); 2390 Base::TestSetRemoteContentUpdate();
2419 } 2391 }
2420 2392
2421 TEST_F(VideoChannelTest, TestStreams) { 2393 TEST_F(VideoChannelTest, TestStreams) {
2422 Base::TestStreams(); 2394 Base::TestStreams();
2423 } 2395 }
2424 2396
2425 TEST_F(VideoChannelTest, TestScreencastEvents) { 2397 TEST_F(VideoChannelTest, TestScreencastEvents) {
2426 const int kTimeoutMs = 500; 2398 const int kTimeoutMs = 500;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 }; 2874 };
2903 rtc::Buffer payload(data, 3); 2875 rtc::Buffer payload(data, 3);
2904 cricket::SendDataResult result; 2876 cricket::SendDataResult result;
2905 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2877 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2906 EXPECT_EQ(params.ssrc, 2878 EXPECT_EQ(params.ssrc,
2907 media_channel1_->last_sent_data_params().ssrc); 2879 media_channel1_->last_sent_data_params().ssrc);
2908 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2880 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2909 } 2881 }
2910 2882
2911 // TODO(pthatcher): TestSetReceiver? 2883 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« talk/session/media/channel.cc ('K') | « talk/session/media/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698