Switching to NSS random number generator and adding init method to unittests.

R=jiayl@webrtc.org, sergeuy@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8259004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5505 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mallinath@webrtc.org
2014-02-07 23:22:00 +00:00
parent ad3035fc9e
commit 5a59ccbb6d
6 changed files with 41 additions and 10 deletions

View File

@@ -36,6 +36,7 @@
#include "talk/base/physicalsocketserver.h"
#include "talk/base/proxyserver.h"
#include "talk/base/socketaddress.h"
#include "talk/base/ssladapter.h"
#include "talk/base/thread.h"
#include "talk/base/virtualsocketserver.h"
#include "talk/p2p/base/p2ptransportchannel.h"
@@ -354,8 +355,11 @@ class P2PTransportChannelTestBase : public testing::Test,
static const Result kPrflxTcpToLocalTcp;
static void SetUpTestCase() {
// Ensure the RNG is inited.
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
talk_base::NATSocketServer* nat() { return nss_.get(); }

View File

@@ -34,6 +34,7 @@
#include "talk/base/physicalsocketserver.h"
#include "talk/base/scoped_ptr.h"
#include "talk/base/socketaddress.h"
#include "talk/base/ssladapter.h"
#include "talk/base/stringutils.h"
#include "talk/base/thread.h"
#include "talk/base/virtualsocketserver.h"
@@ -355,10 +356,14 @@ class PortTest : public testing::Test, public sigslot::has_slots<> {
protected:
static void SetUpTestCase() {
// Ensure the RNG is inited.
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
void TestLocalToLocal() {
Port* port1 = CreateUdpPort(kLocalAddr1);
Port* port2 = CreateUdpPort(kLocalAddr2);

View File

@@ -32,6 +32,7 @@
#include "talk/base/scoped_ptr.h"
#include "talk/base/socketadapters.h"
#include "talk/base/socketaddress.h"
#include "talk/base/ssladapter.h"
#include "talk/base/thread.h"
#include "talk/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
@@ -93,10 +94,14 @@ class RelayPortTest : public testing::Test,
protected:
static void SetUpTestCase() {
// Ensure the RNG is inited.
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
virtual void SetUp() {
// The relay server needs an external socket to work properly.
talk_base::AsyncUDPSocket* ext_socket =

View File

@@ -32,6 +32,7 @@
#include "talk/base/logging.h"
#include "talk/base/physicalsocketserver.h"
#include "talk/base/socketaddress.h"
#include "talk/base/ssladapter.h"
#include "talk/base/testclient.h"
#include "talk/base/thread.h"
#include "talk/p2p/base/relayserver.h"
@@ -53,8 +54,13 @@ static const char* msg2 = "Lobster Thermidor a Crevette with a mornay sauce...";
class RelayServerTest : public testing::Test {
public:
static void SetUpTestCase() {
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
RelayServerTest()
: main_(talk_base::Thread::Current()), ss_(main_->socketserver()),
username_(talk_base::CreateRandomString(12)),

View File

@@ -28,6 +28,7 @@
#include "talk/base/gunit.h"
#include "talk/base/helpers.h"
#include "talk/base/logging.h"
#include "talk/base/ssladapter.h"
#include "talk/base/timeutils.h"
#include "talk/p2p/base/stunrequest.h"
@@ -37,8 +38,13 @@ class StunRequestTest : public testing::Test,
public sigslot::has_slots<> {
public:
static void SetUpTestCase() {
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
StunRequestTest()
: manager_(talk_base::Thread::Current()),
request_count_(0), response_(NULL),

View File

@@ -35,6 +35,7 @@
#include "talk/base/network.h"
#include "talk/base/physicalsocketserver.h"
#include "talk/base/socketaddress.h"
#include "talk/base/ssladapter.h"
#include "talk/base/thread.h"
#include "talk/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
@@ -88,9 +89,13 @@ std::ostream& operator<<(std::ostream& os, const cricket::Candidate& c) {
class PortAllocatorTest : public testing::Test, public sigslot::has_slots<> {
public:
static void SetUpTestCase() {
// Ensure the RNG is inited.
talk_base::InitRandom(NULL, 0);
talk_base::InitializeSSL();
}
static void TearDownTestCase() {
talk_base::CleanupSSL();
}
PortAllocatorTest()
: pss_(new talk_base::PhysicalSocketServer),
vss_(new talk_base::VirtualSocketServer(pss_.get())),