1 /*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation.
5 * Copyright (C) 2012-2016 Canonical Ltd.
6 *
7 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23 #include "testauthserviceresult.h"
24
25 #include <QDebug>
26
27
28 #define SIGNOND_TEST_REPLY_RECEIVED qDebug() << "Reply from SIGNON DAEMON---------------------------------" << __FUNCTION__;
29
TestAuthServiceResult()30 TestAuthServiceResult::TestAuthServiceResult()
31 {
32 reset();
33 }
34
reset()35 void TestAuthServiceResult::reset()
36 {
37 m_responseReceived = InexistentResp;
38 m_error = Error::Unknown;
39 m_errMsg = QString();
40
41 m_identities.clear();
42 m_methods.clear();
43 m_mechanisms.first = QString();
44 m_mechanisms.second.clear();
45 m_cleared = false;
46 }
47
error(const SignOn::Error & error)48 void TestAuthServiceResult::error(const SignOn::Error &error)
49 {
50 SIGNOND_TEST_REPLY_RECEIVED
51 m_responseReceived = ErrorResp;
52 m_error = (Error::ErrorType)error.type();
53 m_errMsg = error.message();
54
55 qDebug() << "Error:" << m_error << ", Message:" << m_errMsg;
56
57 emit testCompleted();
58 }
59
methodsAvailable(const QStringList & methods)60 void TestAuthServiceResult::methodsAvailable(const QStringList &methods)
61 {
62 SIGNOND_TEST_REPLY_RECEIVED
63 m_responseReceived = NormalResp;
64 m_methods = methods;
65
66 emit testCompleted();
67 }
68
mechanismsAvailable(const QString & method,const QStringList & mechanisms)69 void TestAuthServiceResult::mechanismsAvailable(const QString &method,
70 const QStringList &mechanisms)
71 {
72 SIGNOND_TEST_REPLY_RECEIVED
73 m_responseReceived = NormalResp;
74 m_mechanisms.first = method;
75 m_mechanisms.second = mechanisms;
76 m_queriedMechsMethod = method;
77
78 emit testCompleted();
79 }
80
identities(const QList<SignOn::IdentityInfo> & identityList)81 void TestAuthServiceResult::identities(
82 const QList<SignOn::IdentityInfo> &identityList)
83 {
84 SIGNOND_TEST_REPLY_RECEIVED
85 m_responseReceived = NormalResp;
86 m_identities = identityList;
87
88 emit testCompleted();
89 }
90
cleared()91 void TestAuthServiceResult::cleared()
92 {
93 SIGNOND_TEST_REPLY_RECEIVED
94 m_responseReceived = NormalResp;
95 m_cleared = true;
96
97 emit testCompleted();
98 }
99