@@ -34,9 +34,7 @@
34#include <QDBusMetaType>
34#include <QDBusMetaType>
35#include <QDomDocument>
35#include <QDomDocument>
37−#include <unistd.h>
37+#include <glib.h>
38−#include <sys/types.h>
41// This is a mock, specifically to test the LauncherModel
39// This is a mock, specifically to test the LauncherModel
42class MockApp: public unity::shell::application::ApplicationInfoInterface
40class MockApp: public unity::shell::application::ApplicationInfoInterface
@@ -76,11 +74,6 @@ private:
76 bool m_focused;
74 bool m_focused;
79−QString getUsername () {
80− auto pw = getpwuid(getuid());
84// This is a mock, specifically to test the LauncherModel
77// This is a mock, specifically to test the LauncherModel
85class MockAppManager: public unity::shell::application::ApplicationManagerInterface
78class MockAppManager: public unity::shell::application::ApplicationManagerInterface
@@ -151,7 +144,7 @@ private:
152 QList<QVariantMap> getASConfig() {
145 QList<QVariantMap> getASConfig() {
153 AccountsServiceDBusAdaptor *as = launcherModel->m_asAdapter->m_accounts;
146 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()),
155 "com.canonical.unity.AccountsService",
148 "com.canonical.unity.AccountsService",
156 "LauncherItems");
149 "LauncherItems");
157 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
150 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
@@ -176,7 +169,7 @@ private Q_SLOTS:
176 QStringLiteral("/org/freedesktop/Accounts"),
169 QStringLiteral("/org/freedesktop/Accounts"),
177 QStringLiteral("org.freedesktop.Accounts"));
170 QStringLiteral("org.freedesktop.Accounts"));
178 QDBusReply<bool> addReply = accountsInterface.call(QStringLiteral("AddUser"),
171 QDBusReply<bool> addReply = accountsInterface.call(QStringLiteral("AddUser"),
179− getUsername());
172+ QString::fromUtf8(g_get_user_name()));
180 QVERIFY(addReply.isValid());
173 QVERIFY(addReply.isValid());
181 QCOMPARE(addReply.value(), true);
174 QCOMPARE(addReply.value(), true);
@@ -202,7 +195,7 @@ private Q_SLOTS:
202 QStringLiteral("/org/freedesktop/Accounts"),
195 QStringLiteral("/org/freedesktop/Accounts"),
203 QStringLiteral("org.freedesktop.Accounts"));
196 QStringLiteral("org.freedesktop.Accounts"));
204 QDBusReply<bool> removeReply = accountsInterface.call(QStringLiteral("RemoveUser"),
197 QDBusReply<bool> removeReply = accountsInterface.call(QStringLiteral("RemoveUser"),
205− getUsername());
198+ QString::fromUtf8(g_get_user_name()));
206 QVERIFY(removeReply.isValid());
199 QVERIFY(removeReply.isValid());
207 QCOMPARE(removeReply.value(), true);
200 QCOMPARE(removeReply.value(), true);