aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-04-11 13:48:49 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-04-11 13:48:49 -0500
commit12758f537f4e7b6e04b94126cbd3cf94b90cf5e7 (patch)
tree50a459025661a99fc72f6d2eef71da06d44138b0
parentc2e6f8bf33ffe3b928f910f46cf175b101fc8ed3 (diff)
downloadayatana-indicator-session-12758f537f4e7b6e04b94126cbd3cf94b90cf5e7.tar.gz
ayatana-indicator-session-12758f537f4e7b6e04b94126cbd3cf94b90cf5e7.tar.bz2
ayatana-indicator-session-12758f537f4e7b6e04b94126cbd3cf94b90cf5e7.zip
in MockUnitySession, add support for handling RequestLogout
-rw-r--r--tests/backend-dbus/mock-unity-session.cc16
-rw-r--r--tests/backend-dbus/mock-unity-session.h4
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/backend-dbus/mock-unity-session.cc b/tests/backend-dbus/mock-unity-session.cc
index c996310..d32e339 100644
--- a/tests/backend-dbus/mock-unity-session.cc
+++ b/tests/backend-dbus/mock-unity-session.cc
@@ -21,7 +21,7 @@
gboolean
-MockUnitySession :: handle_lock (UnitySession * us,
+MockUnitySession :: handle_lock (UnitySession * us,
GDBusMethodInvocation * inv,
gpointer gself)
{
@@ -31,7 +31,7 @@ MockUnitySession :: handle_lock (UnitySession * us,
}
gboolean
-MockUnitySession :: handle_prompt_lock (UnitySession * us,
+MockUnitySession :: handle_prompt_lock (UnitySession * us,
GDBusMethodInvocation * inv,
gpointer gself)
{
@@ -40,6 +40,16 @@ MockUnitySession :: handle_prompt_lock (UnitySession * us,
return true;
}
+gboolean
+MockUnitySession :: handle_request_logout (UnitySession * us,
+ GDBusMethodInvocation * inv,
+ gpointer gself)
+{
+ static_cast<MockUnitySession*>(gself)->my_last_action = RequestLogout;
+ unity_session_complete_request_logout (us, inv);
+ return true;
+}
+
/***
****
***/
@@ -61,6 +71,8 @@ MockUnitySession :: MockUnitySession (GMainLoop * loop,
G_CALLBACK(handle_lock), this);
g_signal_connect (my_skeleton, "handle-prompt-lock",
G_CALLBACK(handle_prompt_lock), this);
+ g_signal_connect (my_skeleton, "handle-request-logout",
+ G_CALLBACK(handle_request_logout), this);
set_skeleton (G_DBUS_INTERFACE_SKELETON(my_skeleton));
}
diff --git a/tests/backend-dbus/mock-unity-session.h b/tests/backend-dbus/mock-unity-session.h
index ded246a..9ca5fe9 100644
--- a/tests/backend-dbus/mock-unity-session.h
+++ b/tests/backend-dbus/mock-unity-session.h
@@ -35,6 +35,7 @@ class MockUnitySession: public MockObject
enum Action { None, Lock, PromptLock, RequestLogout, RequestShutdown, RequestReboot };
Action last_action () { return my_last_action; }
+ void clear_last_action () { my_last_action = None; }
private:
@@ -47,6 +48,9 @@ class MockUnitySession: public MockObject
static gboolean handle_prompt_lock (UnitySession *,
GDBusMethodInvocation *,
gpointer);
+ static gboolean handle_request_logout (UnitySession *,
+ GDBusMethodInvocation *,
+ gpointer);
};