@@ -34,9 +34,7 @@
3434#include <QDBusMetaType>
3535#include <QDomDocument>
3636
37−#include <unistd.h>
38−#include <sys/types.h>
39−#include <pwd.h>
37+#include <glib.h>
4038
4139// This is a mock, specifically to test the LauncherModel
4240class MockApp: public unity::shell::application::ApplicationInfoInterface
@@ -76,11 +74,6 @@ private:
7674 bool m_focused;
7775};
7876
79−QString getUsername () {
80− auto pw = getpwuid(getuid());
81− return pw->pw_name;
82−}
83−
8477// This is a mock, specifically to test the LauncherModel
8578class MockAppManager: public unity::shell::application::ApplicationManagerInterface
8679{
@@ -151,7 +144,7 @@ private:
151144
152145 QList<QVariantMap> getASConfig() {
153146 AccountsServiceDBusAdaptor *as = launcherModel->m_asAdapter->m_accounts;
154− QDBusReply<QVariant> reply = as->getUserPropertyAsync(getUsername(),
147+ QDBusReply<QVariant> reply = as->getUserPropertyAsync(QString::fromUtf8(g_get_user_name()),
155148 "com.canonical.unity.AccountsService",
156149 "LauncherItems");
157150 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
@@ -176,7 +169,7 @@ private Q_SLOTS:
176169 QStringLiteral("/org/freedesktop/Accounts"),
177170 QStringLiteral("org.freedesktop.Accounts"));
178171 QDBusReply<bool> addReply = accountsInterface.call(QStringLiteral("AddUser"),
179− getUsername());
172+ QString::fromUtf8(g_get_user_name()));
180173 QVERIFY(addReply.isValid());
181174 QCOMPARE(addReply.value(), true);
182175
@@ -202,7 +195,7 @@ private Q_SLOTS:
202195 QStringLiteral("/org/freedesktop/Accounts"),
203196 QStringLiteral("org.freedesktop.Accounts"));
204197 QDBusReply<bool> removeReply = accountsInterface.call(QStringLiteral("RemoveUser"),
205− getUsername());
198+ QString::fromUtf8(g_get_user_name()));
206199 QVERIFY(removeReply.isValid());
207200 QCOMPARE(removeReply.value(), true);
208201 }