summaryrefslogtreecommitdiff
path: root/test/run-tests.c
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2013-09-26 13:32:58 -0700
committerPhilip Chimento <philip@endlessm.com>2013-09-26 14:32:23 -0700
commita1129813f76b08515522af2be3e93a9994d47dfc (patch)
treeaa817b9b4fd182fe00d5f00415199c04064e5e71 /test/run-tests.c
parenta8d9e4a761edcd714642fc59539430c7f15f23fa (diff)
Run all tests with unique application ID
Running tests with the same application ID causes DBus collisions. Apparently this did not cause problems until now. [endlessm/eos-sdk#303]
Diffstat (limited to 'test/run-tests.c')
-rw-r--r--test/run-tests.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/run-tests.c b/test/run-tests.c
index b73d520..016744d 100644
--- a/test/run-tests.c
+++ b/test/run-tests.c
@@ -1,5 +1,6 @@
/* Copyright 2013 Endless Mobile, Inc. */
+#include <inttypes.h> /* For PRIi64 */
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
@@ -7,12 +8,25 @@
#include "run-tests.h"
+#define APPLICATION_TEST_ID_BASE "com.endlessm.eosapplication.test"
+
+/* App ID based on timestamp so that test applications don't collide */
+gchar *
+generate_unique_app_id (void)
+{
+ return g_strdup_printf ("%s%" PRIi64,
+ APPLICATION_TEST_ID_BASE,
+ g_get_real_time ());
+}
+
/* Test fixture for running a test from an EosApplication's "startup" handler */
void
app_window_test_fixture_setup (AppWindowTestFixture *fixture,
gconstpointer callback)
{
- fixture->app = eos_application_new (TEST_APPLICATION_ID, 0);
+ gchar *app_id = generate_unique_app_id ();
+ fixture->app = eos_application_new (app_id, 0);
+ g_free (app_id);
g_signal_connect(fixture->app, "startup", G_CALLBACK (callback),
NULL);
}