diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-06-24 17:13:07 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-06-24 17:13:07 -0500 |
commit | 9cfc9e9da79cabacf1f81e96511d10895992c47d (patch) | |
tree | 8551498d439ff243912c244250aa1cfc88cdc54b /tests/backend-dbus/mock-login1-seat.h | |
parent | 889f876ae7263bde2fb54b69930d1d31cbad8423 (diff) | |
download | ayatana-indicator-session-9cfc9e9da79cabacf1f81e96511d10895992c47d.tar.gz ayatana-indicator-session-9cfc9e9da79cabacf1f81e96511d10895992c47d.tar.bz2 ayatana-indicator-session-9cfc9e9da79cabacf1f81e96511d10895992c47d.zip |
get all the tests in test-actions passing again.
Diffstat (limited to 'tests/backend-dbus/mock-login1-seat.h')
-rw-r--r-- | tests/backend-dbus/mock-login1-seat.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/backend-dbus/mock-login1-seat.h b/tests/backend-dbus/mock-login1-seat.h new file mode 100644 index 0000000..96ff19c --- /dev/null +++ b/tests/backend-dbus/mock-login1-seat.h @@ -0,0 +1,77 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * Authors: + * Charles Kerr <charles.kerr@canonical.com> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MOCK_LOGIN1_SEAT_H +#define MOCK_LOGIN1_SEAT_H + +#include <cstring> /* strrchr */ +#include <map> +#include <set> +#include <string> +#include "backend-dbus/dbus-login1-seat.h" +#include "mock-object.h" + +class MockUser; +class MockLogin1Session; + +class MockLogin1Seat: public MockObject +{ + public: + + typedef int session_tag_t; + + MockLogin1Seat (GMainLoop * loop, + GDBusConnection * bus_connection, + bool can_activate_sessions); + + virtual ~MockLogin1Seat (); + + const char * seat_id() const { return strrchr(path(),'/')+1; } + + session_tag_t add_session (MockUser * user); + void remove_session (session_tag_t session); + std::set<int> sessions () const; + int active_session () const { return my_active_session; } + + bool can_activate_sessions () const { return my_can_multi_session; } + void activate_session (session_tag_t session); + void switch_to_guest (); + void switch_to_user (const char * username); + + //const char * sid() { return path(); } + //MockLogin1Session * find (const char * ssid); + + GVariant * list_sessions (); + + static void get_session_id_and_path_for_tag (int tag, std::string& id, std::string& path); + + private: + void update_sessions_property (); + void update_active_session_property (); + void update_can_multi_session_property (); + + + private: + Login1Seat * my_skeleton; + std::map<session_tag_t,MockUser*> my_sessions; + session_tag_t my_active_session; + bool my_can_multi_session; +}; + +#endif // #ifndef MOCK_LOGIN1_SEAT_H |