| Index: talk/app/webrtc/webrtcsession_unittest.cc
 | 
| diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc
 | 
| index a26954658045ff13753a5c6276c6fc6306277f5f..22921f8a6d3655982c1b04b2b0ef5d5a8d379712 100644
 | 
| --- a/talk/app/webrtc/webrtcsession_unittest.cc
 | 
| +++ b/talk/app/webrtc/webrtcsession_unittest.cc
 | 
| @@ -25,6 +25,8 @@
 | 
|   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
|   */
 | 
|  
 | 
| +#include <vector>
 | 
| +
 | 
|  #include "talk/app/webrtc/audiotrack.h"
 | 
|  #include "talk/app/webrtc/fakemetricsobserver.h"
 | 
|  #include "talk/app/webrtc/jsepicecandidate.h"
 | 
| @@ -244,12 +246,52 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
 | 
|    }
 | 
|    virtual ~WebRtcSessionForTest() {}
 | 
|  
 | 
| -  using cricket::BaseSession::GetTransportProxy;
 | 
| +  // Note that these methods are only safe to use if the signaling thread
 | 
| +  // is the same as the worker thread
 | 
| +  cricket::TransportChannel* voice_rtp_transport_channel() {
 | 
| +    return rtp_transport_channel(voice_channel());
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* voice_rtcp_transport_channel() {
 | 
| +    return rtcp_transport_channel(voice_channel());
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* video_rtp_transport_channel() {
 | 
| +    return rtp_transport_channel(video_channel());
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* video_rtcp_transport_channel() {
 | 
| +    return rtcp_transport_channel(video_channel());
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* data_rtp_transport_channel() {
 | 
| +    return rtp_transport_channel(data_channel());
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* data_rtcp_transport_channel() {
 | 
| +    return rtcp_transport_channel(data_channel());
 | 
| +  }
 | 
| +
 | 
|    using webrtc::WebRtcSession::SetAudioPlayout;
 | 
|    using webrtc::WebRtcSession::SetAudioSend;
 | 
|    using webrtc::WebRtcSession::SetCaptureDevice;
 | 
|    using webrtc::WebRtcSession::SetVideoPlayout;
 | 
|    using webrtc::WebRtcSession::SetVideoSend;
 | 
| +
 | 
| + private:
 | 
| +  cricket::TransportChannel* rtp_transport_channel(cricket::BaseChannel* ch) {
 | 
| +    if (!ch) {
 | 
| +      return nullptr;
 | 
| +    }
 | 
| +    return ch->transport_channel();
 | 
| +  }
 | 
| +
 | 
| +  cricket::TransportChannel* rtcp_transport_channel(cricket::BaseChannel* ch) {
 | 
| +    if (!ch) {
 | 
| +      return nullptr;
 | 
| +    }
 | 
| +    return ch->rtcp_transport_channel();
 | 
| +  }
 | 
|  };
 | 
|  
 | 
|  class WebRtcSessionCreateSDPObserverForTest
 | 
| @@ -346,8 +388,8 @@ class WebRtcSessionTest : public testing::Test {
 | 
|          stun_servers,
 | 
|          SocketAddress(), SocketAddress(), SocketAddress()));
 | 
|      allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP |
 | 
| -                         cricket::PORTALLOCATOR_DISABLE_RELAY |
 | 
| -                         cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
 | 
| +                          cricket::PORTALLOCATOR_DISABLE_RELAY |
 | 
| +                          cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
 | 
|      EXPECT_TRUE(channel_manager_->Init());
 | 
|      desc_factory_->set_add_legacy_streams(false);
 | 
|      allocator_->set_step_delay(cricket::kMinimumStepDelay);
 | 
| @@ -467,13 +509,6 @@ class WebRtcSessionTest : public testing::Test {
 | 
|              session_->video_channel() != NULL);
 | 
|    }
 | 
|  
 | 
| -  void CheckTransportChannels() const {
 | 
| -    EXPECT_TRUE(session_->GetChannel(cricket::CN_AUDIO, 1) != NULL);
 | 
| -    EXPECT_TRUE(session_->GetChannel(cricket::CN_AUDIO, 2) != NULL);
 | 
| -    EXPECT_TRUE(session_->GetChannel(cricket::CN_VIDEO, 1) != NULL);
 | 
| -    EXPECT_TRUE(session_->GetChannel(cricket::CN_VIDEO, 2) != NULL);
 | 
| -  }
 | 
| -
 | 
|    void VerifyCryptoParams(const cricket::SessionDescription* sdp) {
 | 
|      ASSERT_TRUE(session_.get() != NULL);
 | 
|      const cricket::ContentInfo* content = cricket::GetFirstAudioContent(sdp);
 | 
| @@ -944,15 +979,10 @@ class WebRtcSessionTest : public testing::Test {
 | 
|      SetRemoteDescriptionWithoutError(new_answer);
 | 
|      EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
 | 
|      EXPECT_EQ(expected_candidate_num, observer_.mline_0_candidates_.size());
 | 
| -    EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size());
 | 
| -    for (size_t i = 0; i < observer_.mline_0_candidates_.size(); ++i) {
 | 
| -      cricket::Candidate c0 = observer_.mline_0_candidates_[i];
 | 
| -      cricket::Candidate c1 = observer_.mline_1_candidates_[i];
 | 
| -      if (bundle) {
 | 
| -        EXPECT_TRUE(c0.IsEquivalent(c1));
 | 
| -      } else {
 | 
| -        EXPECT_FALSE(c0.IsEquivalent(c1));
 | 
| -      }
 | 
| +    if (bundle) {
 | 
| +      EXPECT_EQ(0, observer_.mline_1_candidates_.size());
 | 
| +    } else {
 | 
| +      EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size());
 | 
|      }
 | 
|    }
 | 
|    // Tests that we can only send DTMF when the dtmf codec is supported.
 | 
| @@ -977,7 +1007,7 @@ class WebRtcSessionTest : public testing::Test {
 | 
|    // initial ICE convergences.
 | 
|  
 | 
|    class LoopbackNetworkConfiguration {
 | 
| -  public:
 | 
| +   public:
 | 
|      LoopbackNetworkConfiguration()
 | 
|          : test_ipv6_network_(false),
 | 
|            test_extra_ipv4_network_(false),
 | 
| @@ -1114,11 +1144,8 @@ class WebRtcSessionTest : public testing::Test {
 | 
|  
 | 
|      // Clearing the rules, session should move back to completed state.
 | 
|      loopback_network_manager.ClearRules(fss_.get());
 | 
| -    // Session is automatically calling OnSignalingReady after creation of
 | 
| -    // new portallocator session which will allocate new set of candidates.
 | 
|  
 | 
|      LOG(LS_INFO) << "Firewall Rules cleared";
 | 
| -
 | 
|      EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
 | 
|                     observer_.ice_connection_state_,
 | 
|                     kIceCandidatesTimeout);
 | 
| @@ -1142,9 +1169,11 @@ class WebRtcSessionTest : public testing::Test {
 | 
|  
 | 
|    void VerifyTransportType(const std::string& content_name,
 | 
|                             cricket::TransportProtocol protocol) {
 | 
| -    const cricket::Transport* transport = session_->GetTransport(content_name);
 | 
| -    ASSERT_TRUE(transport != NULL);
 | 
| -    EXPECT_EQ(protocol, transport->protocol());
 | 
| +    // TODO(deadbeef): this gets deleted with Peter's CL
 | 
| +    //  const cricket::Transport* transport =
 | 
| +    //  session_->GetTransport(content_name);
 | 
| +    //  ASSERT_TRUE(transport != NULL);
 | 
| +    //  EXPECT_EQ(protocol, transport->protocol());
 | 
|    }
 | 
|  
 | 
|    // Adds CN codecs to FakeMediaEngine and MediaDescriptionFactory.
 | 
| @@ -1667,15 +1696,14 @@ TEST_F(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) {
 | 
|  // a DTLS fingerprint when DTLS is required.
 | 
|  TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
 | 
|    MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
 | 
| -  // Enable both SDES and DTLS, so that offer won't be outright rejected as a
 | 
| -  // result of using the "UDP/TLS/RTP/SAVPF" profile.
 | 
|    InitWithDtls();
 | 
| -  session_->SetSdesPolicy(cricket::SEC_ENABLED);
 | 
|    SessionDescriptionInterface* offer = CreateOffer();
 | 
|    cricket::MediaSessionOptions options;
 | 
|    options.recv_video = true;
 | 
| +  rtc::scoped_ptr<SessionDescriptionInterface> temp_offer(
 | 
| +      CreateRemoteOffer(options, cricket::SEC_ENABLED));
 | 
|    JsepSessionDescription* answer =
 | 
| -      CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED);
 | 
| +      CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED);
 | 
|  
 | 
|    // SetRemoteDescription and SetLocalDescription will take the ownership of
 | 
|    // the offer and answer.
 | 
| @@ -1977,7 +2005,7 @@ TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) {
 | 
|    EXPECT_LT(0u, candidates->count());
 | 
|    candidates = local_desc->candidates(1);
 | 
|    ASSERT_TRUE(candidates != NULL);
 | 
| -  EXPECT_LT(0u, candidates->count());
 | 
| +  EXPECT_EQ(0u, candidates->count());
 | 
|  
 | 
|    // Update the session descriptions.
 | 
|    mediastream_signaling_.SendAudioVideoStream1();
 | 
| @@ -1989,7 +2017,7 @@ TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) {
 | 
|    EXPECT_LT(0u, candidates->count());
 | 
|    candidates = local_desc->candidates(1);
 | 
|    ASSERT_TRUE(candidates != NULL);
 | 
| -  EXPECT_LT(0u, candidates->count());
 | 
| +  EXPECT_EQ(0u, candidates->count());
 | 
|  }
 | 
|  
 | 
|  // Test that we can set a remote session description with remote candidates.
 | 
| @@ -2033,23 +2061,17 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
 | 
|    // Wait until at least one local candidate has been collected.
 | 
|    EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(),
 | 
|                     kIceCandidatesTimeout);
 | 
| -  EXPECT_TRUE_WAIT(0u < observer_.mline_1_candidates_.size(),
 | 
| -                   kIceCandidatesTimeout);
 | 
|  
 | 
|    rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
 | 
|  
 | 
|    ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
 | 
|    EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
 | 
| -  ASSERT_TRUE(local_offer->candidates(kMediaContentIndex1) != NULL);
 | 
| -  EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex1)->count());
 | 
|  
 | 
|    SessionDescriptionInterface* remote_offer(CreateRemoteOffer());
 | 
|    SetRemoteDescriptionWithoutError(remote_offer);
 | 
|    SessionDescriptionInterface* answer = CreateAnswer(NULL);
 | 
|    ASSERT_TRUE(answer->candidates(kMediaContentIndex0) != NULL);
 | 
|    EXPECT_LT(0u, answer->candidates(kMediaContentIndex0)->count());
 | 
| -  ASSERT_TRUE(answer->candidates(kMediaContentIndex1) != NULL);
 | 
| -  EXPECT_LT(0u, answer->candidates(kMediaContentIndex1)->count());
 | 
|    SetLocalDescriptionWithoutError(answer);
 | 
|  }
 | 
|  
 | 
| @@ -2091,8 +2113,14 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
 | 
|        CreateAnswer(NULL);
 | 
|    SetLocalDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("audio_content_name") != NULL);
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("video_content_name") != NULL);
 | 
| +  cricket::TransportChannel* voice_transport_channel =
 | 
| +      session_->voice_rtp_transport_channel();
 | 
| +  EXPECT_TRUE(voice_transport_channel != NULL);
 | 
| +  EXPECT_EQ(voice_transport_channel->content_name(), "audio_content_name");
 | 
| +  cricket::TransportChannel* video_transport_channel =
 | 
| +      session_->video_rtp_transport_channel();
 | 
| +  EXPECT_TRUE(video_transport_channel != NULL);
 | 
| +  EXPECT_EQ(video_transport_channel->content_name(), "video_content_name");
 | 
|    EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL);
 | 
|    EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL);
 | 
|  }
 | 
| @@ -2654,20 +2682,23 @@ TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) {
 | 
|    SessionDescriptionInterface* answer = CreateAnswer(NULL);
 | 
|    SetLocalDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_rtp_transport_channel(),
 | 
| +            session_->video_rtp_transport_channel());
 | 
|  
 | 
| -  cricket::Transport* t = session_->GetTransport("audio");
 | 
| +  cricket::BaseChannel* voice_channel = session_->voice_channel();
 | 
| +  ASSERT(voice_channel != NULL);
 | 
|  
 | 
|    // Checks if one of the transport channels contains a connection using a given
 | 
|    // port.
 | 
| -  auto connection_with_remote_port = [t](int port) {
 | 
| -    cricket::TransportStats stats;
 | 
| -    t->GetStats(&stats);
 | 
| -    for (auto& chan_stat : stats.channel_stats) {
 | 
| -      for (auto& conn_info : chan_stat.connection_infos) {
 | 
| -        if (conn_info.remote_candidate.address().port() == port) {
 | 
| -          return true;
 | 
| +  auto connection_with_remote_port = [this, voice_channel](int port) {
 | 
| +    cricket::SessionStats stats;
 | 
| +    session_->GetChannelTransportStats(voice_channel, &stats);
 | 
| +    for (auto& kv : stats.transport_stats) {
 | 
| +      for (auto& chan_stat : kv.second.channel_stats) {
 | 
| +        for (auto& conn_info : chan_stat.connection_infos) {
 | 
| +          if (conn_info.remote_candidate.address().port() == port) {
 | 
| +            return true;
 | 
| +          }
 | 
|          }
 | 
|        }
 | 
|      }
 | 
| @@ -2720,7 +2751,7 @@ TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) {
 | 
|    EXPECT_FALSE(connection_with_remote_port(6000));
 | 
|  }
 | 
|  
 | 
| -// kBundlePolicyBalanced bundle policy and answer contains BUNDLE.
 | 
| +// kBundlePolicyBalanced BUNDLE policy and answer contains BUNDLE.
 | 
|  TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) {
 | 
|    InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
 | 
|    mediastream_signaling_.SendAudioVideoStream1();
 | 
| @@ -2731,19 +2762,19 @@ TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|    SessionDescriptionInterface* answer =
 | 
|        CreateRemoteAnswer(session_->local_description());
 | 
|    SetRemoteDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  }
 | 
|  
 | 
| -// kBundlePolicyBalanced bundle policy but no BUNDLE in the answer.
 | 
| +// kBundlePolicyBalanced BUNDLE policy but no BUNDLE in the answer.
 | 
|  TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) {
 | 
|    InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
 | 
|    mediastream_signaling_.SendAudioVideoStream1();
 | 
| @@ -2754,8 +2785,8 @@ TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|  
 | 
| @@ -2769,8 +2800,8 @@ TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) {
 | 
|    modified_answer->Initialize(answer_copy, "1", "1");
 | 
|    SetRemoteDescriptionWithoutError(modified_answer);  //
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  }
 | 
|  
 | 
|  // kBundlePolicyMaxBundle policy with BUNDLE in the answer.
 | 
| @@ -2784,16 +2815,51 @@ TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|    SessionDescriptionInterface* answer =
 | 
|        CreateRemoteAnswer(session_->local_description());
 | 
|    SetRemoteDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_rtp_transport_channel(),
 | 
| +            session_->video_rtp_transport_channel());
 | 
| +}
 | 
| +
 | 
| +// kBundlePolicyMaxBundle policy with BUNDLE in the answer, but no
 | 
| +// audio content in the answer.
 | 
| +TEST_F(WebRtcSessionTest, TestMaxBundleRejectAudio) {
 | 
| +  InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle);
 | 
| +  mediastream_signaling_.SendAudioVideoStream1();
 | 
| +
 | 
| +  PeerConnectionInterface::RTCOfferAnswerOptions options;
 | 
| +  options.use_rtp_mux = true;
 | 
| +
 | 
| +  SessionDescriptionInterface* offer = CreateOffer(options);
 | 
| +  SetLocalDescriptionWithoutError(offer);
 | 
| +
 | 
| +  std::string voice_content_name = session_->voice_channel()->content_name();
 | 
| +  std::string video_content_name = session_->video_channel()->content_name();
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
| +
 | 
| +  mediastream_signaling_.SendAudioVideoStream2();
 | 
| +  cricket::MediaSessionOptions recv_options;
 | 
| +  recv_options.recv_audio = false;
 | 
| +  recv_options.recv_video = true;
 | 
| +  SessionDescriptionInterface* answer =
 | 
| +      CreateRemoteAnswer(session_->local_description(), recv_options);
 | 
| +  SetRemoteDescriptionWithoutError(answer);
 | 
| +
 | 
| +  EXPECT_TRUE(NULL == session_->voice_channel());
 | 
| +  EXPECT_TRUE(NULL != session_->video_channel()->transport_channel());
 | 
| +
 | 
| +  session_->Terminate();
 | 
| +  EXPECT_TRUE(NULL == session_->voice_rtp_transport_channel());
 | 
| +  EXPECT_TRUE(NULL == session_->voice_rtcp_transport_channel());
 | 
| +  EXPECT_TRUE(NULL == session_->video_rtp_transport_channel());
 | 
| +  EXPECT_TRUE(NULL == session_->video_rtcp_transport_channel());
 | 
|  }
 | 
|  
 | 
|  // kBundlePolicyMaxBundle policy but no BUNDLE in the answer.
 | 
| @@ -2807,8 +2873,8 @@ TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|  
 | 
| @@ -2822,8 +2888,8 @@ TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) {
 | 
|    modified_answer->Initialize(answer_copy, "1", "1");
 | 
|    SetRemoteDescriptionWithoutError(modified_answer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  }
 | 
|  
 | 
|  // kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE.
 | 
| @@ -2837,8 +2903,8 @@ TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|    SessionDescriptionInterface* answer =
 | 
| @@ -2847,11 +2913,11 @@ TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) {
 | 
|  
 | 
|    // This should lead to an audio-only call but isn't implemented
 | 
|    // correctly yet.
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  }
 | 
|  
 | 
| -// kBundlePolicyMaxCompat bundle policy but no BUNDLE in the answer.
 | 
| +// kBundlePolicyMaxCompat BUNDLE policy but no BUNDLE in the answer.
 | 
|  TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) {
 | 
|    InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat);
 | 
|    mediastream_signaling_.SendAudioVideoStream1();
 | 
| @@ -2861,8 +2927,8 @@ TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|  
 | 
| @@ -2876,8 +2942,8 @@ TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) {
 | 
|    modified_answer->Initialize(answer_copy, "1", "1");
 | 
|    SetRemoteDescriptionWithoutError(modified_answer);  //
 | 
|  
 | 
| -  EXPECT_NE(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_NE(session_->voice_channel()->transport_channel(),
 | 
| +            session_->video_channel()->transport_channel());
 | 
|  }
 | 
|  
 | 
|  // kBundlePolicyMaxbundle and then we call SetRemoteDescription first.
 | 
| @@ -2891,8 +2957,8 @@ TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetRemoteDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_EQ(session_->GetTransportProxy("audio")->impl(),
 | 
| -            session_->GetTransportProxy("video")->impl());
 | 
| +  EXPECT_EQ(session_->voice_rtp_transport_channel(),
 | 
| +            session_->video_rtp_transport_channel());
 | 
|  }
 | 
|  
 | 
|  TEST_F(WebRtcSessionTest, TestRequireRtcpMux) {
 | 
| @@ -2903,16 +2969,16 @@ TEST_F(WebRtcSessionTest, TestRequireRtcpMux) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2));
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2));
 | 
| +  EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
 | 
| +  EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|    SessionDescriptionInterface* answer =
 | 
|        CreateRemoteAnswer(session_->local_description());
 | 
|    SetRemoteDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2));
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2));
 | 
| +  EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
 | 
| +  EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
 | 
|  }
 | 
|  
 | 
|  TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) {
 | 
| @@ -2923,16 +2989,16 @@ TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) {
 | 
|    SessionDescriptionInterface* offer = CreateOffer(options);
 | 
|    SetLocalDescriptionWithoutError(offer);
 | 
|  
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("audio")->impl()->HasChannel(2));
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("video")->impl()->HasChannel(2));
 | 
| +  EXPECT_TRUE(session_->voice_rtcp_transport_channel() != NULL);
 | 
| +  EXPECT_TRUE(session_->video_rtcp_transport_channel() != NULL);
 | 
|  
 | 
|    mediastream_signaling_.SendAudioVideoStream2();
 | 
|    SessionDescriptionInterface* answer =
 | 
|        CreateRemoteAnswer(session_->local_description());
 | 
|    SetRemoteDescriptionWithoutError(answer);
 | 
|  
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2));
 | 
| -  EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2));
 | 
| +  EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
 | 
| +  EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
 | 
|  }
 | 
|  
 | 
|  // This test verifies that SetLocalDescription and SetRemoteDescription fails
 | 
| @@ -2953,11 +3019,11 @@ TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
 | 
|    rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(),
 | 
|                               xrtcp_mux.c_str(), xrtcp_mux.length(),
 | 
|                               &offer_str);
 | 
| -  JsepSessionDescription *local_offer =
 | 
| +  JsepSessionDescription* local_offer =
 | 
|        new JsepSessionDescription(JsepSessionDescription::kOffer);
 | 
|    EXPECT_TRUE((local_offer)->Initialize(offer_str, NULL));
 | 
|    SetLocalDescriptionOfferExpectError(kBundleWithoutRtcpMux, local_offer);
 | 
| -  JsepSessionDescription *remote_offer =
 | 
| +  JsepSessionDescription* remote_offer =
 | 
|        new JsepSessionDescription(JsepSessionDescription::kOffer);
 | 
|    EXPECT_TRUE((remote_offer)->Initialize(offer_str, NULL));
 | 
|    SetRemoteDescriptionOfferExpectError(kBundleWithoutRtcpMux, remote_offer);
 | 
| @@ -3168,7 +3234,6 @@ TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
 | 
|  
 | 
|    SetRemoteDescriptionWithoutError(answer);
 | 
|    VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
 | 
| -  VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
 | 
|  }
 | 
|  
 | 
|  // This test verifies the ice protocol type at receiver side of the call if
 | 
| @@ -3181,7 +3246,6 @@ TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
 | 
|    SessionDescriptionInterface* answer = CreateAnswer(NULL);
 | 
|    SetLocalDescriptionWithoutError(answer);
 | 
|    VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
 | 
| -  VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
 | 
|  }
 | 
|  
 | 
|  // Verifing local offer and remote answer have matching m-lines as per RFC 3264.
 | 
| @@ -3269,8 +3333,8 @@ TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
 | 
|                                    candidate1);
 | 
|    EXPECT_TRUE(offer->AddCandidate(&ice_candidate1));
 | 
|    SetRemoteDescriptionWithoutError(offer);
 | 
| -  ASSERT_TRUE(session_->GetTransportProxy("audio") != NULL);
 | 
| -  ASSERT_TRUE(session_->GetTransportProxy("video") != NULL);
 | 
| +  ASSERT_TRUE(session_->voice_rtp_transport_channel() != NULL);
 | 
| +  ASSERT_TRUE(session_->video_rtp_transport_channel() != NULL);
 | 
|  
 | 
|    // Pump for 1 second and verify that no candidates are generated.
 | 
|    rtc::Thread::Current()->ProcessMessages(1000);
 | 
| @@ -3279,8 +3343,6 @@ TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
 | 
|  
 | 
|    SessionDescriptionInterface* answer = CreateAnswer(NULL);
 | 
|    SetLocalDescriptionWithoutError(answer);
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("audio")->negotiated());
 | 
| -  EXPECT_TRUE(session_->GetTransportProxy("video")->negotiated());
 | 
|    EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
 | 
|  }
 | 
|  
 | 
| @@ -3315,7 +3377,7 @@ TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) {
 | 
|    // will be set as per MediaSessionDescriptionFactory.
 | 
|    std::string offer_str;
 | 
|    offer->ToString(&offer_str);
 | 
| -  SessionDescriptionInterface *jsep_offer_str =
 | 
| +  SessionDescriptionInterface* jsep_offer_str =
 | 
|        CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL);
 | 
|    SetLocalDescriptionWithoutError(jsep_offer_str);
 | 
|    EXPECT_FALSE(session_->voice_channel()->secure_required());
 | 
| 
 |