Bugfix in unittest and some minor refactoring.

Review URL: http://webrtc-codereview.appspot.com/137003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@450 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
hellner@google.com 2011-08-25 17:17:30 +00:00
parent eb9572e501
commit 40373cc184
3 changed files with 29 additions and 30 deletions

View File

@ -60,7 +60,6 @@ static const int kCallSetupTimeout = 30 * 1000;
// use a longer timeout for that.
static const int kCallLostTimeout = 60 * 1000;
typedef std::vector<StreamInfo*> StreamMap; // not really a map (vector)
static const char kVideoStream[] = "video_rtp";
static const char kAudioStream[] = "rtp";

View File

@ -54,24 +54,6 @@ class Value;
namespace webrtc {
struct StreamInfo {
explicit StreamInfo(const std::string stream_id)
: channel(NULL),
transport(NULL),
video(false),
stream_id(stream_id) {}
StreamInfo()
: channel(NULL),
transport(NULL),
video(false) {}
cricket::BaseChannel* channel;
cricket::TransportChannel* transport;
bool video;
std::string stream_id;
};
typedef std::vector<cricket::AudioCodec> AudioCodecs;
typedef std::vector<cricket::VideoCodec> VideoCodecs;
@ -158,6 +140,25 @@ class WebRtcSession : public cricket::BaseSession {
const std::string& content_name, const std::string& name);
private:
struct StreamInfo {
explicit StreamInfo(const std::string stream_id)
: channel(NULL),
transport(NULL),
video(false),
stream_id(stream_id) {}
StreamInfo()
: channel(NULL),
transport(NULL),
video(false) {}
cricket::BaseChannel* channel;
cricket::TransportChannel* transport;
bool video;
std::string stream_id;
};
// Not really a map (vector).
typedef std::vector<StreamInfo*> StreamMap;
// Dummy functions inherited from cricket::BaseSession.
// They should never be called.
virtual bool Accept(const cricket::SessionDescription* sdesc) {

View File

@ -96,6 +96,7 @@ cricket::ContentInfos CopyContentInfos(const cricket::ContentInfos& original) {
info.name = (*iter).name;
info.type = (*iter).type;
info.description = CopyContentDescription((*iter).description);
new_content_infos.push_back(info);
}
return new_content_infos;
}
@ -375,18 +376,16 @@ class WebRtcSessionTest : public OnSignalImpl {
if (!session_->OnRemoteDescription(description, candidates)) {
return false;
}
if (!WaitForCallback(kOnAddStream, 1000)) {
return false;
}
return true;
}
bool CallOnInitiateMessage() {
cricket::SessionDescription* description = NULL;
std::vector<cricket::Candidate> candidates;
if (!GenerateFakeSession(false, &description, &candidates)) {
return false;
}
bool CallOnInitiateMessage(
cricket::SessionDescription* description,
const std::vector<cricket::Candidate>& candidates) {
if (!session_->OnInitiateMessage(description, candidates)) {
delete description;
return false;
}
return true;
@ -497,7 +496,7 @@ TEST(WebRtcSessionTest, InitializationReceiveSanity) {
my_session->PopOldestCallback());
}
TEST(WebRtcSessionTest, AudioSendReceiveCallSetUp) {
TEST(WebRtcSessionTest, AudioSendCallSetUp) {
const bool kReceiving = false;
talk_base::scoped_ptr<WebRtcSessionTest> my_session;
my_session.reset(WebRtcSessionTest::CreateWebRtcSessionTest(kReceiving));
@ -518,7 +517,7 @@ TEST(WebRtcSessionTest, AudioSendReceiveCallSetUp) {
FAIL();
}
// All callbacks should be caught by my session. Assert it.
// All callbacks should be caught by my_session. Assert it.
ASSERT_FALSE(CallbackReceived(my_session.get(), 1000));
}
@ -544,7 +543,7 @@ TEST(WebRtcSessionTest, VideoSendCallSetUp) {
FAIL();
}
// All callbacks should be caught by my session. Assert it.
// All callbacks should be caught by my_session. Assert it.
ASSERT_FALSE(CallbackReceived(my_session.get(), 1000));
}