Bug 1317009 - Port jsep_session_unittest and jsep_track_unittest to xul gtest; r=bwc
authorDan Minor <dminor@mozilla.com>
Tue, 15 Nov 2016 09:35:14 -0500
changeset 370294 3560e9d6576b55c26bdbbd4c9aa1ae3f0cc0ecc0
parent 370293 811084dd7ec0b2d0049e570d7b6eac66a840ab99
child 370295 f0f2dbc18d183a5a024a70e5cdcee126edbe91fe
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1317009
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1317009 - Port jsep_session_unittest and jsep_track_unittest to xul gtest; r=bwc MozReview-Commit-ID: spuZSAnSDC
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/gtest/jsep_track_unittest.cpp
media/webrtc/signaling/gtest/moz.build
media/webrtc/signaling/test/jsep_session_unittest.cpp
media/webrtc/signaling/test/jsep_track_unittest.cpp
media/webrtc/signaling/test/moz.build
python/mozbuild/mozbuild/frontend/emitter.py
testing/cppunittest.ini
rename from media/webrtc/signaling/test/jsep_session_unittest.cpp
rename to media/webrtc/signaling/gtest/jsep_session_unittest.cpp
--- a/media/webrtc/signaling/test/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -11,43 +11,36 @@
 #include "nss.h"
 #include "ssl.h"
 
 #include "mozilla/RefPtr.h"
 #include "mozilla/Tuple.h"
 
 #define GTEST_HAS_RTTI 0
 #include "gtest/gtest.h"
-#include "gtest_utils.h"
-
-#include "FakeMediaStreams.h"
-#include "FakeMediaStreamsImpl.h"
-#include "FakeLogging.h"
 
 #include "signaling/src/sdp/SdpMediaSection.h"
 #include "signaling/src/sdp/SipccSdpParser.h"
 #include "signaling/src/jsep/JsepCodecDescription.h"
 #include "signaling/src/jsep/JsepTrack.h"
 #include "signaling/src/jsep/JsepSession.h"
 #include "signaling/src/jsep/JsepSessionImpl.h"
 #include "signaling/src/jsep/JsepTrack.h"
 
-#include "mtransport_test_utils.h"
-
-#include "FakeIPC.h"
-#include "FakeIPC.cpp"
-
-#include "TestHarness.h"
-
 namespace mozilla {
 static std::string kAEqualsCandidate("a=candidate:");
 const static size_t kNumCandidatesPerComponent = 3;
 
 class JsepSessionTestBase : public ::testing::Test
 {
+public:
+  static void SetUpTestCase() {
+    NSS_NoDB_Init(nullptr);
+    NSS_SetDomesticPolicy();
+  }
 };
 
 class FakeUuidGenerator : public mozilla::JsepUuidGenerator
 {
 public:
   bool
   Generate(std::string* str)
   {
@@ -4215,21 +4208,8 @@ TEST_F(JsepSessionTest, TestNonDefaultPr
   ASSERT_EQ(3U, parsedOffer->GetMediaSectionCount());
   ASSERT_EQ(SdpMediaSection::kRtpSavpf,
             parsedOffer->GetMediaSection(0).GetProtocol());
   ASSERT_EQ(SdpMediaSection::kRtpSavpf,
             parsedOffer->GetMediaSection(1).GetProtocol());
 }
 
 } // namespace mozilla
-
-int
-main(int argc, char** argv)
-{
-  // Prevents some log spew
-  ScopedXPCOM xpcom("jsep_session_unittest");
-
-  NSS_NoDB_Init(nullptr);
-  NSS_SetDomesticPolicy();
-
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
rename from media/webrtc/signaling/test/jsep_track_unittest.cpp
rename to media/webrtc/signaling/gtest/jsep_track_unittest.cpp
--- a/media/webrtc/signaling/test/jsep_track_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_track_unittest.cpp
@@ -1,34 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #define GTEST_HAS_RTTI 0
 #include "gtest/gtest.h"
-#include "gtest_utils.h"
-
-// Magic linker includes :(
-#include "FakeMediaStreams.h"
-#include "FakeMediaStreamsImpl.h"
-#include "FakeLogging.h"
 
 #include "signaling/src/jsep/JsepTrack.h"
 #include "signaling/src/sdp/SipccSdp.h"
 #include "signaling/src/sdp/SdpHelper.h"
 
-#include "mtransport_test_utils.h"
-
-#include "FakeIPC.h"
-#include "FakeIPC.cpp"
-
-#include "TestHarness.h"
-
 namespace mozilla {
 
 class JsepTrackTest : public ::testing::Test
 {
   public:
     JsepTrackTest() {}
 
     std::vector<JsepCodecDescription*>
@@ -1251,19 +1238,8 @@ TEST_F(JsepTrackTest, NonDefaultOpusPara
   VERIFY_OPUS_FORCE_MONO(*mSendAns, false);
   VERIFY_OPUS_MAX_PLAYBACK_RATE(*mRecvOff, 0U);
   VERIFY_OPUS_FORCE_MONO(*mRecvOff, false);
   VERIFY_OPUS_MAX_PLAYBACK_RATE(*mRecvAns, 16000U);
   VERIFY_OPUS_FORCE_MONO(*mRecvAns, true);
 }
 
 } // namespace mozilla
-
-int
-main(int argc, char** argv)
-{
-  // Prevents some log spew
-  ScopedXPCOM xpcom("jsep_track_unittest");
-
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
-
--- a/media/webrtc/signaling/gtest/moz.build
+++ b/media/webrtc/signaling/gtest/moz.build
@@ -12,16 +12,18 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
       '/ipc/chromium/src',
       '/media/mtransport',
       '/media/webrtc/',
       '/media/webrtc/signaling/src/common/time_profiling',
       '/media/webrtc/signaling/src/peerconnection',
     ]
 
     SOURCES += [
+        'jsep_session_unittest.cpp',
+        'jsep_track_unittest.cpp',
         'sdp_unittests.cpp',
     ]
 
     FINAL_LIBRARY = 'xul-gtest'
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += ['-Wno-error=shadow']
 
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -2,18 +2,16 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # TODO: bug 1172551 - get these tests working on iOS
 if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
     GeckoCppUnitTests([
-        'jsep_session_unittest',
-        'jsep_track_unittest',
         'mediaconduit_unittests',
         'mediapipeline_unittest',
         'signaling_unittests',
     ])
 
 include('/ipc/chromium/chromium-config.mozbuild')
 include('common.build')
 
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -130,18 +130,16 @@ ALLOWED_XPCOM_GLUE = {
     ('test_service_init_background_thread', 'storage/test'),
     ('test_statement_scoper', 'storage/test'),
     ('test_StatementCache', 'storage/test'),
     ('test_transaction_helper', 'storage/test'),
     ('test_true_async', 'storage/test'),
     ('test_unlock_notify', 'storage/test'),
     ('test_IHistory', 'toolkit/components/places/tests/cpp'),
     ('testcrasher', 'toolkit/crashreporter/test'),
-    ('jsep_session_unittest', 'media/webrtc/signaling/test'),
-    ('jsep_track_unittest', 'media/webrtc/signaling/test'),
     ('mediaconduit_unittests', 'media/webrtc/signaling/test'),
     ('mediapipeline_unittest', 'media/webrtc/signaling/test'),
     ('sdp_file_parser', 'media/webrtc/signaling/fuzztest'),
     ('signaling_unittests', 'media/webrtc/signaling/test'),
     ('TestMailCookie', 'mailnews/base/test'),
 }
 
 
--- a/testing/cppunittest.ini
+++ b/testing/cppunittest.ini
@@ -63,19 +63,16 @@ skip-if = os == 'b2g'  #Bug 1068946
 skip-if = os == 'b2g' || os == 'android'  # Bug 919646
 [mediapipeline_unittest_standalone]
 skip-if = os == 'b2g' || os == 'android'  # Bug 919646
 [multi_tcp_socket_unittest]
 [nrappkit_unittest]
 [rlogringbuffer_unittest]
 [runnable_utils_unittest]
 [sctp_unittest]
-[jsep_track_unittest]
-[jsep_session_unittest]
-skip-if = os == 'android' # Bug 1147631
 [signaling_unittests]
 [signaling_unittests_standalone]
 [simpletokenbucket_unittest]
 [sockettransportservice_unittest]
 [test_AsXXX_helpers]
 [test_IHistory]
 [test_StatementCache]
 [test_asyncStatementExecution_transaction]