summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org>2014-09-28 11:36:45 +0000
committerpbos@webrtc.org <pbos@webrtc.org>2014-09-28 11:36:45 +0000
commit6f208360ab28a8fc8b948d6d537b6173399c45ef (patch)
tree044fe15622100e4a4cb67d2a30043fe25ecc4f9c /base
parent870d9bf9b3d38315357afc9ad253b9294f7f9ca8 (diff)
downloadwebrtc-6f208360ab28a8fc8b948d6d537b6173399c45ef.tar.gz
Initialize SSL in unittest_main.cc.
Instead of having each test individually initialize and tear down SSL move this to unittest_main.cc so that all tests are properly initialized and new tests "don't have to think about it". R=pthatcher@webrtc.org BUG= Review URL: https://webrtc-codereview.appspot.com/30549004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7316 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'base')
-rw-r--r--base/helpers_unittest.cc11
-rw-r--r--base/ssladapter_unittest.cc8
-rw-r--r--base/sslidentity_unittest.cc8
-rw-r--r--base/sslstreamadapter_unittest.cc8
-rw-r--r--base/unittest_main.cc6
5 files changed, 7 insertions, 34 deletions
diff --git a/base/helpers_unittest.cc b/base/helpers_unittest.cc
index 7c20540c..6ea0167e 100644
--- a/base/helpers_unittest.cc
+++ b/base/helpers_unittest.cc
@@ -16,16 +16,7 @@
namespace rtc {
-class RandomTest : public testing::Test {
- public:
- static void SetUpTestCase() {
- rtc::InitializeSSL();
- }
-
- static void TearDownTestCase() {
- rtc::CleanupSSL();
- }
-};
+class RandomTest : public testing::Test {};
TEST_F(RandomTest, TestCreateRandomId) {
CreateRandomId();
diff --git a/base/ssladapter_unittest.cc b/base/ssladapter_unittest.cc
index 6d4536d2..4590db91 100644
--- a/base/ssladapter_unittest.cc
+++ b/base/ssladapter_unittest.cc
@@ -247,14 +247,6 @@ class SSLAdapterTestBase : public testing::Test,
handshake_wait_(kTimeout) {
}
- static void SetUpTestCase() {
- rtc::InitializeSSL();
- }
-
- static void TearDownTestCase() {
- rtc::CleanupSSL();
- }
-
void SetHandshakeWait(int wait) {
handshake_wait_ = wait;
}
diff --git a/base/sslidentity_unittest.cc b/base/sslidentity_unittest.cc
index 1486bebb..3f756ef8 100644
--- a/base/sslidentity_unittest.cc
+++ b/base/sslidentity_unittest.cc
@@ -45,14 +45,6 @@ class SSLIdentityTest : public testing::Test {
~SSLIdentityTest() {
}
- static void SetUpTestCase() {
- rtc::InitializeSSL();
- }
-
- static void TearDownTestCase() {
- rtc::CleanupSSL();
- }
-
virtual void SetUp() {
identity1_.reset(SSLIdentity::Generate("test1"));
identity2_.reset(SSLIdentity::Generate("test2"));
diff --git a/base/sslstreamadapter_unittest.cc b/base/sslstreamadapter_unittest.cc
index 05383143..622e309e 100644
--- a/base/sslstreamadapter_unittest.cc
+++ b/base/sslstreamadapter_unittest.cc
@@ -194,14 +194,6 @@ class SSLStreamAdapterTestBase : public testing::Test,
rtc::SetRandomTestMode(false);
}
- static void SetUpTestCase() {
- rtc::InitializeSSL();
- }
-
- static void TearDownTestCase() {
- rtc::CleanupSSL();
- }
-
// Recreate the client/server identities with the specified validity period.
// |not_before| and |not_after| are offsets from the current time in number
// of seconds.
diff --git a/base/unittest_main.cc b/base/unittest_main.cc
index 5d412d5e..c9864fe0 100644
--- a/base/unittest_main.cc
+++ b/base/unittest_main.cc
@@ -18,6 +18,7 @@
#include "webrtc/base/fileutils.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/ssladapter.h"
DEFINE_bool(help, false, "prints this message");
DEFINE_string(log, "", "logging options to use");
@@ -85,8 +86,13 @@ int main(int argc, char** argv) {
rtc::LogMessage::ConfigureLogging(FLAG_log, "unittest.log");
}
+ // Initialize SSL which are used by several tests.
+ rtc::InitializeSSL();
+
int res = RUN_ALL_TESTS();
+ rtc::CleanupSSL();
+
// clean up logging so we don't appear to leak memory.
rtc::LogMessage::ConfigureLogging("", "");