/* test-case.c generated by valac 0.26.2.1-1f25, the Vala compiler
 * generated from test-case.vala, do not modify */

/* test-case.vala
 *
 * Copyright © 2011 Collabora Ltd.
 * Copyright © 2013 Intel Corporation
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Authors:
 *      Travis Reitter <travis.reitter@collabora.co.uk>
 *      Simon McVittie <simon.mcvittie@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks-test.h>
#include <kf-test.h>
#include <tp-test-contactlist.h>
#include <stdlib.h>
#include <string.h>


#define TPF_TEST_TYPE_TEST_CASE (tpf_test_test_case_get_type ())
#define TPF_TEST_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPF_TEST_TYPE_TEST_CASE, TpfTestTestCase))
#define TPF_TEST_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPF_TEST_TYPE_TEST_CASE, TpfTestTestCaseClass))
#define TPF_TEST_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPF_TEST_TYPE_TEST_CASE))
#define TPF_TEST_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPF_TEST_TYPE_TEST_CASE))
#define TPF_TEST_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPF_TEST_TYPE_TEST_CASE, TpfTestTestCaseClass))

typedef struct _TpfTestTestCase TpfTestTestCase;
typedef struct _TpfTestTestCaseClass TpfTestTestCaseClass;
typedef struct _TpfTestTestCasePrivate TpfTestTestCasePrivate;
#define _kf_test_backend_unref0(var) ((var == NULL) ? NULL : (var = (kf_test_backend_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_main_context_unref0(var) ((var == NULL) ? NULL : (var = (g_main_context_unref (var), NULL)))

#define TPF_TEST_TYPE_MIXED_TEST_CASE (tpf_test_mixed_test_case_get_type ())
#define TPF_TEST_MIXED_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPF_TEST_TYPE_MIXED_TEST_CASE, TpfTestMixedTestCase))
#define TPF_TEST_MIXED_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPF_TEST_TYPE_MIXED_TEST_CASE, TpfTestMixedTestCaseClass))
#define TPF_TEST_IS_MIXED_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPF_TEST_TYPE_MIXED_TEST_CASE))
#define TPF_TEST_IS_MIXED_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPF_TEST_TYPE_MIXED_TEST_CASE))
#define TPF_TEST_MIXED_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPF_TEST_TYPE_MIXED_TEST_CASE, TpfTestMixedTestCaseClass))

typedef struct _TpfTestMixedTestCase TpfTestMixedTestCase;
typedef struct _TpfTestMixedTestCaseClass TpfTestMixedTestCaseClass;
typedef struct _TpfTestMixedTestCasePrivate TpfTestMixedTestCasePrivate;

struct _TpfTestTestCase {
	FolksTestCase parent_instance;
	TpfTestTestCasePrivate * priv;
	KfTestBackend* kf_backend;
	TpTestsBackend* tp_backend;
	void* account_handle;
};

struct _TpfTestTestCaseClass {
	FolksTestCaseClass parent_class;
	void (*create_kf_backend) (TpfTestTestCase* self);
	void (*create_tp_backend) (TpfTestTestCase* self);
	void (*set_up_tp) (TpfTestTestCase* self);
	void (*set_up_kf) (TpfTestTestCase* self);
	gboolean (*get_use_keyfile_too) (TpfTestTestCase* self);
};

struct _TpfTestMixedTestCase {
	TpfTestTestCase parent_instance;
	TpfTestMixedTestCasePrivate * priv;
};

struct _TpfTestMixedTestCaseClass {
	TpfTestTestCaseClass parent_class;
};


static gpointer tpf_test_test_case_parent_class = NULL;
static gpointer tpf_test_mixed_test_case_parent_class = NULL;

GType tpf_test_test_case_get_type (void) G_GNUC_CONST;
enum  {
	TPF_TEST_TEST_CASE_DUMMY_PROPERTY,
	TPF_TEST_TEST_CASE_USE_KEYFILE_TOO,
	TPF_TEST_TEST_CASE_USES_DBUS_1
};
TpfTestTestCase* tpf_test_test_case_new (const gchar* name);
TpfTestTestCase* tpf_test_test_case_construct (GType object_type, const gchar* name);
gboolean tpf_test_test_case_get_use_keyfile_too (TpfTestTestCase* self);
void tpf_test_test_case_create_kf_backend (TpfTestTestCase* self);
void tpf_test_test_case_create_tp_backend (TpfTestTestCase* self);
static void tpf_test_test_case_real_create_kf_backend (TpfTestTestCase* self);
static void tpf_test_test_case_real_create_tp_backend (TpfTestTestCase* self);
static void tpf_test_test_case_real_set_up (FolksTestCase* base);
void tpf_test_test_case_set_up_tp (TpfTestTestCase* self);
void tpf_test_test_case_set_up_kf (TpfTestTestCase* self);
static void tpf_test_test_case_real_set_up_tp (TpfTestTestCase* self);
static void tpf_test_test_case_real_set_up_kf (TpfTestTestCase* self);
static void tpf_test_test_case_real_tear_down (FolksTestCase* base);
static void tpf_test_test_case_finalize (GObject* obj);
static void _vala_tpf_test_test_case_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
GType tpf_test_mixed_test_case_get_type (void) G_GNUC_CONST;
enum  {
	TPF_TEST_MIXED_TEST_CASE_DUMMY_PROPERTY,
	TPF_TEST_MIXED_TEST_CASE_USE_KEYFILE_TOO
};
TpfTestMixedTestCase* tpf_test_mixed_test_case_new (const gchar* name);
TpfTestMixedTestCase* tpf_test_mixed_test_case_construct (GType object_type, const gchar* name);
static void _vala_tpf_test_mixed_test_case_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


/**
   * Set ``FOLKS_BACKENDS_ALLOWED`` and ``FOLKS_PRIMARY_STORE``,
   * and create the backends if appropriate (although the latter should
   * ideally move into set_up()).
   */
TpfTestTestCase* tpf_test_test_case_construct (GType object_type, const gchar* name) {
	TpfTestTestCase * self = NULL;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
#line 88 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 91 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = name;
#line 91 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestTestCase*) folks_test_case_construct (object_type, _tmp0_);
#line 93 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp1_ = tpf_test_test_case_get_use_keyfile_too (self);
#line 93 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp2_ = _tmp1_;
#line 93 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp2_) {
#line 95 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_setenv ("FOLKS_BACKENDS_ALLOWED", "telepathy,key-file", TRUE);
#line 97 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_setenv ("FOLKS_PRIMARY_STORE", "key-file", TRUE);
#line 151 "test-case.c"
	} else {
#line 101 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_setenv ("FOLKS_BACKENDS_ALLOWED", "telepathy", TRUE);
#line 103 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_setenv ("FOLKS_PRIMARY_STORE", "", TRUE);
#line 157 "test-case.c"
	}
#line 106 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_test_case_create_kf_backend (self);
#line 107 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_test_case_create_tp_backend (self);
#line 88 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return self;
#line 165 "test-case.c"
}


TpfTestTestCase* tpf_test_test_case_new (const gchar* name) {
#line 88 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return tpf_test_test_case_construct (TPF_TEST_TYPE_TEST_CASE, name);
#line 172 "test-case.c"
}


/**
   * 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.
   */
static void tpf_test_test_case_real_create_kf_backend (TpfTestTestCase* self) {
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
#line 133 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = folks_test_utils_get_source_test_data ("telepathy/relationships-empty.ini");
#line 133 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp1_ = _tmp0_;
#line 133 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_setenv ("FOLKS_BACKEND_KEY_FILE_PATH", _tmp1_, TRUE);
#line 133 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_g_free0 (_tmp1_);
#line 137 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp2_ = tpf_test_test_case_get_use_keyfile_too (self);
#line 137 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp3_ = _tmp2_;
#line 137 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp3_) {
#line 204 "test-case.c"
		KfTestBackend* _tmp4_ = NULL;
#line 138 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp4_ = kf_test_backend_new ();
#line 138 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_kf_test_backend_unref0 (self->kf_backend);
#line 138 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		self->kf_backend = _tmp4_;
#line 212 "test-case.c"
	}
}


void tpf_test_test_case_create_kf_backend (TpfTestTestCase* self) {
#line 130 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_if_fail (self != NULL);
#line 130 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_GET_CLASS (self)->create_kf_backend (self);
#line 222 "test-case.c"
}


/**
   * 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.
   */
static void tpf_test_test_case_real_create_tp_backend (TpfTestTestCase* self) {
	TpTestsBackend* _tmp0_ = NULL;
#line 149 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = tp_tests_backend_new ();
#line 149 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_g_object_unref0 (self->tp_backend);
#line 149 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self->tp_backend = _tmp0_;
#line 240 "test-case.c"
}


void tpf_test_test_case_create_tp_backend (TpfTestTestCase* self) {
#line 147 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_if_fail (self != NULL);
#line 147 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_GET_CLASS (self)->create_tp_backend (self);
#line 249 "test-case.c"
}


static void tpf_test_test_case_real_set_up (FolksTestCase* base) {
	TpfTestTestCase * self;
#line 152 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestTestCase*) base;
#line 154 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	FOLKS_TEST_CASE_CLASS (tpf_test_test_case_parent_class)->set_up (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 155 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_test_case_set_up_tp (self);
#line 156 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_test_case_set_up_kf (self);
#line 263 "test-case.c"
}


/**
   * 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.
   */
static gpointer _g_object_ref0 (gpointer self) {
#line 176 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return self ? g_object_ref (self) : NULL;
#line 283 "test-case.c"
}


static void tpf_test_test_case_real_set_up_tp (TpfTestTestCase* self) {
	TpTestsBackend* _tmp0_ = NULL;
#line 174 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = self->tp_backend;
#line 174 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp0_ != NULL) {
#line 293 "test-case.c"
		TpTestsBackend* tp_backend = NULL;
		TpTestsBackend* _tmp1_ = NULL;
		TpTestsBackend* _tmp2_ = NULL;
		TpTestsBackend* _tmp3_ = NULL;
		TpTestsBackend* _tmp4_ = NULL;
		void* _tmp5_ = NULL;
#line 176 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp1_ = self->tp_backend;
#line 176 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, tp_tests_backend_get_type (), TpTestsBackend));
#line 176 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		tp_backend = _tmp2_;
#line 178 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp3_ = tp_backend;
#line 178 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		tp_tests_backend_set_up (_tmp3_);
#line 179 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp4_ = tp_backend;
#line 179 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp5_ = tp_tests_backend_add_account (_tmp4_, "protocol", "me@example.com", "cm", "account");
#line 179 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		self->account_handle = _tmp5_;
#line 174 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_g_object_unref0 (tp_backend);
#line 318 "test-case.c"
	}
}


void tpf_test_test_case_set_up_tp (TpfTestTestCase* self) {
#line 172 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_if_fail (self != NULL);
#line 172 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_GET_CLASS (self)->set_up_tp (self);
#line 328 "test-case.c"
}


/**
   * 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.
   */
static void tpf_test_test_case_real_set_up_kf (TpfTestTestCase* self) {
	KfTestBackend* _tmp0_ = NULL;
#line 197 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = self->kf_backend;
#line 197 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp0_ != NULL) {
#line 349 "test-case.c"
		KfTestBackend* _tmp1_ = NULL;
#line 198 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp1_ = self->kf_backend;
#line 198 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		kf_test_backend_set_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, KF_TEST_TYPE_BACKEND, KfTestBackend), "");
#line 355 "test-case.c"
	}
}


void tpf_test_test_case_set_up_kf (TpfTestTestCase* self) {
#line 195 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_if_fail (self != NULL);
#line 195 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_GET_CLASS (self)->set_up_kf (self);
#line 365 "test-case.c"
}


static gpointer _g_main_context_ref0 (gpointer self) {
#line 227 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return self ? g_main_context_ref (self) : NULL;
#line 372 "test-case.c"
}


static void tpf_test_test_case_real_tear_down (FolksTestCase* base) {
	TpfTestTestCase * self;
	TpTestsBackend* _tmp0_ = NULL;
	KfTestBackend* _tmp7_ = NULL;
	GMainContext* context = NULL;
	GMainContext* _tmp9_ = NULL;
	GMainContext* _tmp10_ = NULL;
#line 201 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestTestCase*) base;
#line 203 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = self->tp_backend;
#line 203 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp0_ != NULL) {
#line 389 "test-case.c"
		TpTestsBackend* tp_backend = NULL;
		TpTestsBackend* _tmp1_ = NULL;
		TpTestsBackend* _tmp2_ = NULL;
		void* _tmp3_ = NULL;
		TpTestsBackend* _tmp6_ = NULL;
#line 205 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp1_ = self->tp_backend;
#line 205 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, tp_tests_backend_get_type (), TpTestsBackend));
#line 205 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		tp_backend = _tmp2_;
#line 207 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp3_ = self->account_handle;
#line 207 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		if (_tmp3_ != NULL) {
#line 405 "test-case.c"
			TpTestsBackend* _tmp4_ = NULL;
			void* _tmp5_ = NULL;
#line 209 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
			_tmp4_ = tp_backend;
#line 209 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
			_tmp5_ = self->account_handle;
#line 209 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
			tp_tests_backend_remove_account (_tmp4_, _tmp5_);
#line 210 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
			self->account_handle = NULL;
#line 416 "test-case.c"
		}
#line 213 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp6_ = tp_backend;
#line 213 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		tp_tests_backend_tear_down (_tmp6_);
#line 203 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_g_object_unref0 (tp_backend);
#line 424 "test-case.c"
	}
#line 216 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp7_ = self->kf_backend;
#line 216 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	if (_tmp7_ != NULL) {
#line 430 "test-case.c"
		KfTestBackend* _tmp8_ = NULL;
#line 218 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp8_ = self->kf_backend;
#line 218 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		kf_test_backend_tear_down (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, KF_TEST_TYPE_BACKEND, KfTestBackend));
#line 436 "test-case.c"
	}
#line 227 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp9_ = g_main_context_default ();
#line 227 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp10_ = _g_main_context_ref0 (_tmp9_);
#line 227 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	context = _tmp10_;
#line 228 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	while (TRUE) {
#line 446 "test-case.c"
		GMainContext* _tmp11_ = NULL;
		gboolean _tmp12_ = FALSE;
#line 228 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp11_ = context;
#line 228 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		_tmp12_ = g_main_context_iteration (_tmp11_, FALSE);
#line 228 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		if (!_tmp12_) {
#line 228 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
			break;
#line 457 "test-case.c"
		}
	}
#line 230 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	FOLKS_TEST_CASE_CLASS (tpf_test_test_case_parent_class)->tear_down (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 201 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_g_main_context_unref0 (context);
#line 464 "test-case.c"
}


gboolean tpf_test_test_case_get_use_keyfile_too (TpfTestTestCase* self) {
#line 77 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 77 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return TPF_TEST_TEST_CASE_GET_CLASS (self)->get_use_keyfile_too (self);
#line 473 "test-case.c"
}


static gboolean tpf_test_test_case_real_get_use_keyfile_too (TpfTestTestCase* base) {
	gboolean result;
	TpfTestTestCase* self;
#line 77 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = base;
#line 79 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	result = FALSE;
#line 79 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return result;
#line 486 "test-case.c"
}


static gboolean tpf_test_test_case_real_get_uses_dbus_1 (FolksTestCase* base) {
	gboolean result;
	TpfTestTestCase* self;
#line 115 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestTestCase*) base;
#line 117 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	result = TRUE;
#line 117 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return result;
#line 499 "test-case.c"
}


static void tpf_test_test_case_class_init (TpfTestTestCaseClass * klass) {
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_test_case_parent_class = g_type_class_peek_parent (klass);
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((TpfTestTestCaseClass *) klass)->create_kf_backend = tpf_test_test_case_real_create_kf_backend;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((TpfTestTestCaseClass *) klass)->create_tp_backend = tpf_test_test_case_real_create_tp_backend;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((FolksTestCaseClass *) klass)->set_up = tpf_test_test_case_real_set_up;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((TpfTestTestCaseClass *) klass)->set_up_tp = tpf_test_test_case_real_set_up_tp;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((TpfTestTestCaseClass *) klass)->set_up_kf = tpf_test_test_case_real_set_up_kf;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	((FolksTestCaseClass *) klass)->tear_down = tpf_test_test_case_real_tear_down;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_CLASS (klass)->get_use_keyfile_too = tpf_test_test_case_real_get_use_keyfile_too;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	FOLKS_TEST_CASE_CLASS (klass)->get_uses_dbus_1 = tpf_test_test_case_real_get_uses_dbus_1;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_tpf_test_test_case_get_property;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	G_OBJECT_CLASS (klass)->finalize = tpf_test_test_case_finalize;
#line 526 "test-case.c"
	/**
	   * 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.
	   */
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), TPF_TEST_TEST_CASE_USE_KEYFILE_TOO, g_param_spec_boolean ("use-keyfile-too", "use-keyfile-too", "use-keyfile-too", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 537 "test-case.c"
	/**
	   * This test does use libdbus, via telepathy-glib.
	   */
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), TPF_TEST_TEST_CASE_USES_DBUS_1, g_param_spec_boolean ("uses-dbus-1", "uses-dbus-1", "uses-dbus-1", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 543 "test-case.c"
}


static void tpf_test_test_case_instance_init (TpfTestTestCase * self) {
#line 47 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self->kf_backend = NULL;
#line 56 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self->tp_backend = NULL;
#line 65 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self->account_handle = NULL;
#line 554 "test-case.c"
}


static void tpf_test_test_case_finalize (GObject* obj) {
	TpfTestTestCase * self;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TPF_TEST_TYPE_TEST_CASE, TpfTestTestCase);
#line 47 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_kf_test_backend_unref0 (self->kf_backend);
#line 56 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_g_object_unref0 (self->tp_backend);
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	G_OBJECT_CLASS (tpf_test_test_case_parent_class)->finalize (obj);
#line 568 "test-case.c"
}


/**
 * 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.
 */
GType tpf_test_test_case_get_type (void) {
	static volatile gsize tpf_test_test_case_type_id__volatile = 0;
	if (g_once_init_enter (&tpf_test_test_case_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TpfTestTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tpf_test_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TpfTestTestCase), 0, (GInstanceInitFunc) tpf_test_test_case_instance_init, NULL };
		GType tpf_test_test_case_type_id;
		tpf_test_test_case_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "TpfTestTestCase", &g_define_type_info, 0);
		g_once_init_leave (&tpf_test_test_case_type_id__volatile, tpf_test_test_case_type_id);
	}
	return tpf_test_test_case_type_id__volatile;
}


static void _vala_tpf_test_test_case_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TpfTestTestCase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TPF_TEST_TYPE_TEST_CASE, TpfTestTestCase);
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	switch (property_id) {
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		case TPF_TEST_TEST_CASE_USE_KEYFILE_TOO:
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_value_set_boolean (value, tpf_test_test_case_get_use_keyfile_too (self));
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		break;
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		case TPF_TEST_TEST_CASE_USES_DBUS_1:
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_value_set_boolean (value, folks_test_case_get_uses_dbus_1 ((FolksTestCase*) self));
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		break;
#line 609 "test-case.c"
		default:
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 33 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		break;
#line 615 "test-case.c"
	}
}


TpfTestMixedTestCase* tpf_test_mixed_test_case_construct (GType object_type, const gchar* name) {
	TpfTestMixedTestCase * self = NULL;
	const gchar* _tmp0_ = NULL;
#line 252 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 254 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	_tmp0_ = name;
#line 254 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestMixedTestCase*) tpf_test_test_case_construct (object_type, _tmp0_);
#line 252 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return self;
#line 631 "test-case.c"
}


TpfTestMixedTestCase* tpf_test_mixed_test_case_new (const gchar* name) {
#line 252 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return tpf_test_mixed_test_case_construct (TPF_TEST_TYPE_MIXED_TEST_CASE, name);
#line 638 "test-case.c"
}


static gboolean tpf_test_mixed_test_case_real_get_use_keyfile_too (TpfTestTestCase* base) {
	gboolean result;
	TpfTestMixedTestCase* self;
#line 246 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	self = (TpfTestMixedTestCase*) base;
#line 248 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	result = TRUE;
#line 248 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	return result;
#line 651 "test-case.c"
}


static void tpf_test_mixed_test_case_class_init (TpfTestMixedTestCaseClass * klass) {
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	tpf_test_mixed_test_case_parent_class = g_type_class_peek_parent (klass);
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	TPF_TEST_TEST_CASE_CLASS (klass)->get_use_keyfile_too = tpf_test_mixed_test_case_real_get_use_keyfile_too;
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_tpf_test_mixed_test_case_get_property;
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), TPF_TEST_MIXED_TEST_CASE_USE_KEYFILE_TOO, g_param_spec_boolean ("use-keyfile-too", "use-keyfile-too", "use-keyfile-too", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 664 "test-case.c"
}


static void tpf_test_mixed_test_case_instance_init (TpfTestMixedTestCase * self) {
}


/**
 * 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.
 */
GType tpf_test_mixed_test_case_get_type (void) {
	static volatile gsize tpf_test_mixed_test_case_type_id__volatile = 0;
	if (g_once_init_enter (&tpf_test_mixed_test_case_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TpfTestMixedTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tpf_test_mixed_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TpfTestMixedTestCase), 0, (GInstanceInitFunc) tpf_test_mixed_test_case_instance_init, NULL };
		GType tpf_test_mixed_test_case_type_id;
		tpf_test_mixed_test_case_type_id = g_type_register_static (TPF_TEST_TYPE_TEST_CASE, "TpfTestMixedTestCase", &g_define_type_info, 0);
		g_once_init_leave (&tpf_test_mixed_test_case_type_id__volatile, tpf_test_mixed_test_case_type_id);
	}
	return tpf_test_mixed_test_case_type_id__volatile;
}


static void _vala_tpf_test_mixed_test_case_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TpfTestMixedTestCase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TPF_TEST_TYPE_MIXED_TEST_CASE, TpfTestMixedTestCase);
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
	switch (property_id) {
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		case TPF_TEST_MIXED_TEST_CASE_USE_KEYFILE_TOO:
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		g_value_set_boolean (value, tpf_test_test_case_get_use_keyfile_too ((TpfTestTestCase*) self));
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		break;
#line 703 "test-case.c"
		default:
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 242 "/opt/gnome3/source/folks/tests/lib/telepathy/test-case.vala"
		break;
#line 709 "test-case.c"
	}
}



