~ubuntu-branches/ubuntu/trusty/indicator-session/trusty-updates

« back to all changes in this revision

Viewing changes to tests/backend-dbus/mock-accounts.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Charles Kerr, Lars Uebernickel, Łukasz 'sil2100' Zemczak, Ubuntu daily release
  • Date: 2013-07-16 02:02:05 UTC
  • mfrom: (1.1.64)
  • Revision ID: package-import@ubuntu.com-20130716020205-84ig434y92hxi2g8
Tags: 12.10.5+13.10.20130716-0ubuntu1
[ Charles Kerr ]
* This is the GMenu, login1 version of indicator-session. This
  resubmission removes the prerequisite branch because the entire diff
  is contained in this ng-login1 branch.

[ Lars Uebernickel ]
* This is the GMenu, login1 version of indicator-session. This
  resubmission removes the prerequisite branch because the entire diff
  is contained in this ng-login1 branch.

[ Łukasz 'sil2100' Zemczak ]
* Add the python build-dep, as gdbus-codegen needs it to work
  properly.

[ Ubuntu daily release ]
* Automatic snapshot from revision 400

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_ACCOUNTS_H
 
21
#define MOCK_ACCOUNTS_H
 
22
 
 
23
#include <set>
 
24
#include <string>
 
25
#include <map>
 
26
#include "mock-object.h"
 
27
#include "backend-dbus/dbus-accounts.h" // struct Accounts
 
28
 
 
29
class MockUser;
 
30
 
 
31
class MockAccounts: public MockObject
 
32
{
 
33
  public:
 
34
 
 
35
    MockAccounts (GMainLoop       * loop,
 
36
                  GDBusConnection * bus_connection);
 
37
    virtual ~MockAccounts ();
 
38
 
 
39
    void add_user (MockUser * user);
 
40
    void remove_user (MockUser * user);
 
41
    size_t size() const { return my_users.size(); }
 
42
    MockUser * find_by_uid (guint64 uid);
 
43
    MockUser * find_by_username (const char * username);
 
44
 
 
45
  private:
 
46
 
 
47
    Accounts * my_skeleton;
 
48
 
 
49
    typedef std::set<MockUser*> users_t;
 
50
    users_t my_users;
 
51
 
 
52
    typedef std::map<guint,MockUser*> uid_to_user_t;
 
53
    uid_to_user_t my_uid_to_user;
 
54
 
 
55
    typedef std::map<std::string,MockUser*> path_to_user_t;
 
56
    path_to_user_t my_path_to_user;
 
57
 
 
58
    typedef std::map<std::string,MockUser*> username_to_user_t;
 
59
    username_to_user_t my_username_to_user;
 
60
 
 
61
  private:
 
62
 
 
63
    static gboolean on_find_user_by_id_static (Accounts *,
 
64
                                               GDBusMethodInvocation *,
 
65
                                               guint64,
 
66
                                               gpointer);
 
67
 
 
68
    static gboolean on_list_cached_users_static (Accounts *,
 
69
                                                 GDBusMethodInvocation *,
 
70
                                                 gpointer);
 
71
};
 
72
 
 
73
#endif // #ifndef MOCK_ACCOUNTS_H