Two changes:
1) Libjingle and webrtc use different jsoncpp, so we need to distinguish them. 2) Update the webrtcsession_unittest: * Use the Thread::SleepMs * Remove main, which has been defined in talk/base/unittest_main. Review URL: http://webrtc-codereview.appspot.com/107003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@356 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -20,7 +20,6 @@ talk.Unittest(
|
|||||||
name = 'webrtc',
|
name = 'webrtc',
|
||||||
srcs = [
|
srcs = [
|
||||||
'webrtcsession_unittest.cc',
|
'webrtcsession_unittest.cc',
|
||||||
'testing/timing.cc'
|
|
||||||
],
|
],
|
||||||
libs = [
|
libs = [
|
||||||
'srtp',
|
'srtp',
|
||||||
|
@ -30,7 +30,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifdef WEBRTC_RELATIVE_PATH
|
||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
|
#else
|
||||||
|
#include "third_party/jsoncpp/json.h"
|
||||||
|
#endif
|
||||||
#include "talk/session/phone/codec.h"
|
#include "talk/session/phone/codec.h"
|
||||||
#include "talk/p2p/base/candidate.h"
|
#include "talk/p2p/base/candidate.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "base/gunit.h"
|
#include "base/gunit.h"
|
||||||
#include "base/helpers.h"
|
#include "base/helpers.h"
|
||||||
#include "talk/app/webrtc/testing/timing.h"
|
|
||||||
#include "talk/app/webrtc/webrtcsession.h"
|
#include "talk/app/webrtc/webrtcsession.h"
|
||||||
#include "talk/base/fakenetwork.h"
|
#include "talk/base/fakenetwork.h"
|
||||||
#include "talk/base/scoped_ptr.h"
|
#include "talk/base/scoped_ptr.h"
|
||||||
@ -377,7 +376,6 @@ class WebRTCSessionTest : public OnSignalImpl,
|
|||||||
|
|
||||||
bool WaitForCallback(CallbackId id, int timeout_ms) {
|
bool WaitForCallback(CallbackId id, int timeout_ms) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
Timing my_timer;
|
|
||||||
for (int ms = 0; ms < timeout_ms; ms++) {
|
for (int ms = 0; ms < timeout_ms; ms++) {
|
||||||
const CallbackId peek_id = PeekOldestCallback();
|
const CallbackId peek_id = PeekOldestCallback();
|
||||||
if (peek_id == id) {
|
if (peek_id == id) {
|
||||||
@ -388,7 +386,7 @@ class WebRTCSessionTest : public OnSignalImpl,
|
|||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
my_timer.IdleWait(0.001);
|
talk_base::Thread::SleepMs(1);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -827,16 +825,14 @@ class WebRTCSessionTest : public OnSignalImpl,
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool CallbackReceived(WebRTCSessionTest* session, int timeout) {
|
bool CallbackReceived(WebRTCSessionTest* session, int timeout) {
|
||||||
Timing my_timer;
|
talk_base::Thread::SleepMs(timeout);
|
||||||
my_timer.IdleWait(timeout * 0.001);
|
|
||||||
const OnSignalImpl::CallbackId peek_id =
|
const OnSignalImpl::CallbackId peek_id =
|
||||||
session->PeekOldestCallback();
|
session->PeekOldestCallback();
|
||||||
return peek_id != OnSignalImpl::kNone;
|
return peek_id != OnSignalImpl::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepMs(int timeout_ms) {
|
void SleepMs(int timeout_ms) {
|
||||||
Timing my_timer;
|
talk_base::Thread::SleepMs(timeout_ms);
|
||||||
my_timer.IdleWait(timeout_ms * 0.001);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(WebRtcSessionTest, InitializationReceiveSanity) {
|
TEST(WebRtcSessionTest, InitializationReceiveSanity) {
|
||||||
@ -874,12 +870,3 @@ TEST(WebRtcSessionTest, SendCallSetUp) {
|
|||||||
// 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));
|
ASSERT_FALSE(CallbackReceived(my_session.get(), 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
// Added return_value so that it's convenient to put a breakpoint before
|
|
||||||
// exiting please note that the return value from RUN_ALL_TESTS() must
|
|
||||||
// be returned by the main function.
|
|
||||||
const int return_value = RUN_ALL_TESTS();
|
|
||||||
return return_value;
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user