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

Unified Diff: talk/session/media/channelmanager_unittest.cc

Issue 1358413003: Revert of TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/session/media/channelmanager.cc ('k') | webrtc/base/fakenetwork.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/session/media/channelmanager_unittest.cc
diff --git a/talk/session/media/channelmanager_unittest.cc b/talk/session/media/channelmanager_unittest.cc
index c699ee1a5f88250762fde67791299dba6338ad98..71493c8ff8be19d6e88b9792aa07c6094b01e174 100644
--- a/talk/session/media/channelmanager_unittest.cc
+++ b/talk/session/media/channelmanager_unittest.cc
@@ -32,11 +32,11 @@
#include "talk/media/base/testutils.h"
#include "talk/media/devices/fakedevicemanager.h"
#include "talk/media/webrtc/fakewebrtccall.h"
+#include "webrtc/p2p/base/fakesession.h"
#include "talk/session/media/channelmanager.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/thread.h"
-#include "webrtc/p2p/base/faketransportcontroller.h"
namespace cricket {
@@ -58,20 +58,14 @@
}
~FakeMediaController() override {}
webrtc::Call* call_w() override { return call_; }
-
private:
webrtc::Call* call_;
};
class ChannelManagerTest : public testing::Test {
protected:
- ChannelManagerTest()
- : fake_call_(webrtc::Call::Config()),
- fake_mc_(&fake_call_),
- fme_(NULL),
- fdm_(NULL),
- fcm_(NULL),
- cm_(NULL) {}
+ ChannelManagerTest() : fake_call_(webrtc::Call::Config()),
+ fake_mc_(&fake_call_), fme_(NULL), fdm_(NULL), fcm_(NULL), cm_(NULL) {}
virtual void SetUp() {
fme_ = new cricket::FakeMediaEngine();
@@ -82,8 +76,7 @@
fcm_ = new cricket::FakeCaptureManager();
cm_ = new cricket::ChannelManager(
fme_, fdme_, fdm_, fcm_, rtc::Thread::Current());
- transport_controller_ =
- new cricket::FakeTransportController(ICEROLE_CONTROLLING);
+ session_ = new cricket::FakeSession(true);
std::vector<std::string> in_device_list, out_device_list, vid_device_list;
in_device_list.push_back("audio-in1");
@@ -98,7 +91,7 @@
}
virtual void TearDown() {
- delete transport_controller_;
+ delete session_;
delete cm_;
cm_ = NULL;
fdm_ = NULL;
@@ -115,7 +108,7 @@
cricket::FakeDeviceManager* fdm_;
cricket::FakeCaptureManager* fcm_;
cricket::ChannelManager* cm_;
- cricket::FakeTransportController* transport_controller_;
+ cricket::FakeSession* session_;
};
// Test that we startup/shutdown properly.
@@ -146,16 +139,15 @@
// Test that we can create and destroy a voice and video channel.
TEST_F(ChannelManagerTest, CreateDestroyChannels) {
EXPECT_TRUE(cm_->Init());
- cricket::VoiceChannel* voice_channel =
- cm_->CreateVoiceChannel(&fake_mc_, transport_controller_,
- cricket::CN_AUDIO, false, AudioOptions());
+ cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
+ &fake_mc_, session_, cricket::CN_AUDIO, false, AudioOptions());
EXPECT_TRUE(voice_channel != nullptr);
- cricket::VideoChannel* video_channel =
- cm_->CreateVideoChannel(&fake_mc_, transport_controller_,
- cricket::CN_VIDEO, false, VideoOptions());
+ cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
+ &fake_mc_, session_, cricket::CN_VIDEO, false, VideoOptions());
EXPECT_TRUE(video_channel != nullptr);
- cricket::DataChannel* data_channel = cm_->CreateDataChannel(
- transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP);
+ cricket::DataChannel* data_channel =
+ cm_->CreateDataChannel(session_, cricket::CN_DATA,
+ false, cricket::DCT_RTP);
EXPECT_TRUE(data_channel != nullptr);
cm_->DestroyVideoChannel(video_channel);
cm_->DestroyVoiceChannel(voice_channel);
@@ -168,19 +160,17 @@
worker_.Start();
EXPECT_TRUE(cm_->set_worker_thread(&worker_));
EXPECT_TRUE(cm_->Init());
- delete transport_controller_;
- transport_controller_ =
- new cricket::FakeTransportController(&worker_, ICEROLE_CONTROLLING);
- cricket::VoiceChannel* voice_channel =
- cm_->CreateVoiceChannel(&fake_mc_, transport_controller_,
- cricket::CN_AUDIO, false, AudioOptions());
+ delete session_;
+ session_ = new cricket::FakeSession(&worker_, true);
+ cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
+ &fake_mc_, session_, cricket::CN_AUDIO, false, AudioOptions());
EXPECT_TRUE(voice_channel != nullptr);
- cricket::VideoChannel* video_channel =
- cm_->CreateVideoChannel(&fake_mc_, transport_controller_,
- cricket::CN_VIDEO, false, VideoOptions());
+ cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
+ &fake_mc_, session_, cricket::CN_VIDEO, false, VideoOptions());
EXPECT_TRUE(video_channel != nullptr);
- cricket::DataChannel* data_channel = cm_->CreateDataChannel(
- transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP);
+ cricket::DataChannel* data_channel =
+ cm_->CreateDataChannel(session_, cricket::CN_DATA,
+ false, cricket::DCT_RTP);
EXPECT_TRUE(data_channel != nullptr);
cm_->DestroyVideoChannel(video_channel);
cm_->DestroyVoiceChannel(voice_channel);
@@ -192,22 +182,21 @@
// to create a cricket::TransportChannel
TEST_F(ChannelManagerTest, NoTransportChannelTest) {
EXPECT_TRUE(cm_->Init());
- transport_controller_->set_fail_channel_creation(true);
+ session_->set_fail_channel_creation(true);
// The test is useless unless the session does not fail creating
// cricket::TransportChannel.
- ASSERT_TRUE(transport_controller_->CreateTransportChannel_w(
+ ASSERT_TRUE(session_->CreateChannel(
"audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr);
- cricket::VoiceChannel* voice_channel =
- cm_->CreateVoiceChannel(&fake_mc_, transport_controller_,
- cricket::CN_AUDIO, false, AudioOptions());
+ cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
+ &fake_mc_, session_, cricket::CN_AUDIO, false, AudioOptions());
EXPECT_TRUE(voice_channel == nullptr);
- cricket::VideoChannel* video_channel =
- cm_->CreateVideoChannel(&fake_mc_, transport_controller_,
- cricket::CN_VIDEO, false, VideoOptions());
+ cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
+ &fake_mc_, session_, cricket::CN_VIDEO, false, VideoOptions());
EXPECT_TRUE(video_channel == nullptr);
- cricket::DataChannel* data_channel = cm_->CreateDataChannel(
- transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP);
+ cricket::DataChannel* data_channel =
+ cm_->CreateDataChannel(session_, cricket::CN_DATA,
+ false, cricket::DCT_RTP);
EXPECT_TRUE(data_channel == nullptr);
cm_->Terminate();
}
« no previous file with comments | « talk/session/media/channelmanager.cc ('k') | webrtc/base/fakenetwork.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698