They currently assume that they will be wrapped in with-session-bus*.sh.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=695381
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*/
+/**
+ * A test case whose private D-Bus session contains the necessary daemons
+ * for an Evolution address-book.
+ *
+ * FIXME: For now, this relies on running under with-session-bus-eds.sh
+ * with AVATAR_FILE_PATH and FOLKS_BACKEND_PATH set.
+ */
public class EdsTest.TestCase : Folks.TestCase
{
+ /**
+ * An EDS backend, normally non-null between set_up() and tear_down().
+ *
+ * If this is non-null, the subclass is expected to have called
+ * its set_up() method at some point before tear_down() is reached.
+ * This usually happens in create_backend().
+ */
public EdsTest.Backend? eds_backend = null;
public TestCase (string name)
this.configure_primary_store ();
}
+ /**
+ * Virtual method to create and set up the EDS 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.eds_backend = new EdsTest.Backend ();
((!) this.eds_backend).set_up ();
}
+ /**
+ * Virtual method to configure ``FOLKS_PRIMARY_STORE`` to point to
+ * our //eds_backend//.
+ *
+ * Subclasses may chain up, but are not required to so.
+ */
public virtual void configure_primary_store ()
{
/* By default, configure EDS as the primary store. */
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*/
+/**
+ * A test case for the key-file backend, which is configured as the
+ * primary store and as the only backend allowed.
+ */
public class KfTest.TestCase : Folks.TestCase
{
+ /**
+ * The key-file test backend.
+ *
+ * For compatibility with Folks' existing tests' assumptions, this
+ * class creates this object but does not call its set_up() or
+ * tear_down() methods.
+ *
+ * FIXME: ideally this should be per-test, created in set_up(),
+ * and torn down in tear_down(). This would require making it nullable.
+ */
public KfTest.Backend kf_backend;
public TestCase (string name)
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*/
+/**
+ * A test case for the libsocialweb backend. Folks is configured
+ * to use that backend and no others, with no primary store.
+ *
+ * FIXME: for now, this relies on being run under with-session-bus.sh
+ * with no activatable services.
+ */
public class LibsocialwebTest.TestCase : Folks.TestCase
{
+ /**
+ * The libsocialweb test backend, or null outside the period from
+ * set_up() to tear_down().
+ *
+ * If this is non-null, the subclass is expected to have called
+ * its set_up() method at some point before tear_down() is reached.
+ */
public LibsocialwebTest.Backend? lsw_backend = null;
public TestCase (string name)
Environment.set_variable ("FOLKS_PRIMARY_STORE", "", true);
}
+ /**
+ * Set up the libsocialweb test backend and wait for it to become ready.
+ */
public override void set_up ()
{
base.set_up ();
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*/
+/**
+ * A test case with a Telepathy backend (used to test the Telepathy
+ * backend specifically), and optionally also a keyfile backend
+ * (used to test Folks in general - see //MixedTestCase//).
+ *
+ * Folks is configured to use the Telepathy backend, with no primary store,
+ * unless //use_keyfile_too// is set.
+ *
+ * FIXME: for now, this relies on being run under with-session-bus.sh
+ * with no activatable services.
+ */
public class TpfTest.TestCase : Folks.TestCase
{
+ /**
+ * The key-file backend, or null if a test case has overridden
+ * create_kf_backend() to avoid creating it, or has left
+ * //use_keyfile_too// set to false.
+ *
+ * For the moment this is created in the constructor and freed
+ * in the destructor; ideally those would move into set_up() and
+ * tear_down() at some point.
+ *
+ * If this is non-null, the subclass is expected to have called
+ * its set_up() method at some point before tear_down() is reached.
+ */
public KfTest.Backend? kf_backend = null;
+
+ /**
+ * The Telepathy backend, or null if a test case has overridden
+ * create_tp_backend() to avoid creating it.
+ *
+ * If this is non-null, the subclass is expected to have called
+ * its set_up() method at some point before tear_down() is reached.
+ */
public TpTests.Backend? tp_backend = null;
+
+ /**
+ * An account used by the //tp_backend//, or null if a test case
+ * has overridden set_up_tp() to avoid creating it.
+ *
+ * If non-null when tear_down() is reached, this account will be
+ * removed automatically.
+ */
public void *account_handle = null;
+ /**
+ * If true, Folks will be configured to use a key-file as its primary
+ * store, and allow both Telepathy and the key-file to be loaded.
+ * This is used to test Folks in general (e.g. the IndividualAggregator).
+ *
+ * If false, Folks will be configured to use Telepathy only, with no
+ * primary store. This is used to test the Telepathy backend.
+ */
public virtual bool use_keyfile_too
{
get
}
}
+ /**
+ * Set ``FOLKS_BACKENDS_ALLOWED`` and ``FOLKS_PRIMARY_STORE``,
+ * and create the backends if appropriate (although the latter should
+ * ideally move into set_up()).
+ */
public TestCase (string name)
{
base (name);
this.create_tp_backend ();
}
+ /**
+ * Virtual method to create the keyfile backend. Currently called by
+ * the constructor (once per process), but might move into set_up() later.
+ *
+ * The default implementation respects //use_keyfile_too//. Subclasses
+ * can override this to never, or always, create this backend.
+ *
+ * Subclasses may chain up, but are not required to so.
+ */
public virtual void create_kf_backend ()
{
if (use_keyfile_too)
this.kf_backend = new KfTest.Backend ();
}
+ /**
+ * Virtual method to create the Telepathy backend. Currently called by
+ * the constructor (once per process), but might move into set_up() later.
+ *
+ * Subclasses may chain up, but are not required to so.
+ */
public virtual void create_tp_backend ()
{
this.tp_backend = new TpTests.Backend ();
this.set_up_kf ();
}
+ /**
+ * Virtual method to set up the Telepathy backend, called from
+ * set_up(). The default implementation sets it up and adds one account,
+ * storing its handle in //account_handle//.
+ *
+ * Subclasses may override this to avoid setting up any accounts, to
+ * set up more than one account, or to avoid setup at this stage
+ * (deferring it until the test itself). However, if tp_backend
+ * is not null at tear_down(), the subclass is expected to have called
+ * set_up() on it at some point.
+ *
+ * Subclasses may chain up, but are not required to so.
+ */
public virtual void set_up_tp ()
{
if (this.tp_backend != null)
}
}
+ /**
+ * Virtual method to set up the key-file backend, called from
+ * set_up(). The default implementation sets it up using an empty
+ * key-file, unless it has not been created. Subclasses may override
+ * this to set it up with different contents, or to avoid setup
+ * altogether (deferring it until the test itself). However, if kf_backend
+ * is not null at tear_down(), the subclass is expected to have called
+ * set_up() on it at some point.
+ *
+ * Subclasses may chain up, but are not required to so.
+ */
public virtual void set_up_kf ()
{
if (this.kf_backend != null)
}
}
+/**
+ * A test-case for the combination of Telepathy and a key-file,
+ * used to test things like the IndividualAggregator. This is just
+ * TestCase with //use_keyfile_too// overridden to true.
+ *
+ * Folks is configured to use the Telepathy and key-file backends,
+ * with the latter as its primary store.
+ */
public class TpfTest.MixedTestCase : TpfTest.TestCase
{
public override bool use_keyfile_too
* Julien Peeters <contact@julienpeeters.fr>
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*
- * Copied from libgee/tests/testcase.vala.
+ * Adapted from libgee/tests/testcase.vala.
*/
+/**
+ * A test case for Folks, containing one or more individual tests.
+ *
+ * The constructor configures Folks to disallow all backends, via
+ * ``FOLKS_BACKENDS_ALLOWED``. Subclasses are expected to reset
+ * this variable to a suitable value in their constructors or
+ * set_up() methods.
+ */
public abstract class Folks.TestCase : Object
{
private GLib.TestSuite _suite;
adaptor.name, adaptor.set_up, adaptor.run, adaptor.tear_down));
}
- /* Set up for one test. If you have more than one test case, this will
- * be called once per test. */
+ /**
+ * Set up for one test. If you have more than one test, this will
+ * be called once per test.
+ *
+ * Subclasses may override this method. They are expected to chain up
+ * as the first thing in their implementation.
+ */
public virtual void set_up ()
{
}
- /* Clean up after one test. If you have more than one test case, this will
- * be called once per test. It should undo set_up (). */
+ /**
+ * Clean up after one test, undoing set_up(). If you have more than
+ * one test, this will be called once per test.
+ *
+ * Subclasses may override this method. They are expected to chain up
+ * as the last thing in their implementation.
+ */
public virtual void tear_down ()
{
}
- /* Clean up after all tests. If you have more than one test case, this
+ /**
+ * Clean up after all tests. If you have more than one test case, this
* will be called once, the last time only. It should undo the
- * constructor, and must be idempotent (i.e. OK to call more than once). */
+ * constructor, and must be idempotent (i.e. OK to call more than once).
+ *
+ * Subclasses may override this method. They are expected to chain up
+ * as the last thing in their implementation.
+ *
+ * If there are no reference leaks, this method will be called
+ * automatically when the TestCase is destroyed.
+ */
public virtual void final_tear_down ()
{
}
* Simon McVittie <simon.mcvittie@collabora.co.uk>
*/
+/**
+ * A test case for the Tracker backend.
+ *
+ * Folks is configured to use the Tracker backend as primary store,
+ * and no other backends.
+ *
+ * FIXME: For now, this relies on running under with-session-bus-tracker.sh
+ * with AVATAR_FILE_PATH and FOLKS_BACKEND_PATH set.
+ */
public class TrackerTest.TestCase : Folks.TestCase
{
+ /**
+ * The Tracker backend.
+ *
+ * The subclass is expected to have called its set_up() method at
+ * some point before tear_down() is reached.
+ */
public TrackerTest.Backend? tracker_backend = null;
+ /**
+ * Set environment variables and create the tracker backend.
+ *
+ * FIXME: maybe it shouldn't be created until set_up()? (Tests
+ * will need to be checked to make sure that's OK.)
+ */
public TestCase (string name)
{
base (name);