| 1 | /* |
| 2 | * This file is part of libOnlineAccounts |
| 3 | * |
| 4 | * Copyright (C) 2015 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU Lesser General Public License version 3, as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef OAD_FAKE_SIGNOND_H |
| 22 | #define OAD_FAKE_SIGNOND_H |
| 23 | |
| 24 | #include <QVariantMap> |
| 25 | #include <libqtdbusmock/DBusMock.h> |
| 26 | |
| 27 | class FakeSignond |
| 28 | { |
| 29 | public: |
| 30 | FakeSignond(QtDBusMock::DBusMock *mock): m_mock(mock) { |
| 31 | m_mock->registerTemplate("com.google.code.AccountsSSO.SingleSignOn", |
| 32 | SIGNOND_MOCK_TEMPLATE, |
| 33 | QDBusConnection::SessionBus); |
| 34 | } |
| 35 | |
| 36 | void addIdentity(uint id, const QVariantMap &info) { |
| 37 | mockedAuthService().call("AddIdentity", id, info); |
| 38 | } |
| 39 | |
| 40 | private: |
| 41 | OrgFreedesktopDBusMockInterface &mockedAuthService() { |
| 42 | return m_mock->mockInterface("com.google.code.AccountsSSO.SingleSignOn", |
| 43 | "/com/google/code/AccountsSSO/SingleSignOn", |
| 44 | "com.google.code.AccountsSSO.SingleSignOn.AuthService", |
| 45 | QDBusConnection::SessionBus); |
| 46 | } |
| 47 | |
| 48 | private: |
| 49 | QtDBusMock::DBusMock *m_mock; |
| 50 | }; |
| 51 | |
| 52 | #endif // OAD_FAKE_SIGNOND_H |