Bug 1002890 - Signaling unittests no longer need exceptions to mainthread checks. r=jesup

This commit is contained in:
Ethan Hugg 2014-04-28 19:45:40 -07:00
Родитель 8d3acf320f
Коммит 3ae788c1d5
5 изменённых файлов: 9 добавлений и 34 удалений

Просмотреть файл

@ -43,10 +43,7 @@ const unsigned int WebrtcAudioConduit::CODEC_PLNAME_SIZE = 32;
mozilla::RefPtr<AudioSessionConduit> AudioSessionConduit::Create(AudioSessionConduit *aOther)
{
CSFLogDebug(logTag, "%s ", __FUNCTION__);
#ifdef MOZILLA_INTERNAL_API
// unit tests create their own "main thread"
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
#endif
WebrtcAudioConduit* obj = new WebrtcAudioConduit();
if(obj->Init(static_cast<WebrtcAudioConduit*>(aOther)) != kMediaConduitNoError)
@ -64,10 +61,7 @@ mozilla::RefPtr<AudioSessionConduit> AudioSessionConduit::Create(AudioSessionCon
*/
WebrtcAudioConduit::~WebrtcAudioConduit()
{
#ifdef MOZILLA_INTERNAL_API
// unit tests create their own "main thread"
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
#endif
CSFLogDebug(logTag, "%s ", __FUNCTION__);
for(std::vector<AudioCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)

Просмотреть файл

@ -39,10 +39,7 @@ const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
*/
mozilla::RefPtr<VideoSessionConduit> VideoSessionConduit::Create(VideoSessionConduit *aOther)
{
#ifdef MOZILLA_INTERNAL_API
// unit tests create their own "main thread"
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
#endif
CSFLogDebug(logTag, "%s ", __FUNCTION__);
WebrtcVideoConduit* obj = new WebrtcVideoConduit();
@ -58,10 +55,7 @@ mozilla::RefPtr<VideoSessionConduit> VideoSessionConduit::Create(VideoSessionCon
WebrtcVideoConduit::~WebrtcVideoConduit()
{
#ifdef MOZILLA_INTERNAL_API
// unit tests create their own "main thread"
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
#endif
CSFLogDebug(logTag, "%s ", __FUNCTION__);
for(std::vector<VideoCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)

Просмотреть файл

@ -193,23 +193,14 @@ nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread,
CSF::VcmSIPCCBinding::setMainThread(gMainThread);
init_thread_monitor(&thread_ended_dispatcher, &join_waiter);
} else {
#ifdef MOZILLA_INTERNAL_API
MOZ_ASSERT(gMainThread == mainThread);
#endif
}
CSF::VcmSIPCCBinding::setSTSThread(stsThread);
nsresult res;
#ifdef MOZILLA_INTERNAL_API
// This check fails on the unit tests because they do not
// have the right thread behavior.
bool on;
res = gMainThread->IsOnCurrentThread(&on);
NS_ENSURE_SUCCESS(res, res);
MOZ_ASSERT(on);
#endif
MOZ_ASSERT(NS_IsMainThread());
if (!gInstance) {
CSFLogDebug(logTag, "Creating PeerConnectionCtx");

Просмотреть файл

@ -193,9 +193,7 @@ public:
WrappableJSErrorResult(WrappableJSErrorResult &other) : mRv(), isCopy(true) {}
~WrappableJSErrorResult() {
if (isCopy) {
#ifdef MOZILLA_INTERNAL_API
MOZ_ASSERT(NS_IsMainThread());
#endif
}
}
operator JSErrorResult &() { return mRv; }
@ -707,9 +705,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
// Invariant: we receive configuration one way or the other but not both (XOR)
MOZ_ASSERT(!aConfiguration != !aRTCConfiguration);
#ifdef MOZILLA_INTERNAL_API
MOZ_ASSERT(NS_IsMainThread());
#endif
MOZ_ASSERT(aThread);
mThread = do_QueryInterface(aThread);

Просмотреть файл

@ -962,18 +962,18 @@ class SignalingAgent {
WrapRunnable(this, &SignalingAgent::Close));
}
void Init_m(nsCOMPtr<nsIThread> thread)
void Init_m()
{
pObserver = new TestObserver(pc->pcImpl(), name);
ASSERT_TRUE(pObserver);
ASSERT_EQ(pc->Initialize(pObserver, nullptr, cfg_, thread), NS_OK);
ASSERT_EQ(pc->Initialize(pObserver, nullptr, cfg_, gMainThread), NS_OK);
}
void Init(nsCOMPtr<nsIThread> thread)
void Init()
{
mozilla::SyncRunnable::DispatchToThread(thread,
WrapRunnable(this, &SignalingAgent::Init_m, thread));
mozilla::SyncRunnable::DispatchToThread(gMainThread,
WrapRunnable(this, &SignalingAgent::Init_m));
ASSERT_TRUE_WAIT(sipcc_state() == PCImplSipccState::Started,
kDefaultTimeout);
@ -1555,7 +1555,7 @@ class SignalingAgentTest : public ::testing::Test {
ScopedDeletePtr<SignalingAgent> agent(
new SignalingAgent("agent", stun_addr, stun_port));
agent->Init(gMainThread);
agent->Init();
if (wait_for_gather) {
if (!agent->WaitForGatherAllowFail())
@ -1609,8 +1609,8 @@ public:
a1_ = new SignalingAgent(callerName, stun_addr_, stun_port_);
a2_ = new SignalingAgent(calleeName, stun_addr_, stun_port_);
a1_->Init(gMainThread);
a2_->Init(gMainThread);
a1_->Init();
a2_->Init();
if (wait_for_gather_) {
WaitForGather();