Bug 1316792 - gtestify toolkit/components/places/tests/cpp/test_IHistory.cpp. r=mak.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sat, 12 Nov 2016 06:22:01 +1100
changeset 323548 1db5c6d737188293d1362aa0a14c2124d2fe6271
parent 323547 cce9a079d0eed37cdd490a2ee112c2322cb860ac
child 323549 f8cd3227cbfe159128bd5a288f7df248c340f457
push id30978
push usercbook@mozilla.com
push dateMon, 21 Nov 2016 14:44:46 +0000
treeherdermozilla-central@0534254e9a40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1316792, 1318225
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 1316792 - gtestify toolkit/components/places/tests/cpp/test_IHistory.cpp. r=mak. This is a most minimal gtest conversion possible. It leaves in place significant amounts of non-typical-for-gtest code. Notable changes: - All the mock Link and URLSearchParams method definitions are no longer needed. - The changes adds a new constructor for Link that doesn't set mHistory. Without that, leaked URLs occur at shutdown. - The output printed by the test is slightly streamlined, mostly by omitting the test filename. - It disables TestMediaFormatReader.cpp, which was causing problems. That test is slated for removal in bug 1318225 anyway.
dom/base/Link.cpp
dom/base/Link.h
dom/media/gtest/moz.build
python/mozbuild/mozbuild/frontend/emitter.py
testing/cppunittest.ini
toolkit/components/places/tests/cpp/mock_Link.h
toolkit/components/places/tests/cpp/moz.build
toolkit/components/places/tests/cpp/places_test_harness.h
toolkit/components/places/tests/cpp/places_test_harness_tail.h
toolkit/components/places/tests/cpp/test_IHistory.cpp
toolkit/components/places/tests/gtest/mock_Link.h
toolkit/components/places/tests/gtest/moz.build
toolkit/components/places/tests/gtest/places_test_harness.h
toolkit/components/places/tests/gtest/places_test_harness_tail.h
toolkit/components/places/tests/gtest/test_IHistory.cpp
toolkit/components/places/tests/moz.build
--- a/dom/base/Link.cpp
+++ b/dom/base/Link.cpp
@@ -32,16 +32,25 @@ Link::Link(Element *aElement)
   , mHistory(services::GetHistoryService())
   , mLinkState(eLinkState_NotLink)
   , mNeedsRegistration(false)
   , mRegistered(false)
 {
   MOZ_ASSERT(mElement, "Must have an element");
 }
 
+Link::Link()
+  : mElement(nullptr)
+  , mHistory(nullptr)
+  , mLinkState(eLinkState_NotLink)
+  , mNeedsRegistration(false)
+  , mRegistered(false)
+{
+}
+
 Link::~Link()
 {
   UnregisterFromHistory();
 }
 
 bool
 Link::ElementHasHref() const
 {
--- a/dom/base/Link.h
+++ b/dom/base/Link.h
@@ -31,16 +31,22 @@ class Link : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
 
   /**
    * aElement is the element pointer corresponding to this link.
    */
   explicit Link(Element* aElement);
+
+  /**
+   * This constructor is only used for testing.
+   */
+  explicit Link();
+
   virtual void SetLinkState(nsLinkState aState);
 
   /**
    * @return NS_EVENT_STATE_VISITED if this link is visited,
    *         NS_EVENT_STATE_UNVISTED if this link is not visited, or 0 if this
    *         link is not actually a link.
    */
   EventStates LinkState() const;
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -12,17 +12,17 @@ UNIFIED_SOURCES += [
     'TestAudioPacketizer.cpp',
     'TestAudioSegment.cpp',
     'TestGMPCrossOrigin.cpp',
     'TestGMPRemoveAndDelete.cpp',
     'TestGMPUtils.cpp',
     'TestIntervalSet.cpp',
     'TestMediaDataDecoder.cpp',
     'TestMediaEventSource.cpp',
-    'TestMediaFormatReader.cpp',
+    #'TestMediaFormatReader.cpp', disabled for bug 1316792, will be removed in bug 1318225
     'TestMozPromise.cpp',
     'TestMP3Demuxer.cpp',
     'TestMP4Demuxer.cpp',
     # 'TestMP4Reader.cpp', disabled so we can turn check tests back on (bug 1175752)
     'TestTrackEncoder.cpp',
     'TestVideoSegment.cpp',
     'TestVideoUtils.cpp',
     'TestVPXDecoding.cpp',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -128,17 +128,16 @@ ALLOWED_XPCOM_GLUE = {
     ('test_file_perms', 'storage/test'),
     ('test_mutex', 'storage/test'),
     ('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'),
     ('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'),
     ('calbasecomps', 'calendar/base/backend/libical/build'),
     ('purplexpcom', 'extensions/purple/purplexpcom/src'),
--- a/testing/cppunittest.ini
+++ b/testing/cppunittest.ini
@@ -68,17 +68,16 @@ skip-if = os == 'b2g' || os == 'android'
 [rlogringbuffer_unittest]
 [runnable_utils_unittest]
 [sctp_unittest]
 [signaling_unittests]
 [signaling_unittests_standalone]
 [simpletokenbucket_unittest]
 [sockettransportservice_unittest]
 [test_AsXXX_helpers]
-[test_IHistory]
 [test_StatementCache]
 [test_asyncStatementExecution_transaction]
 [test_async_callbacks_with_spun_event_loops]
 [test_binding_params]
 [test_deadlock_detector]
 skip-if = os == 'b2g' || (os == 'android' && debug) # Bug 1054249
 [test_file_perms]
 [test_mutex]
rename from toolkit/components/places/tests/cpp/mock_Link.h
rename to toolkit/components/places/tests/gtest/mock_Link.h
--- a/toolkit/components/places/tests/cpp/mock_Link.h
+++ b/toolkit/components/places/tests/gtest/mock_Link.h
@@ -8,26 +8,25 @@
  * This is a mock Link object which can be used in tests.
  */
 
 #ifndef mock_Link_h__
 #define mock_Link_h__
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/Link.h"
-#include "mozilla/dom/URLSearchParams.h"
 
 class mock_Link : public mozilla::dom::Link
 {
 public:
   NS_DECL_ISUPPORTS
 
   explicit mock_Link(void (*aHandlerFunction)(nsLinkState),
                      bool aRunNextTest = true)
-  : mozilla::dom::Link(nullptr)
+  : mozilla::dom::Link()
   , mHandler(aHandlerFunction)
   , mRunNextTest(aRunNextTest)
   {
     // Create a cyclic ownership, so that the link will be released only
     // after its status has been updated.  This will ensure that, when it should
     // run the next test, it will happen at the end of the test function, if
     // the link status has already been set before.  Indeed the link status is
     // updated on a separate connection, thus may happen at any time.
@@ -62,168 +61,9 @@ private:
   RefPtr<Link> mDeathGrip;
 };
 
 NS_IMPL_ISUPPORTS(
   mock_Link,
   mozilla::dom::Link
 )
 
-////////////////////////////////////////////////////////////////////////////////
-//// Needed Link Methods
-
-namespace mozilla {
-namespace dom {
-
-Link::Link(Element* aElement)
-: mElement(aElement)
-, mLinkState(eLinkState_NotLink)
-, mRegistered(false)
-{
-}
-
-Link::~Link()
-{
-}
-
-bool
-Link::ElementHasHref() const
-{
-  NS_NOTREACHED("Unexpected call to Link::ElementHasHref");
-  return false; // suppress compiler warning
-}
-
-void
-Link::SetLinkState(nsLinkState aState)
-{
-  NS_NOTREACHED("Unexpected call to Link::SetLinkState");
-}
-
-void
-Link::ResetLinkState(bool aNotify, bool aHasHref)
-{
-  NS_NOTREACHED("Unexpected call to Link::ResetLinkState");
-}
-
-nsIURI*
-Link::GetURI() const
-{
-  NS_NOTREACHED("Unexpected call to Link::GetURI");
-  return nullptr; // suppress compiler warning
-}
-
-size_t
-Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  NS_NOTREACHED("Unexpected call to Link::SizeOfExcludingThis");
-  return 0;
-}
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(URLSearchParams)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(URLSearchParams)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(URLSearchParams)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(URLSearchParams)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(URLSearchParams)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(URLSearchParams)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URLSearchParams)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-
-URLSearchParams::URLSearchParams(nsISupports* aParent,
-                                 URLSearchParamsObserver* aObserver)
-{
-}
-
-URLSearchParams::~URLSearchParams()
-{
-}
-
-JSObject*
-URLSearchParams::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return nullptr;
-}
-
-void
-URLSearchParams::ParseInput(const nsACString& aInput)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::ParseInput");
-}
-
-void
-URLSearchParams::Serialize(nsAString& aValue) const
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Serialize");
-}
-
-void
-URLSearchParams::Get(const nsAString& aName, nsString& aRetval)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Get");
-}
-
-void
-URLSearchParams::GetAll(const nsAString& aName, nsTArray<nsString >& aRetval)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::GetAll");
-}
-
-void
-URLSearchParams::Set(const nsAString& aName, const nsAString& aValue)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Set");
-}
-
-void
-URLSearchParams::Append(const nsAString& aName, const nsAString& aValue)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Append");
-}
-
-void
-URLSearchParams::AppendInternal(const nsAString& aName, const nsAString& aValue)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::AppendInternal");
-}
-
-bool
-URLSearchParams::Has(const nsAString& aName)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Has");
-  return false;
-}
-
-void
-URLSearchParams::Delete(const nsAString& aName)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::Delete");
-}
-
-void
-URLSearchParams::DeleteAll()
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::DeleteAll");
-}
-
-void
-URLSearchParams::NotifyObserver()
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::NotifyObserver");
-}
-
-NS_IMETHODIMP
-URLSearchParams::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
-                             nsACString& aContentType, nsACString& aCharset)
-{
-  NS_NOTREACHED("Unexpected call to URLSearchParams::GetSendInfo");
-  return NS_OK;
-}
-
-} // namespace dom
-} // namespace mozilla
-
 #endif // mock_Link_h__
rename from toolkit/components/places/tests/cpp/moz.build
rename to toolkit/components/places/tests/gtest/moz.build
--- a/toolkit/components/places/tests/cpp/moz.build
+++ b/toolkit/components/places/tests/gtest/moz.build
@@ -1,14 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-GeckoCppUnitTests([
-    'test_IHistory',
-])
+UNIFIED_SOURCES += [
+    'test_IHistory.cpp',
+]
 
-if CONFIG['JS_SHARED_LIBRARY']:
-    USE_LIBS += [
-        'js',
-    ]
+FINAL_LIBRARY = "xul-gtest"
rename from toolkit/components/places/tests/cpp/places_test_harness.h
rename to toolkit/components/places/tests/gtest/places_test_harness.h
--- a/toolkit/components/places/tests/cpp/places_test_harness.h
+++ b/toolkit/components/places/tests/gtest/places_test_harness.h
@@ -1,20 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
  * 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 "TestHarness.h"
+#include "gtest/gtest.h"
 #include "nsMemory.h"
 #include "nsThreadUtils.h"
 #include "nsDocShellCID.h"
 
 #include "nsToolkitCompsCID.h"
+#include "nsServiceManagerUtils.h"
 #include "nsINavHistoryService.h"
 #include "nsIObserverService.h"
 #include "nsIURI.h"
 #include "mozilla/IHistory.h"
 #include "mozIStorageConnection.h"
 #include "mozIStorageStatement.h"
 #include "mozIStorageAsyncStatement.h"
 #include "mozIStorageStatementCallback.h"
@@ -23,70 +24,34 @@
 #include "nsIObserver.h"
 #include "prinrval.h"
 #include "prtime.h"
 #include "mozilla/Attributes.h"
 
 #define WAITFORTOPIC_TIMEOUT_SECONDS 5
 
 
-static size_t gTotalTests = 0;
-static size_t gPassedTests = 0;
-
 #define do_check_true(aCondition) \
-  PR_BEGIN_MACRO \
-    gTotalTests++; \
-    if (aCondition) { \
-      gPassedTests++; \
-    } else { \
-      fail("%s | Expected true, got false at line %d", __FILE__, __LINE__); \
-    } \
-  PR_END_MACRO
+  EXPECT_TRUE(aCondition)
 
 #define do_check_false(aCondition) \
-  PR_BEGIN_MACRO \
-    gTotalTests++; \
-    if (!aCondition) { \
-      gPassedTests++; \
-    } else { \
-      fail("%s | Expected false, got true at line %d", __FILE__, __LINE__); \
-    } \
-  PR_END_MACRO
+  EXPECT_FALSE(aCondition)
 
 #define do_check_success(aResult) \
   do_check_true(NS_SUCCEEDED(aResult))
 
-#ifdef LINUX
-// XXX Linux opt builds on tinderbox are orange due to linking with stdlib.
-// This is sad and annoying, but it's a workaround that works.
 #define do_check_eq(aExpected, aActual) \
   do_check_true(aExpected == aActual)
-#else
-#include <sstream>
-
-#define do_check_eq(aActual, aExpected) \
-  PR_BEGIN_MACRO \
-    gTotalTests++; \
-    if (aExpected == aActual) { \
-      gPassedTests++; \
-    } else { \
-      std::ostringstream temp; \
-      temp << __FILE__ << " | Expected '" << aExpected << "', got '"; \
-      temp << aActual <<"' at line " << __LINE__; \
-      fail(temp.str().c_str()); \
-    } \
-  PR_END_MACRO
-#endif
 
 struct Test
 {
   void (*func)(void);
   const char* const name;
 };
-#define TEST(aName) \
+#define PTEST(aName) \
   {aName, #aName}
 
 /**
  * Runs the next text.
  */
 void run_next_test();
 
 /**
rename from toolkit/components/places/tests/cpp/places_test_harness_tail.h
rename to toolkit/components/places/tests/gtest/places_test_harness_tail.h
--- a/toolkit/components/places/tests/cpp/places_test_harness_tail.h
+++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h
@@ -9,35 +9,30 @@
 #ifdef MOZ_CRASHREPORTER
 #include "nsICrashReporter.h"
 #endif
 
 #ifndef TEST_NAME
 #error "Must #define TEST_NAME before including places_test_harness_tail.h"
 #endif
 
-#ifndef TEST_FILE
-#error "Must #define TEST_FILE before include places_test_harness_tail.h"
-#endif
-
 int gTestsIndex = 0;
 
-#define TEST_INFO_STR "TEST-INFO | (%s) | "
+#define TEST_INFO_STR "TEST-INFO | "
 
 class RunNextTest : public mozilla::Runnable
 {
 public:
   NS_IMETHOD Run() override
   {
     NS_ASSERTION(NS_IsMainThread(), "Not running on the main thread?");
     if (gTestsIndex < int(mozilla::ArrayLength(gTests))) {
       do_test_pending();
       Test &test = gTests[gTestsIndex++];
-      (void)fprintf(stderr, TEST_INFO_STR "Running %s.\n", TEST_FILE,
-                    test.name);
+      (void)fprintf(stderr, TEST_INFO_STR "Running %s.\n", test.name);
       test.func();
     }
 
     do_test_finished();
     return NS_OK;
   }
 };
 
@@ -63,87 +58,39 @@ do_test_finished()
   NS_ASSERTION(NS_IsMainThread(), "Not running on the main thread?");
   NS_ASSERTION(gPendingTests > 0, "Invalid pending test count!");
   gPendingTests--;
 }
 
 void
 disable_idle_service()
 {
-  (void)fprintf(stderr, TEST_INFO_STR  "Disabling Idle Service.\n", TEST_FILE);
+  (void)fprintf(stderr, TEST_INFO_STR  "Disabling Idle Service.\n");
   static NS_DEFINE_IID(kIdleCID, NS_IDLE_SERVICE_CID);
   nsresult rv;
   nsCOMPtr<nsIFactory> idleFactory = do_GetClassObject(kIdleCID, &rv);
   do_check_success(rv);
   nsCOMPtr<nsIComponentRegistrar> registrar;
   rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
   do_check_success(rv);
   rv = registrar->UnregisterFactory(kIdleCID, idleFactory);
   do_check_success(rv);
 }
 
-int
-main(int aArgc,
-     char** aArgv)
+TEST(IHistory, Test)
 {
-  ScopedXPCOM xpcom(TEST_NAME);
-  if (xpcom.failed())
-    return -1;
-  // Initialize a profile folder to ensure a clean shutdown.
-  nsCOMPtr<nsIFile> profile = xpcom.GetProfileDirectory();
-  if (!profile) {
-    fail("Couldn't get the profile directory.");
-    return -1;
-  }
-
-#ifdef MOZ_CRASHREPORTER
-    char* enabled = PR_GetEnv("MOZ_CRASHREPORTER");
-    if (enabled && !strcmp(enabled, "1")) {
-      // bug 787458: move this to an even-more-common location to use in all
-      // C++ unittests
-      nsCOMPtr<nsICrashReporter> crashreporter =
-        do_GetService("@mozilla.org/toolkit/crash-reporter;1");
-      if (crashreporter) {
-        fprintf(stderr, "Setting up crash reporting\n");
-
-        nsCOMPtr<nsIProperties> dirsvc =
-          do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
-        if (!dirsvc)
-          NS_RUNTIMEABORT("Couldn't get directory service");
-        nsCOMPtr<nsIFile> cwd;
-        nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR,
-                                  NS_GET_IID(nsIFile),
-                                  getter_AddRefs(cwd));
-        if (NS_FAILED(rv))
-          NS_RUNTIMEABORT("Couldn't get CWD");
-        crashreporter->SetEnabled(true);
-        crashreporter->SetMinidumpPath(cwd);
-      }
-    }
-#endif
-
   RefPtr<WaitForConnectionClosed> spinClose = new WaitForConnectionClosed();
 
   // Tinderboxes are constantly on idle.  Since idle tasks can interact with
   // tests, causing random failures, disable the idle service.
   disable_idle_service();
 
   do_test_pending();
   run_next_test();
 
   // Spin the event loop until we've run out of tests to run.
   while (gPendingTests) {
     (void)NS_ProcessNextEvent();
   }
 
   // And let any other events finish before we quit.
   (void)NS_ProcessPendingEvents(nullptr);
-
-  // Check that we have passed all of our tests, and output accordingly.
-  if (gPassedTests == gTotalTests) {
-    passed(TEST_FILE);
-  }
-
-  (void)fprintf(stderr, TEST_INFO_STR  "%u of %u tests passed\n",
-                TEST_FILE, unsigned(gPassedTests), unsigned(gTotalTests));
-
-  return gPassedTests == gTotalTests ? 0 : -1;
 }
rename from toolkit/components/places/tests/cpp/test_IHistory.cpp
rename to toolkit/components/places/tests/gtest/test_IHistory.cpp
--- a/toolkit/components/places/tests/cpp/test_IHistory.cpp
+++ b/toolkit/components/places/tests/gtest/test_IHistory.cpp
@@ -2,16 +2,17 @@
  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
  * 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 "places_test_harness.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
+#include "nsString.h"
 #include "mozilla/Attributes.h"
 #include "nsNetUtil.h"
 
 #include "mock_Link.h"
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /**
@@ -33,17 +34,17 @@ expect_no_visit(nsLinkState aState)
   do_check_true(aState == eLinkState_Unvisited);
 }
 
 already_AddRefed<nsIURI>
 new_test_uri()
 {
   // Create a unique spec.
   static int32_t specNumber = 0;
-  nsAutoCString spec = NS_LITERAL_CSTRING("http://mozilla.org/");
+  nsCString spec = NS_LITERAL_CSTRING("http://mozilla.org/");
   spec.AppendInt(specNumber++);
 
   // Create the URI for the spec.
   nsCOMPtr<nsIURI> testURI;
   nsresult rv = NS_NewURI(getter_AddRefs(testURI), spec);
   do_check_success(rv);
   return testURI.forget();
 }
@@ -606,34 +607,32 @@ test_two_null_links_same_uri()
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Test Harness
 
 /**
  * Note: for tests marked "Order Important!", please see the test for details.
  */
 Test gTests[] = {
-  TEST(test_set_places_enabled), // Must come first!
-  TEST(test_wait_checkpoint), // Must come second!
-  TEST(test_unvisited_does_not_notify_part1), // Order Important!
-  TEST(test_visited_notifies),
-  TEST(test_unvisited_does_not_notify_part2), // Order Important!
-  TEST(test_same_uri_notifies_both),
-  TEST(test_unregistered_visited_does_not_notify), // Order Important!
-  TEST(test_new_visit_notifies_waiting_Link),
-  TEST(test_RegisterVisitedCallback_returns_before_notifying),
-  TEST(test_observer_topic_dispatched),
-  TEST(test_visituri_inserts),
-  TEST(test_visituri_updates),
-  TEST(test_visituri_preserves_shown_and_typed),
-  TEST(test_visituri_creates_visit),
-  TEST(test_visituri_transition_typed),
-  TEST(test_visituri_transition_embed),
-  TEST(test_new_visit_adds_place_guid),
+  PTEST(test_set_places_enabled), // Must come first!
+  PTEST(test_wait_checkpoint), // Must come second!
+  PTEST(test_unvisited_does_not_notify_part1), // Order Important!
+  PTEST(test_visited_notifies),
+  PTEST(test_unvisited_does_not_notify_part2), // Order Important!
+  PTEST(test_same_uri_notifies_both),
+  PTEST(test_unregistered_visited_does_not_notify), // Order Important!
+  PTEST(test_new_visit_notifies_waiting_Link),
+  PTEST(test_RegisterVisitedCallback_returns_before_notifying),
+  PTEST(test_observer_topic_dispatched),
+  PTEST(test_visituri_inserts),
+  PTEST(test_visituri_updates),
+  PTEST(test_visituri_preserves_shown_and_typed),
+  PTEST(test_visituri_creates_visit),
+  PTEST(test_visituri_transition_typed),
+  PTEST(test_visituri_transition_embed),
+  PTEST(test_new_visit_adds_place_guid),
 
   // The rest of these tests are tests that are only run in IPC builds.
-  TEST(test_two_null_links_same_uri),
+  PTEST(test_two_null_links_same_uri),
 };
 
-const char* file = __FILE__;
 #define TEST_NAME "IHistory"
-#define TEST_FILE file
 #include "places_test_harness_tail.h"
--- a/toolkit/components/places/tests/moz.build
+++ b/toolkit/components/places/tests/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-TEST_DIRS += ['cpp']
+TEST_DIRS += ['gtest']
 
 TESTING_JS_MODULES += [
     'PlacesTestUtils.jsm',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += [
     'bookmarks/xpcshell.ini',
     'expiration/xpcshell.ini',