[folks] tests: Add a fake-tp-backend program in the Telepathy tests



commit d6e9f684b0303b6c7365373dad1adb937c7e99cf
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Jan 8 17:02:40 2012 +0000

    tests: Add a fake-tp-backend program in the Telepathy tests
    
    This is not an automated test, and is intended to be run manually on a D-Bus
    bus specified using the DBUS_SESSION_BUS_ADDRESS environment variable,
    together with a client program (for example, a test program) to be run against
    it.

 tests/telepathy/Makefile.am          |    8 +++-
 tests/telepathy/fake-tp-backend.vala |   68 ++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index 3e6eef8..ced3a7e 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -46,6 +46,7 @@ AM_VALAFLAGS = \
 
 # in order from least to most complex
 noinst_PROGRAMS = \
+	fake-tp-backend \
 	persona-store-capabilities \
 	individual-retrieval \
 	individual-properties \
@@ -61,7 +62,11 @@ TESTS_ENVIRONMENT = \
 	$(RUN_WITH_PRIVATE_BUS) \
 	--config-file=$(SESSION_CONF) \
 	--
-TESTS = $(noinst_PROGRAMS)
+TESTS = $(filter-out fake-tp-backend,$(noinst_PROGRAMS))
+
+fake_tp_backend_SOURCES = \
+	fake-tp-backend.vala \
+	$(NULL)
 
 individual_retrieval_SOURCES = \
 	individual-retrieval.vala \
@@ -76,6 +81,7 @@ persona_store_capabilities_SOURCES = \
 	$(NULL)
 
 BUILT_SOURCES = \
+	fake_tp_backend_vala.stamp \
 	individual_properties_vala.stamp \
 	individual_retrieval_vala.stamp \
 	persona_store_capabilities_vala.stamp \
diff --git a/tests/telepathy/fake-tp-backend.vala b/tests/telepathy/fake-tp-backend.vala
new file mode 100644
index 0000000..1537d71
--- /dev/null
+++ b/tests/telepathy/fake-tp-backend.vala
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Philip Withnall
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Philip Withnall <philip tecnocode co uk>
+ */
+
+using TpTest;
+using Folks;
+
+/* A simple test program to expose the test Telepathy account used by folksâ
+ * Telepathy tests on the current D-Bus bus. This is intended to be used for
+ * manual testing using the test Telepathy account. */
+
+public int main (string[] args)
+{
+  var tp_backend = new TpTest.Backend ();
+
+  tp_backend.set_up ();
+  void *account_handle = tp_backend.add_account ("protocol", "me example com",
+      "cm", "account");
+
+  var main_loop = new GLib.MainLoop (null, false);
+
+  /* Set up the aggregator */
+  var aggregator = new IndividualAggregator ();
+
+  Idle.add (() =>
+    {
+      aggregator.prepare.begin ((s,r) =>
+        {
+          try
+            {
+              aggregator.prepare.end (r);
+            }
+          catch (GLib.Error e1)
+            {
+              GLib.critical ("Failed to prepare aggregator: %s", e1.message);
+              assert_not_reached ();
+            }
+        });
+
+      return false;
+    });
+
+  /* Run until we're killed. */
+  main_loop.run ();
+
+  /* Tear down .*/
+  aggregator = null;
+
+  tp_backend.remove_account (account_handle);
+  tp_backend.tear_down ();
+
+  return 0;
+}



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