 Chromium Code Reviews
 Chromium Code Reviews Issue 1670153003:
  Introduce struct MediaConfig, with construction-time settings.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 1670153003:
  Introduce struct MediaConfig, with construction-time settings.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| Index: talk/app/webrtc/peerconnectioninterface_unittest.cc | 
| diff --git a/talk/app/webrtc/peerconnectioninterface_unittest.cc b/talk/app/webrtc/peerconnectioninterface_unittest.cc | 
| index 2388e71c04de7560ab9aaa6a0ba656fa1af6ba89..34ba0a05c2fce2fa7143b17bf86bfa4a23f32ad2 100644 | 
| --- a/talk/app/webrtc/peerconnectioninterface_unittest.cc | 
| +++ b/talk/app/webrtc/peerconnectioninterface_unittest.cc | 
| @@ -2355,6 +2355,45 @@ TEST_F(PeerConnectionInterfaceTest, SignalSameTracksInSeparateMediaStream) { | 
| EXPECT_TRUE(ContainsSender(senders, kVideoTracks[0])); | 
| } | 
| +class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { | 
| + public: | 
| + webrtc::MediaControllerInterface* CreateMediaController( | 
| + const cricket::MediaConfig &config) const override { | 
| + createmediacontroller_called = true; | 
| + createmediacontroller_config = config; | 
| + | 
| + webrtc::MediaControllerInterface* mc = | 
| + PeerConnectionFactory::CreateMediaController(config); | 
| + EXPECT_TRUE(mc != nullptr); | 
| + return mc; | 
| + } | 
| + | 
| + mutable bool createmediacontroller_called = false; | 
| 
pbos-webrtc
2016/02/09 15:31:43
create_media_controller_called
 
perkj_webrtc
2016/02/09 15:35:37
member variables should end with _, iereatemediaco
 
perkj_webrtc
2016/02/09 15:35:37
why mutable  ?
 
nisse-webrtc
2016/02/10 08:53:00
The CreateMediaController method is const. So I ne
 
nisse-webrtc
2016/02/10 08:53:00
Done.
 
nisse-webrtc
2016/02/10 08:53:00
Done.
 | 
| + mutable cricket::MediaConfig createmediacontroller_config; | 
| 
perkj_webrtc
2016/02/09 15:35:37
dito
 | 
| +}; | 
| + | 
| +// This test verifies DSCP constraint is recognized and passed to the | 
| +// CreateMediaController. | 
| +TEST(PeerConnection, TestDscpConstraint) { | 
| 
pbos-webrtc
2016/02/09 15:31:43
Can you add tests for the other options as well?
 
nisse-webrtc
2016/02/10 08:53:00
I guess so. We just need to find the right balance
 | 
| + scoped_refptr<PeerConnectionFactoryForTest> pcf( | 
| + new rtc::RefCountedObject<PeerConnectionFactoryForTest>()); | 
| + PeerConnectionInterface::RTCConfiguration config; | 
| + FakeConstraints constraints; | 
| + MockPeerConnectionObserver observer; | 
| 
perkj_webrtc
2016/02/09 15:35:37
move to where it is used.
 | 
| + scoped_refptr<PeerConnectionInterface> pc; | 
| 
perkj_webrtc
2016/02/09 15:35:37
declare when used.
 | 
| + constraints.AddOptional( | 
| + webrtc::MediaConstraintsInterface::kEnableDscp, true); | 
| 
perkj_webrtc
2016/02/09 15:35:37
also test calling with kEnableDscp false ?
 | 
| + pcf->Initialize(); | 
| + | 
| + EXPECT_FALSE(pcf->createmediacontroller_config.enable_dscp); | 
| + | 
| + pc = pcf->CreatePeerConnection(config, &constraints, | 
| + nullptr, nullptr, &observer); | 
| + EXPECT_TRUE(pc.get() != nullptr); | 
| + EXPECT_TRUE(pcf->createmediacontroller_called); | 
| + EXPECT_TRUE(pcf->createmediacontroller_config.enable_dscp); | 
| +} | 
| + | 
| // The following tests verify that session options are created correctly. | 
| // TODO(deadbeef): Convert these tests to be more end-to-end. Instead of | 
| // "verify options are converted correctly", should be "pass options into |