~larsu/indicator-session/glib-deadlock-workaround

« back to all changes in this revision

Viewing changes to tests/backend-dbus/mock-consolekit-manager.h

  • Committer: Charles Kerr
  • Date: 2013-03-22 21:34:34 UTC
  • mto: (384.2.29 ng)
  • mto: This revision was merged to the branch mainline in revision 399.
  • Revision ID: charles.kerr@canonical.com-20130322213434-a85qbob8bi4fvfx2
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *   Charles Kerr <charles.kerr@canonical.com>
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify it
 
8
 * under the terms of the GNU General Public License version 3, as published
 
9
 * by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
13
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
14
 * PURPOSE.  See the GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along
 
17
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef MOCK_CONSOLEKIT_MANAGER_H
 
21
#define MOCK_CONSOLEKIT_MANAGER_H
 
22
 
 
23
#include <set>
 
24
#include <string>
 
25
#include "mock-object.h"
 
26
#include "backend-dbus/dbus-consolekit-manager.h"
 
27
 
 
28
class MockConsoleKitSession;
 
29
class MockConsoleKitSeat;
 
30
 
 
31
class MockConsoleKitManager: public MockObject
 
32
{
 
33
  public:
 
34
 
 
35
    MockConsoleKitManager (GMainLoop       * loop,
 
36
                           GDBusConnection * bus_connection);
 
37
    virtual ~MockConsoleKitManager ();
 
38
 
 
39
    void add_seat (MockConsoleKitSeat * seat);
 
40
 
 
41
    MockConsoleKitSession * current_session ();
 
42
 
 
43
  public:
 
44
 
 
45
    enum Action { None, Shutdown, Restart };
 
46
 
 
47
    Action last_action () const { return my_last_action; }
 
48
 
 
49
    void clear_last_action () { my_last_action = None; }
 
50
 
 
51
  private:
 
52
 
 
53
    typedef std::set<MockConsoleKitSeat*> seats_t;
 
54
    seats_t my_seats;
 
55
 
 
56
    ConsoleKitManager * my_skeleton;
 
57
 
 
58
    std::string my_current_ssid;
 
59
 
 
60
    Action my_last_action;
 
61
 
 
62
    static gboolean on_get_current_session (ConsoleKitManager *,
 
63
                                            GDBusMethodInvocation *,
 
64
                                            gpointer );
 
65
    static gboolean on_get_seats (ConsoleKitManager *,
 
66
                                  GDBusMethodInvocation *,
 
67
                                  gpointer );
 
68
    static gboolean handle_restart (ConsoleKitManager *,
 
69
                                    GDBusMethodInvocation *,
 
70
                                    gpointer);
 
71
    static gboolean handle_stop (ConsoleKitManager *,
 
72
                                 GDBusMethodInvocation *,
 
73
                                 gpointer);
 
74
 
 
75
};
 
76
 
 
77
#endif // #ifndef MOCK_CONSOLEKIT_MANAGER_H