[folks] tracker: Standardise the TestCase set up procedure



commit 4a2d04d8dca7924ac6c0cfba84ed6042a9d1b70d
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Jun 21 19:15:35 2014 +0100

    tracker: Standardise the TestCase set up procedure
    
    Make it match the EDS one so we’re not doing heavyweight IPC in the
    constructor.

 tests/lib/tracker/test-case.vala              |   21 +++++++++++++++++++--
 tests/tracker/additional-names-updates.vala   |    2 --
 tests/tracker/avatar-updates.vala             |    2 --
 tests/tracker/birthday-details-interface.vala |    2 --
 tests/tracker/birthday-updates.vala           |    2 --
 tests/tracker/emails-updates.vala             |    2 --
 tests/tracker/family-name-updates.vala        |    2 --
 tests/tracker/favourite-updates.vala          |    2 --
 tests/tracker/fullname-updates.vala           |    2 --
 tests/tracker/gender-details-interface.vala   |    2 --
 tests/tracker/given-name-updates.vala         |    2 --
 tests/tracker/imaddresses-updates.vala        |    2 --
 tests/tracker/nickname-updates.vala           |    2 --
 tests/tracker/note-details-interface.vala     |    2 --
 tests/tracker/phones-updates.vala             |    2 --
 tests/tracker/prefix-name-updates.vala        |    2 --
 tests/tracker/role-details-interface.vala     |    2 --
 tests/tracker/suffix-name-updates.vala        |    2 --
 tests/tracker/url-details-interface.vala      |    2 --
 tests/tracker/website-updates.vala            |    2 --
 20 files changed, 19 insertions(+), 40 deletions(-)
---
diff --git a/tests/lib/tracker/test-case.vala b/tests/lib/tracker/test-case.vala
index 3f84c5f..0e4a252 100644
--- a/tests/lib/tracker/test-case.vala
+++ b/tests/lib/tracker/test-case.vala
@@ -51,8 +51,6 @@ public class TrackerTest.TestCase : Folks.TestCase
 
       Environment.set_variable ("FOLKS_BACKENDS_ALLOWED", "tracker", true);
       Environment.set_variable ("FOLKS_PRIMARY_STORE", "tracker", true);
-
-      this.tracker_backend = new TrackerTest.Backend ();
     }
 
   public override void private_bus_up ()
@@ -105,6 +103,25 @@ public class TrackerTest.TestCase : Folks.TestCase
         }
     }
 
+  public override void set_up ()
+    {
+      base.set_up ();
+      this.create_backend ();
+    }
+
+  /**
+   * Virtual method to create and set up the Tracker backend.
+   * Called from set_up(); may be overridden to not create the backend,
+   * or to create it but not set it up.
+   *
+   * Subclasses may chain up, but are not required to so.
+   */
+  public virtual void create_backend ()
+    {
+      this.tracker_backend = new TrackerTest.Backend ();
+      ((!) this.tracker_backend).set_up ();
+    }
+
   public override void tear_down ()
     {
       if (this.tracker_backend != null)
diff --git a/tests/tracker/additional-names-updates.vala b/tests/tracker/additional-names-updates.vala
index 7c7a620..f972871 100644
--- a/tests/tracker/additional-names-updates.vala
+++ b/tests/tracker/additional-names-updates.vala
@@ -39,8 +39,6 @@ public class AdditionalNamesUpdatesTests : TrackerTest.TestCase
     {
       base ("AdditionalNamesUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("additional names updates",
           this.test_additional_names_updates);
     }
diff --git a/tests/tracker/avatar-updates.vala b/tests/tracker/avatar-updates.vala
index cead31e..367c33f 100644
--- a/tests/tracker/avatar-updates.vala
+++ b/tests/tracker/avatar-updates.vala
@@ -41,8 +41,6 @@ public class AvatarUpdatesTests : TrackerTest.TestCase
     {
       base ("AvatarUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("avatar updates", this.test_avatar_updates);
     }
 
diff --git a/tests/tracker/birthday-details-interface.vala b/tests/tracker/birthday-details-interface.vala
index cfcdfb4..71e4062 100644
--- a/tests/tracker/birthday-details-interface.vala
+++ b/tests/tracker/birthday-details-interface.vala
@@ -35,8 +35,6 @@ public class BirthdayDetailsInterfaceTests : TrackerTest.TestCase
     {
       base ("BirthdayDetailsInterfaceTests");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("test birthday details interface",
           this.test_birthay_details_interface);
     }
diff --git a/tests/tracker/birthday-updates.vala b/tests/tracker/birthday-updates.vala
index 9aae3e2..7f66af2 100644
--- a/tests/tracker/birthday-updates.vala
+++ b/tests/tracker/birthday-updates.vala
@@ -41,8 +41,6 @@ public class BirthdayUpdatesTests : TrackerTest.TestCase
     {
       base ("BirthdayUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("birthday updates", this.test_birthday_updates);
     }
 
diff --git a/tests/tracker/emails-updates.vala b/tests/tracker/emails-updates.vala
index f183b29..777560a 100644
--- a/tests/tracker/emails-updates.vala
+++ b/tests/tracker/emails-updates.vala
@@ -39,8 +39,6 @@ public class EmailsUpdatesTests : TrackerTest.TestCase
     {
       base ("EmailsUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("emails updates", this.test_emails_updates);
     }
 
diff --git a/tests/tracker/family-name-updates.vala b/tests/tracker/family-name-updates.vala
index 9ef13e7..2840a3d 100644
--- a/tests/tracker/family-name-updates.vala
+++ b/tests/tracker/family-name-updates.vala
@@ -40,8 +40,6 @@ public class FamilyNameUpdatesTests : TrackerTest.TestCase
     {
       base ("FamilyNameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("family name updates", this.test_family_name_updates);
     }
 
diff --git a/tests/tracker/favourite-updates.vala b/tests/tracker/favourite-updates.vala
index 1ebea76..cf270fd 100644
--- a/tests/tracker/favourite-updates.vala
+++ b/tests/tracker/favourite-updates.vala
@@ -40,8 +40,6 @@ public class FavouriteUpdatesTests : TrackerTest.TestCase
     {
       base ("FavouriteUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("favourite update", this.test_favourite_update);
     }
 
diff --git a/tests/tracker/fullname-updates.vala b/tests/tracker/fullname-updates.vala
index ccd63be..4c00592 100644
--- a/tests/tracker/fullname-updates.vala
+++ b/tests/tracker/fullname-updates.vala
@@ -39,8 +39,6 @@ public class FullnameUpdatesTests : TrackerTest.TestCase
     {
       base ("FullnameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("fullname updates", this.test_fullname_updates);
     }
 
diff --git a/tests/tracker/gender-details-interface.vala b/tests/tracker/gender-details-interface.vala
index 270960e..99aa0d1 100644
--- a/tests/tracker/gender-details-interface.vala
+++ b/tests/tracker/gender-details-interface.vala
@@ -35,8 +35,6 @@ public class GenderDetailsInterfaceTests : TrackerTest.TestCase
     {
       base ("GenderDetailsInterfaceTests");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("test gender details interface",
           this.test_gender_details_interface);
     }
diff --git a/tests/tracker/given-name-updates.vala b/tests/tracker/given-name-updates.vala
index 962b26b..593dc20 100644
--- a/tests/tracker/given-name-updates.vala
+++ b/tests/tracker/given-name-updates.vala
@@ -39,8 +39,6 @@ public class GivenNameUpdatesTests : TrackerTest.TestCase
     {
       base ("GivenNameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("given name updates", this.test_given_name_updates);
     }
 
diff --git a/tests/tracker/imaddresses-updates.vala b/tests/tracker/imaddresses-updates.vala
index c89425c..c4b2a66 100644
--- a/tests/tracker/imaddresses-updates.vala
+++ b/tests/tracker/imaddresses-updates.vala
@@ -41,8 +41,6 @@ public class IMAddressesUpdatesTests : TrackerTest.TestCase
     {
       base ("IMAddressesUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("im addresses updates", this.test_imaddresses_updates);
     }
 
diff --git a/tests/tracker/nickname-updates.vala b/tests/tracker/nickname-updates.vala
index 64b3076..6943ec0 100644
--- a/tests/tracker/nickname-updates.vala
+++ b/tests/tracker/nickname-updates.vala
@@ -37,8 +37,6 @@ public class NicknameUpdatesTests : TrackerTest.TestCase
     {
       base ("NicknameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("nickname updates", this.test_nickname_updates);
     }
 
diff --git a/tests/tracker/note-details-interface.vala b/tests/tracker/note-details-interface.vala
index 8e484d2..4f405d0 100644
--- a/tests/tracker/note-details-interface.vala
+++ b/tests/tracker/note-details-interface.vala
@@ -35,8 +35,6 @@ public class NoteDetailsInterfaceTests : TrackerTest.TestCase
     {
       base ("NoteDetailsInterfaceTests");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("test note details interface",
           this.test_note_details_interface);
     }
diff --git a/tests/tracker/phones-updates.vala b/tests/tracker/phones-updates.vala
index 65ce26e..d704b76 100644
--- a/tests/tracker/phones-updates.vala
+++ b/tests/tracker/phones-updates.vala
@@ -40,8 +40,6 @@ public class PhonesUpdatesTests : TrackerTest.TestCase
     {
       base ("PhonesUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("phones updates", this.test_phones_updates);
     }
 
diff --git a/tests/tracker/prefix-name-updates.vala b/tests/tracker/prefix-name-updates.vala
index a20c6ae..5207340 100644
--- a/tests/tracker/prefix-name-updates.vala
+++ b/tests/tracker/prefix-name-updates.vala
@@ -39,8 +39,6 @@ public class PrefixNameUpdatesTests : TrackerTest.TestCase
     {
       base ("PrefixNameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("prefix name updates", this.test_prefix_name_updates);
     }
 
diff --git a/tests/tracker/role-details-interface.vala b/tests/tracker/role-details-interface.vala
index 064be8e..e7b7318 100644
--- a/tests/tracker/role-details-interface.vala
+++ b/tests/tracker/role-details-interface.vala
@@ -35,8 +35,6 @@ public class RoleDetailsInterfaceTests : TrackerTest.TestCase
     {
       base ("RoleDetailsInterfaceTests");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("test role details interface",
           this.test_role_details_interface);
     }
diff --git a/tests/tracker/suffix-name-updates.vala b/tests/tracker/suffix-name-updates.vala
index ac4ff97..5aa479d 100644
--- a/tests/tracker/suffix-name-updates.vala
+++ b/tests/tracker/suffix-name-updates.vala
@@ -40,8 +40,6 @@ public class SuffixNameUpdatesTests : TrackerTest.TestCase
     {
       base ("SuffixNameUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("suffix name updates", this.test_suffix_name_updates);
     }
 
diff --git a/tests/tracker/url-details-interface.vala b/tests/tracker/url-details-interface.vala
index 3cba442..cdfa5d9 100644
--- a/tests/tracker/url-details-interface.vala
+++ b/tests/tracker/url-details-interface.vala
@@ -37,8 +37,6 @@ public class UrlDetailsInterfaceTests : TrackerTest.TestCase
     {
       base ("UrlDetailsInterfaceTests");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("test url details interface",
           this.test_url_details_interface);
     }
diff --git a/tests/tracker/website-updates.vala b/tests/tracker/website-updates.vala
index b2942ca..64a446a 100644
--- a/tests/tracker/website-updates.vala
+++ b/tests/tracker/website-updates.vala
@@ -40,8 +40,6 @@ public class WebsiteUpdatesTests : TrackerTest.TestCase
     {
       base ("WebsiteUpdates");
 
-      ((!) this.tracker_backend).debug = false;
-
       this.add_test ("websites updates", this.test_website_updates);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]