diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-06-25 11:39:46 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-06-25 11:39:46 -0500 |
commit | d16aaaed46f3381ea7ac4cb4c2cb491d4c5d2e03 (patch) | |
tree | b970bd51afd67a77ab5de3780204b8528876e7ab | |
parent | b3938a1f14b687d62ad1d6e4e27bac47f58722de (diff) | |
download | ayatana-indicator-session-d16aaaed46f3381ea7ac4cb4c2cb491d4c5d2e03.tar.gz ayatana-indicator-session-d16aaaed46f3381ea7ac4cb4c2cb491d4c5d2e03.tar.bz2 ayatana-indicator-session-d16aaaed46f3381ea7ac4cb4c2cb491d4c5d2e03.zip |
all the tests in test-users pass
-rw-r--r-- | src/backend-dbus/users.c | 14 | ||||
-rw-r--r-- | tests/backend-dbus/test-users.cc | 20 |
2 files changed, 15 insertions, 19 deletions
diff --git a/src/backend-dbus/users.c b/src/backend-dbus/users.c index 48de06c..1ecadf3 100644 --- a/src/backend-dbus/users.c +++ b/src/backend-dbus/users.c @@ -93,8 +93,6 @@ set_active_uid (IndicatorSessionUsersDbus * self, guint uid) { priv_t * p = self->priv; - g_message ("%s %s setting active uid to %u", G_STRLOC, G_STRFUNC, uid); - if (p->active_uid != uid) { const guint old_uid = p->active_uid; @@ -393,8 +391,6 @@ on_login1_manager_session_list_ready (GObject * o, GHashTable * logins = g_hash_table_new (g_direct_hash, g_direct_equal); GVariantIter iter; - g_message ("%s %s %s", G_STRLOC, G_STRFUNC, g_variant_print (sessions, TRUE)); - g_variant_iter_init (&iter, sessions); while (g_variant_iter_loop (&iter, "(&su&s&s&o)", &session_id, &uid, @@ -406,11 +402,13 @@ on_login1_manager_session_list_ready (GObject * o, if (g_strcmp0 (seat_id, current_seat_id)) continue; - if ((uid==999) && !g_strcmp0 (user_name,"ubuntu")) - is_live_session = TRUE; - if (!g_strcmp0 (session_id, current_session_id)) - set_active_uid (self, uid); + { + set_active_uid (self, uid); + + if ((uid==999) && !g_strcmp0 (user_name,"ubuntu")) + is_live_session = TRUE; + } /* only count user accounts and the live session */ if (uid >= 999) diff --git a/tests/backend-dbus/test-users.cc b/tests/backend-dbus/test-users.cc index 279796e..b022984 100644 --- a/tests/backend-dbus/test-users.cc +++ b/tests/backend-dbus/test-users.cc @@ -328,26 +328,25 @@ TEST_F (Users, ActivateUser) compare_user (msmith, event_keys[1], "active"); } -#if 0 /** * Confirm that adding a Guest doesn't show up in the users list */ TEST_F (Users, UnwantedGuest) { - GStrv keys; + GList * uids; - keys = indicator_session_users_get_keys (users); - const size_t n = g_strv_length (keys); - g_strfreev (keys); + uids = indicator_session_users_get_uids (users); + const size_t n = g_list_length (uids); + g_list_free (uids); MockUser * mu = new MockUser (loop, conn, "guest-jjbEVV", "Guest", 1); mu->set_system_account (true); accounts->add_user (mu); wait_msec (50); - keys = indicator_session_users_get_keys (users); - ASSERT_EQ (n, g_strv_length (keys)); - g_strfreev (keys); + uids = indicator_session_users_get_uids (users); + ASSERT_EQ (n, g_list_length (uids)); + g_list_free (uids); } @@ -367,9 +366,9 @@ TEST_F (Users, LiveSession) MockUser * live_user = new MockUser (loop, conn, "ubuntu", "Ubuntu", 1, 999); live_user->set_system_account (true); accounts->add_user (live_user); - MockConsoleKitSession * session = ck_seat->add_session_by_user (live_user); + const int session_tag = login1_manager->add_session (login1_seat, live_user); wait_msec (100); - ck_seat->activate_session (session); + login1_seat->activate_session (session_tag); wait_for_signal (users, "notify::" INDICATOR_SESSION_USERS_PROP_IS_LIVE_SESSION); // confirm the backend thinks it's a live session @@ -377,4 +376,3 @@ TEST_F (Users, LiveSession) g_object_get (users, INDICATOR_SESSION_USERS_PROP_IS_LIVE_SESSION, &b, NULL); ASSERT_TRUE (b); } -#endif |