Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2348 webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp, | 2348 webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp, |
| 2349 nullptr)); | 2349 nullptr)); |
| 2350 | 2350 |
| 2351 EXPECT_TRUE(DoSetLocalDescription(updated_desc.release())); | 2351 EXPECT_TRUE(DoSetLocalDescription(updated_desc.release())); |
| 2352 senders = pc_->GetSenders(); | 2352 senders = pc_->GetSenders(); |
| 2353 EXPECT_EQ(2u, senders.size()); | 2353 EXPECT_EQ(2u, senders.size()); |
| 2354 EXPECT_TRUE(ContainsSender(senders, kAudioTracks[0])); | 2354 EXPECT_TRUE(ContainsSender(senders, kAudioTracks[0])); |
| 2355 EXPECT_TRUE(ContainsSender(senders, kVideoTracks[0])); | 2355 EXPECT_TRUE(ContainsSender(senders, kVideoTracks[0])); |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { | |
| 2359 public: | |
| 2360 webrtc::MediaControllerInterface* CreateMediaController( | |
| 2361 const cricket::MediaConfig &config) const override { | |
| 2362 createmediacontroller_called = true; | |
| 2363 createmediacontroller_config = config; | |
| 2364 | |
| 2365 webrtc::MediaControllerInterface* mc = | |
| 2366 PeerConnectionFactory::CreateMediaController(config); | |
| 2367 EXPECT_TRUE(mc != nullptr); | |
| 2368 return mc; | |
| 2369 } | |
| 2370 | |
| 2371 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.
| |
| 2372 mutable cricket::MediaConfig createmediacontroller_config; | |
|
perkj_webrtc
2016/02/09 15:35:37
dito
| |
| 2373 }; | |
| 2374 | |
| 2375 // This test verifies DSCP constraint is recognized and passed to the | |
| 2376 // CreateMediaController. | |
| 2377 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
| |
| 2378 scoped_refptr<PeerConnectionFactoryForTest> pcf( | |
| 2379 new rtc::RefCountedObject<PeerConnectionFactoryForTest>()); | |
| 2380 PeerConnectionInterface::RTCConfiguration config; | |
| 2381 FakeConstraints constraints; | |
| 2382 MockPeerConnectionObserver observer; | |
|
perkj_webrtc
2016/02/09 15:35:37
move to where it is used.
| |
| 2383 scoped_refptr<PeerConnectionInterface> pc; | |
|
perkj_webrtc
2016/02/09 15:35:37
declare when used.
| |
| 2384 constraints.AddOptional( | |
| 2385 webrtc::MediaConstraintsInterface::kEnableDscp, true); | |
|
perkj_webrtc
2016/02/09 15:35:37
also test calling with kEnableDscp false ?
| |
| 2386 pcf->Initialize(); | |
| 2387 | |
| 2388 EXPECT_FALSE(pcf->createmediacontroller_config.enable_dscp); | |
| 2389 | |
| 2390 pc = pcf->CreatePeerConnection(config, &constraints, | |
| 2391 nullptr, nullptr, &observer); | |
| 2392 EXPECT_TRUE(pc.get() != nullptr); | |
| 2393 EXPECT_TRUE(pcf->createmediacontroller_called); | |
| 2394 EXPECT_TRUE(pcf->createmediacontroller_config.enable_dscp); | |
| 2395 } | |
| 2396 | |
| 2358 // The following tests verify that session options are created correctly. | 2397 // The following tests verify that session options are created correctly. |
| 2359 // TODO(deadbeef): Convert these tests to be more end-to-end. Instead of | 2398 // TODO(deadbeef): Convert these tests to be more end-to-end. Instead of |
| 2360 // "verify options are converted correctly", should be "pass options into | 2399 // "verify options are converted correctly", should be "pass options into |
| 2361 // CreateOffer and verify the correct offer is produced." | 2400 // CreateOffer and verify the correct offer is produced." |
| 2362 | 2401 |
| 2363 TEST(CreateSessionOptionsTest, GetOptionsForOfferWithInvalidAudioOption) { | 2402 TEST(CreateSessionOptionsTest, GetOptionsForOfferWithInvalidAudioOption) { |
| 2364 RTCOfferAnswerOptions rtc_options; | 2403 RTCOfferAnswerOptions rtc_options; |
| 2365 rtc_options.offer_to_receive_audio = RTCOfferAnswerOptions::kUndefined - 1; | 2404 rtc_options.offer_to_receive_audio = RTCOfferAnswerOptions::kUndefined - 1; |
| 2366 | 2405 |
| 2367 cricket::MediaSessionOptions options; | 2406 cricket::MediaSessionOptions options; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2516 FakeConstraints updated_answer_c; | 2555 FakeConstraints updated_answer_c; |
| 2517 answer_c.SetMandatoryReceiveAudio(false); | 2556 answer_c.SetMandatoryReceiveAudio(false); |
| 2518 answer_c.SetMandatoryReceiveVideo(false); | 2557 answer_c.SetMandatoryReceiveVideo(false); |
| 2519 | 2558 |
| 2520 cricket::MediaSessionOptions updated_answer_options; | 2559 cricket::MediaSessionOptions updated_answer_options; |
| 2521 EXPECT_TRUE( | 2560 EXPECT_TRUE( |
| 2522 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2561 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
| 2523 EXPECT_TRUE(updated_answer_options.has_audio()); | 2562 EXPECT_TRUE(updated_answer_options.has_audio()); |
| 2524 EXPECT_TRUE(updated_answer_options.has_video()); | 2563 EXPECT_TRUE(updated_answer_options.has_video()); |
| 2525 } | 2564 } |
| OLD | NEW |