aboutsummaryrefslogtreecommitdiff
path: root/tests/backend-dbus/mock-consolekit-session.h
blob: 7759f728522bd1f87e007703a0b44498766747fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * 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_CONSOLEKIT_SESSION_H
#define MOCK_CONSOLEKIT_SESSION_H

#include <string>
#include "mock-object.h"
#include "backend-dbus/dbus-consolekit-session.h"

class MockUser;

class MockConsoleKitSession: public MockObject
{
  public:

    MockConsoleKitSession (GMainLoop       * loop,
                           GDBusConnection * bus_connection);
    virtual ~MockConsoleKitSession ();

    MockUser * user () { return my_user; }
    void set_user (MockUser * user);
    const char * ssid () { return path(); }
    void set_sid (const std::string& sid) { my_sid = sid; }
    const char * x11_display() { return my_x11_display.c_str(); }
    void set_x11_display (const std::string& x) { my_x11_display = x; }

  private:

    static gboolean on_get_seat_id_static (ConsoleKitSession *,
                                           GDBusMethodInvocation *,
                                           gpointer);
    static gboolean on_get_unix_user_static (ConsoleKitSession *,
                                             GDBusMethodInvocation *,
                                             gpointer);
    static gboolean on_get_x11_display (ConsoleKitSession *,
                                        GDBusMethodInvocation *, 
                                        gpointer);


  private:

    ConsoleKitSession * my_skeleton;
    std::string my_sid;
    std::string my_x11_display;
    MockUser * my_user;
};

#endif // #ifndef MOCK_CONSOLEKIT_SESSION_H