/* test-case.c generated by valac 0.28.0.16-b1323, the Vala compiler
 * generated from test-case.vala, do not modify */

/* test-case.vala
 *
 * 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
 *
 * Author:
 *      Simon McVittie <simon.mcvittie@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks-test.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include <glib/gstdio.h>


#define TRACKER_TEST_TYPE_TEST_CASE (tracker_test_test_case_get_type ())
#define TRACKER_TEST_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TEST_TYPE_TEST_CASE, TrackerTestTestCase))
#define TRACKER_TEST_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TEST_TYPE_TEST_CASE, TrackerTestTestCaseClass))
#define TRACKER_TEST_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TEST_TYPE_TEST_CASE))
#define TRACKER_TEST_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TEST_TYPE_TEST_CASE))
#define TRACKER_TEST_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TEST_TYPE_TEST_CASE, TrackerTestTestCaseClass))

typedef struct _TrackerTestTestCase TrackerTestTestCase;
typedef struct _TrackerTestTestCaseClass TrackerTestTestCaseClass;
typedef struct _TrackerTestTestCasePrivate TrackerTestTestCasePrivate;

#define TRACKER_TEST_TYPE_BACKEND (tracker_test_backend_get_type ())
#define TRACKER_TEST_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TEST_TYPE_BACKEND, TrackerTestBackend))
#define TRACKER_TEST_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TEST_TYPE_BACKEND, TrackerTestBackendClass))
#define TRACKER_TEST_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TEST_TYPE_BACKEND))
#define TRACKER_TEST_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TEST_TYPE_BACKEND))
#define TRACKER_TEST_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TEST_TYPE_BACKEND, TrackerTestBackendClass))

typedef struct _TrackerTestBackend TrackerTestBackend;
typedef struct _TrackerTestBackendClass TrackerTestBackendClass;
#define _tracker_test_backend_unref0(var) ((var == NULL) ? NULL : (var = (tracker_test_backend_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_main_context_unref0(var) ((var == NULL) ? NULL : (var = (g_main_context_unref (var), NULL)))

struct _TrackerTestTestCase {
	FolksTestCase parent_instance;
	TrackerTestTestCasePrivate * priv;
	TrackerTestBackend* tracker_backend;
};

struct _TrackerTestTestCaseClass {
	FolksTestCaseClass parent_class;
	void (*create_backend) (TrackerTestTestCase* self);
};


static gpointer tracker_test_test_case_parent_class = NULL;

GType tracker_test_test_case_get_type (void) G_GNUC_CONST;
gpointer tracker_test_backend_ref (gpointer instance);
void tracker_test_backend_unref (gpointer instance);
GParamSpec* tracker_test_param_spec_backend (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void tracker_test_value_set_backend (GValue* value, gpointer v_object);
void tracker_test_value_take_backend (GValue* value, gpointer v_object);
gpointer tracker_test_value_get_backend (const GValue* value);
GType tracker_test_backend_get_type (void) G_GNUC_CONST;
enum  {
	TRACKER_TEST_TEST_CASE_DUMMY_PROPERTY
};
TrackerTestTestCase* tracker_test_test_case_new (const gchar* name);
TrackerTestTestCase* tracker_test_test_case_construct (GType object_type, const gchar* name);
static gchar* _tracker_test_test_case_get_tracker_libexecdir (TrackerTestTestCase* self);
static void tracker_test_test_case_real_private_bus_up (FolksTestCase* base);
static void tracker_test_test_case_real_set_up (FolksTestCase* base);
void tracker_test_test_case_create_backend (TrackerTestTestCase* self);
static void tracker_test_test_case_real_create_backend (TrackerTestTestCase* self);
TrackerTestBackend* tracker_test_backend_new (void);
TrackerTestBackend* tracker_test_backend_construct (GType object_type);
void tracker_test_backend_set_up (TrackerTestBackend* self);
static void tracker_test_test_case_real_tear_down (FolksTestCase* base);
void tracker_test_backend_tear_down (TrackerTestBackend* self);
static void tracker_test_test_case_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


/**
   * 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.)
   */
TrackerTestTestCase* tracker_test_test_case_construct (GType object_type, const gchar* name) {
	TrackerTestTestCase * self = NULL;
	const gchar* _tmp0_ = NULL;
#line 48 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 50 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp0_ = name;
#line 50 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self = (TrackerTestTestCase*) folks_test_case_construct (object_type, _tmp0_);
#line 52 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	g_setenv ("FOLKS_BACKENDS_ALLOWED", "tracker", TRUE);
#line 53 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	g_setenv ("FOLKS_PRIMARY_STORE", "tracker", TRUE);
#line 48 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	return self;
#line 124 "test-case.c"
}


TrackerTestTestCase* tracker_test_test_case_new (const gchar* name) {
#line 48 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	return tracker_test_test_case_construct (TRACKER_TEST_TYPE_TEST_CASE, name);
#line 131 "test-case.c"
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
#line 1115 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1116 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	_tmp0_ = g_strdup (self);
#line 1116 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1117 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	_tmp1_ = _result_;
#line 1117 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	g_strstrip (_tmp1_);
#line 1118 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	result = _result_;
#line 1118 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	return result;
#line 154 "test-case.c"
}


static gchar* _tracker_test_test_case_get_tracker_libexecdir (TrackerTestTestCase* self) {
	gchar* result = NULL;
	gchar* env = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_ = NULL;
	gint exit_status = 0;
	gchar* capture_stdout = NULL;
	const gchar* _tmp14_ = NULL;
	gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	gchar* _tmp18_ = NULL;
	GError * _inner_error_ = NULL;
#line 56 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 60 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp0_ = g_getenv ("FOLKS_TEST_TRACKER_LIBEXECDIR");
#line 60 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp1_ = g_strdup (_tmp0_);
#line 60 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	env = _tmp1_;
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp3_ = env;
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	if (_tmp3_ != NULL) {
#line 185 "test-case.c"
		const gchar* _tmp4_ = NULL;
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp4_ = env;
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp2_ = g_strcmp0 (_tmp4_, "") != 0;
#line 191 "test-case.c"
	} else {
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp2_ = FALSE;
#line 195 "test-case.c"
	}
#line 62 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	if (_tmp2_) {
#line 64 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		result = env;
#line 64 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		return result;
#line 203 "test-case.c"
	}
#line 68 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	exit_status = -1;
#line 69 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	capture_stdout = NULL;
#line 209 "test-case.c"
	{
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		gchar** _tmp8_ = NULL;
		gchar** _tmp9_ = NULL;
		gint _tmp9__length1 = 0;
		gchar* _tmp10_ = NULL;
		gint _tmp11_ = 0;
		gint _tmp12_ = 0;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp5_ = g_strdup ("pkg-config");
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp6_ = g_strdup ("--variable=prefix");
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp7_ = g_strdup_printf ("tracker-miner-%s", TRACKER_SPARQL_MAJOR);
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp8_ = g_new0 (gchar*, 3 + 1);
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp8_[0] = _tmp5_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp8_[1] = _tmp6_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp8_[2] = _tmp7_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp9_ = _tmp8_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp9__length1 = 3;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_spawn_sync (NULL, _tmp9_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &_tmp10_, NULL, &_tmp11_, &_inner_error_);
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (capture_stdout);
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		capture_stdout = _tmp10_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		exit_status = _tmp11_;
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
#line 73 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 250 "test-case.c"
			goto __catch4_g_error;
		}
#line 83 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp12_ = exit_status;
#line 83 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_spawn_check_exit_status (_tmp12_, &_inner_error_);
#line 83 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 259 "test-case.c"
			goto __catch4_g_error;
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* e1 = NULL;
		const gchar* _tmp13_ = NULL;
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		e1 = _inner_error_;
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_inner_error_ = NULL;
#line 87 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp13_ = e1->message;
#line 87 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_error ("test-case.vala:87: Error getting libexecdir from pkg-config: %s", _tmp13_);
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_error_free0 (e1);
#line 278 "test-case.c"
	}
	__finally4:
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (capture_stdout);
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (env);
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_clear_error (&_inner_error_);
#line 71 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		return NULL;
#line 293 "test-case.c"
	}
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp14_ = capture_stdout;
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp15_ = string_strip (_tmp14_);
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp16_ = _tmp15_;
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp17_ = g_strconcat (_tmp16_, "/libexec", NULL);
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp18_ = _tmp17_;
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (_tmp16_);
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	result = _tmp18_;
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (capture_stdout);
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (env);
#line 92 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	return result;
#line 315 "test-case.c"
}


static void tracker_test_test_case_real_private_bus_up (FolksTestCase* base) {
	TrackerTestTestCase * self;
	gchar* libexec = NULL;
	gchar* _tmp0_ = NULL;
	gchar* service_file_name = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* service_file = NULL;
	gchar* _tmp4_ = NULL;
	GError * _inner_error_ = NULL;
#line 95 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self = (TrackerTestTestCase*) base;
#line 97 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	FOLKS_TEST_CASE_CLASS (tracker_test_test_case_parent_class)->private_bus_up (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 100 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp0_ = _tracker_test_test_case_get_tracker_libexecdir (self);
#line 100 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	libexec = _tmp0_;
#line 103 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp1_ = folks_test_case_get_transient_dir ((FolksTestCase*) self);
#line 103 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp2_ = _tmp1_;
#line 103 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp3_ = g_build_filename (_tmp2_, "dbus-1", "services", "org.freedesktop.Tracker1.service", NULL);
#line 103 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	service_file_name = _tmp3_;
#line 106 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp4_ = g_strdup_printf ("[D-BUS Service]\n" "Name=org.freedesktop.Tracker1\n" "Exec=%s/tracker-store\n", libexec);
#line 106 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	service_file = _tmp4_;
#line 350 "test-case.c"
	{
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_file_set_contents (service_file_name, service_file, (gssize) (-1), &_inner_error_);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			if (_inner_error_->domain == G_FILE_ERROR) {
#line 358 "test-case.c"
				goto __catch5_g_file_error;
			}
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			_g_free0 (service_file);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			_g_free0 (service_file_name);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			_g_free0 (libexec);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			g_clear_error (&_inner_error_);
#line 112 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			return;
#line 373 "test-case.c"
		}
	}
	goto __finally5;
	__catch5_g_file_error:
	{
		GError* e2 = NULL;
		const gchar* _tmp5_ = NULL;
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		e2 = _inner_error_;
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_inner_error_ = NULL;
#line 116 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp5_ = e2->message;
#line 116 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_error ("test-case.vala:116: Error creating D-Bus service file ‘%s’: %s", service_file_name, _tmp5_);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_error_free0 (e2);
#line 391 "test-case.c"
	}
	__finally5:
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (service_file);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (service_file_name);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_g_free0 (libexec);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		g_clear_error (&_inner_error_);
#line 110 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		return;
#line 408 "test-case.c"
	}
#line 95 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (service_file);
#line 95 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (service_file_name);
#line 95 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_free0 (libexec);
#line 416 "test-case.c"
}


static void tracker_test_test_case_real_set_up (FolksTestCase* base) {
	TrackerTestTestCase * self;
#line 121 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self = (TrackerTestTestCase*) base;
#line 123 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	FOLKS_TEST_CASE_CLASS (tracker_test_test_case_parent_class)->set_up (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 124 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	tracker_test_test_case_create_backend (self);
#line 428 "test-case.c"
}


/**
   * 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.
   */
static void tracker_test_test_case_real_create_backend (TrackerTestTestCase* self) {
	TrackerTestBackend* _tmp0_ = NULL;
	TrackerTestBackend* _tmp1_ = NULL;
#line 136 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp0_ = tracker_test_backend_new ();
#line 136 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tracker_test_backend_unref0 (self->tracker_backend);
#line 136 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self->tracker_backend = _tmp0_;
#line 137 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp1_ = self->tracker_backend;
#line 137 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	tracker_test_backend_set_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TRACKER_TEST_TYPE_BACKEND, TrackerTestBackend));
#line 452 "test-case.c"
}


void tracker_test_test_case_create_backend (TrackerTestTestCase* self) {
#line 134 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	g_return_if_fail (self != NULL);
#line 134 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	TRACKER_TEST_TEST_CASE_GET_CLASS (self)->create_backend (self);
#line 461 "test-case.c"
}


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


static void tracker_test_test_case_real_tear_down (FolksTestCase* base) {
	TrackerTestTestCase * self;
	TrackerTestBackend* _tmp0_ = NULL;
	GMainContext* context = NULL;
	GMainContext* _tmp2_ = NULL;
	GMainContext* _tmp3_ = NULL;
#line 140 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self = (TrackerTestTestCase*) base;
#line 142 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp0_ = self->tracker_backend;
#line 142 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	if (_tmp0_ != NULL) {
#line 484 "test-case.c"
		TrackerTestBackend* _tmp1_ = NULL;
#line 144 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp1_ = self->tracker_backend;
#line 144 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		tracker_test_backend_tear_down (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TRACKER_TEST_TYPE_BACKEND, TrackerTestBackend));
#line 490 "test-case.c"
	}
#line 153 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp2_ = g_main_context_default ();
#line 153 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tmp3_ = _g_main_context_ref0 (_tmp2_);
#line 153 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	context = _tmp3_;
#line 154 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	while (TRUE) {
#line 500 "test-case.c"
		GMainContext* _tmp4_ = NULL;
		gboolean _tmp5_ = FALSE;
#line 154 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp4_ = context;
#line 154 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		_tmp5_ = g_main_context_iteration (_tmp4_, FALSE);
#line 154 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
		if (!_tmp5_) {
#line 154 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
			break;
#line 511 "test-case.c"
		}
	}
#line 156 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	FOLKS_TEST_CASE_CLASS (tracker_test_test_case_parent_class)->tear_down (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_TEST_CASE, FolksTestCase));
#line 140 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_g_main_context_unref0 (context);
#line 518 "test-case.c"
}


static void tracker_test_test_case_class_init (TrackerTestTestCaseClass * klass) {
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	tracker_test_test_case_parent_class = g_type_class_peek_parent (klass);
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	((FolksTestCaseClass *) klass)->private_bus_up = tracker_test_test_case_real_private_bus_up;
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	((FolksTestCaseClass *) klass)->set_up = tracker_test_test_case_real_set_up;
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	((TrackerTestTestCaseClass *) klass)->create_backend = tracker_test_test_case_real_create_backend;
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	((FolksTestCaseClass *) klass)->tear_down = tracker_test_test_case_real_tear_down;
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	G_OBJECT_CLASS (klass)->finalize = tracker_test_test_case_finalize;
#line 535 "test-case.c"
}


static void tracker_test_test_case_instance_init (TrackerTestTestCase * self) {
#line 40 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self->tracker_backend = NULL;
#line 542 "test-case.c"
}


static void tracker_test_test_case_finalize (GObject* obj) {
	TrackerTestTestCase * self;
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRACKER_TEST_TYPE_TEST_CASE, TrackerTestTestCase);
#line 40 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	_tracker_test_backend_unref0 (self->tracker_backend);
#line 32 "/opt/gnome3/source/folks/tests/lib/tracker/test-case.vala"
	G_OBJECT_CLASS (tracker_test_test_case_parent_class)->finalize (obj);
#line 554 "test-case.c"
}


/**
 * A test case for the Tracker backend.
 *
 * Folks is configured to use the Tracker backend as primary store,
 * and no other backends.
 *
 * This uses tracker-control to start and stop Tracker services on a private
 * D-Bus bus.
 */
GType tracker_test_test_case_get_type (void) {
	static volatile gsize tracker_test_test_case_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_test_test_case_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerTestTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_test_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerTestTestCase), 0, (GInstanceInitFunc) tracker_test_test_case_instance_init, NULL };
		GType tracker_test_test_case_type_id;
		tracker_test_test_case_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "TrackerTestTestCase", &g_define_type_info, 0);
		g_once_init_leave (&tracker_test_test_case_type_id__volatile, tracker_test_test_case_type_id);
	}
	return tracker_test_test_case_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



