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

« back to all changes in this revision

Viewing changes to tests/backend-dbus/mock-consolekit-session.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_SESSION_H
 
21
#define MOCK_CONSOLEKIT_SESSION_H
 
22
 
 
23
#include <string>
 
24
#include "mock-object.h"
 
25
#include "backend-dbus/dbus-consolekit-session.h"
 
26
 
 
27
class MockUser;
 
28
 
 
29
class MockConsoleKitSession: public MockObject
 
30
{
 
31
  public:
 
32
 
 
33
    MockConsoleKitSession (GMainLoop       * loop,
 
34
                           GDBusConnection * bus_connection);
 
35
    virtual ~MockConsoleKitSession ();
 
36
 
 
37
    MockUser * user () { return my_user; }
 
38
    void set_user (MockUser * user);
 
39
    const char * ssid () { return path(); }
 
40
    void set_sid (const std::string& sid) { my_sid = sid; }
 
41
    const char * x11_display() { return my_x11_display.c_str(); }
 
42
    void set_x11_display (const std::string& x) { my_x11_display = x; }
 
43
 
 
44
  private:
 
45
 
 
46
    static gboolean on_get_seat_id_static (ConsoleKitSession *,
 
47
                                           GDBusMethodInvocation *,
 
48
                                           gpointer);
 
49
    static gboolean on_get_unix_user_static (ConsoleKitSession *,
 
50
                                             GDBusMethodInvocation *,
 
51
                                             gpointer);
 
52
    static gboolean on_get_x11_display (ConsoleKitSession *,
 
53
                                        GDBusMethodInvocation *, 
 
54
                                        gpointer);
 
55
 
 
56
 
 
57
  private:
 
58
 
 
59
    ConsoleKitSession * my_skeleton;
 
60
    std::string my_sid;
 
61
    std::string my_x11_display;
 
62
    MockUser * my_user;
 
63
};
 
64
 
 
65
#endif // #ifndef MOCK_CONSOLEKIT_SESSION_H