Bug 1316189 - Convert XPCOM test TestCallTemplate to a gtest. r=bsmedberg
authorEric Rahm <erahm@mozilla.com>
Thu, 10 Nov 2016 12:50:43 -0800
changeset 348773 b06d68ee9270643f5295a15dd34a920ac79c9ace
parent 348772 03fc16d0df1b81173e37fd65c515f335e2496a08
child 348774 1b0a99027126df1d04c20ffc6a2338d62f205f7e
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1316189
milestone52.0a1
Bug 1316189 - Convert XPCOM test TestCallTemplate to a gtest. r=bsmedberg MozReview-Commit-ID: FGCmfjyKNa1
xpcom/tests/TestCallTemplates.cpp
xpcom/tests/gtest/TestCallTemplates.cpp
xpcom/tests/gtest/TestNSPRLogModulesParser.cpp
xpcom/tests/gtest/moz.build
xpcom/tests/moz.build
rename from xpcom/tests/TestCallTemplates.cpp
rename to xpcom/tests/gtest/TestCallTemplates.cpp
--- a/xpcom/tests/TestCallTemplates.cpp
+++ b/xpcom/tests/gtest/TestCallTemplates.cpp
@@ -44,17 +44,17 @@ class nsTestService final : public nsITe
 NS_IMPL_ISUPPORTS(nsTestService, nsITestService, nsISupportsWeakReference)
 
 #define NS_TEST_SERVICE_CONTRACTID "@mozilla.org/test/testservice;1"
 #define NS_TEST_SERVICE_CID \
   {0xa00c1406, 0x283a, 0x45c9, \
     {0xae, 0xd2, 0x1a, 0xb6, 0xdd, 0xba, 0xfe, 0x53}}
 static NS_DEFINE_CID(kTestServiceCID, NS_TEST_SERVICE_CID);
 
-int main()
+void JustTestingCompilation()
 {
     /*
      * NOTE:  This does NOT demonstrate how these functions are
      * intended to be used.  They are intended for filling in out
      * parameters that need to be |AddRef|ed.  I'm just too lazy
      * to write lots of little getter functions for a test program
      * when I don't need to.
      */
@@ -96,11 +96,9 @@ int main()
     /* Test CallGetService */
     CallGetService(kTestServiceCID, &myITestService);
     CallGetService(NS_TEST_SERVICE_CONTRACTID, &myITestService);
 
     /* Test CallGetInterface */
     nsIInterfaceRequestor *myInterfaceRequestor =
         static_cast<nsIInterfaceRequestor*>(mySupportsPtr);
     CallGetInterface(myInterfaceRequestor, &myITestService);
-
-    return 0;
 }
--- a/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp
+++ b/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=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/. */
 
 #include "NSPRLogModulesParser.h"
+#include "mozilla/ArrayUtils.h"
 #include "gtest/gtest.h"
 
 using namespace mozilla;
 
 TEST(NSPRLogModulesParser, Empty)
 {
   bool callbackInvoked = false;
   auto callback = [&](const char*, mozilla::LogLevel, int32_t) mutable { callbackInvoked = true; };
--- a/xpcom/tests/gtest/moz.build
+++ b/xpcom/tests/gtest/moz.build
@@ -4,16 +4,17 @@
 # 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/.
 
 UNIFIED_SOURCES += [
     'Helpers.cpp',
     'TestAtoms.cpp',
     'TestAutoPtr.cpp',
     'TestAutoRef.cpp',
+    'TestCallTemplates.cpp',
     'TestCloneInputStream.cpp',
     'TestCOMArray.cpp',
     'TestCOMPtrEq.cpp',
     'TestCRT.cpp',
     'TestEncoding.cpp',
     'TestEscapeURL.cpp',
     'TestExpirationTracker.cpp',
     'TestFile.cpp',
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -22,17 +22,16 @@ EXPORTS.testing += [
 SimplePrograms([
     'TestArguments',
     'TestBlockingProcess',
     'TestPRIntN',
     'TestQuickReturn',
 ])
 
 GeckoSimplePrograms([
-    'TestCallTemplates',
     'TestINIParser',
     'TestRacingServiceManager',
     'TestRegistrationOrder',
     'TestThreadPoolListener',
     'TestUnicodeArguments',
 ])
 
 if CONFIG['OS_TARGET'] == 'WINNT':