Bug 614550 - Ensure places is enabled for places related c++ tests; r=mak, a=test-only change
authorMark Banner <bugzilla@standard8.plus.com>
Wed, 24 Nov 2010 15:13:47 +0000
changeset 58166 2c8654b57cca8c10e9afef8dd2ac5fd05f38dd3f
parent 58165 0ec2e68a8677c0c64c75cb9ffd1fbb6d0936df3c
child 58167 59144b59cd11dc99985b669e348a55a68be4fee8
push id17178
push userbugzilla@standard8.plus.com
push dateWed, 24 Nov 2010 15:15:53 +0000
treeherdermozilla-central@2c8654b57cca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, test-only
bugs614550
milestone2.0b8pre
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 614550 - Ensure places is enabled for places related c++ tests; r=mak, a=test-only change
toolkit/components/places/tests/cpp/test_IHistory.cpp
--- a/toolkit/components/places/tests/cpp/test_IHistory.cpp
+++ b/toolkit/components/places/tests/cpp/test_IHistory.cpp
@@ -34,16 +34,18 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "places_test_harness.h"
 #include "nsIBrowserHistory.h"
+#include "nsIPrefService.h"
+#include "nsIPrefBranch.h"
 
 #include "mock_Link.h"
 using namespace mozilla::dom;
 
 /**
  * This file tests the IHistory interface.
  */
 
@@ -122,16 +124,32 @@ private:
 NS_IMPL_ISUPPORTS1(
   VisitURIObserver,
   nsIObserver
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Test Functions
 
+void
+test_set_places_enabled()
+{
+  // Ensure places is enabled for everyone.
+  nsresult rv;
+  nsCOMPtr<nsIPrefBranch> prefBranch =
+    do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
+  do_check_success(rv);
+
+  rv = prefBranch->SetBoolPref("places.history.enabled", PR_TRUE);
+  do_check_success(rv);
+
+  // Run the next test.
+  run_next_test();
+}
+
 // These variables are shared between part 1 and part 2 of the test.  Part 2
 // sets the nsCOMPtr's to nsnull, freeing the reference.
 namespace test_unvisited_does_not_notify {
   nsCOMPtr<nsIURI> testURI;
   nsCOMPtr<Link> testLink;
 }
 void
 test_unvisted_does_not_notify_part1()
@@ -580,16 +598,17 @@ 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_unvisted_does_not_notify_part1), // Order Important!
   TEST(test_visited_notifies),
   TEST(test_unvisted_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),