~tiagosh/telephony-service/remove_ofono_dependency

« back to all changes in this revision

Viewing changes to tests/common/NotificationsMock.cpp

  • Committer: Gustavo Pichorim Boiko
  • Date: 2015-07-02 03:35:20 UTC
  • mto: (1093.2.3 telephony-service)
  • mto: This revision was merged to the branch mainline in revision 1099.
  • Revision ID: gustavo.boiko@canonical.com-20150702033520-3yj3o7ik60wal2nh
Fix the approver tests and add a test to make sure the snap decision timeout is set to -1

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    Q_CLASSINFO("D-Bus Interface", NOTIFICATIONS_DBUS_SERVICE_NAME)
33
33
 
34
34
public:
35
 
    Q_SCRIPTABLE void Notify(QString app_name, uint replaces_id, QString app_icon, QString summary, QString body, QStringList actions, QVariantMap hints, int expire_timeout);
 
35
    Q_SCRIPTABLE uint Notify(QString app_name, uint replaces_id, QString app_icon, QString summary, QString body, QStringList actions, QVariantMap hints, int expire_timeout);
36
36
    Q_SCRIPTABLE void CloseNotification(uint id);
 
37
    Q_SCRIPTABLE QString GetServerInformation(QString& vendor, QString& version, QString& spec_version);
37
38
 
38
39
    // Mock specific method
39
40
    Q_SCRIPTABLE void MockInvokeAction(uint id, QString action_key);
46
47
    Q_SCRIPTABLE void MockNotificationReceived(QString app_name, uint replaces_id, QString app_icon, QString summary, QString body, QStringList actions, QVariantMap hints, int expire_timeout);
47
48
};
48
49
 
49
 
void NotificationsMock::Notify(QString app_name, uint replaces_id, QString app_icon, QString summary, QString body, QStringList actions, QVariantMap hints, int expire_timeout)
 
50
uint NotificationsMock::Notify(QString app_name, uint replaces_id, QString app_icon, QString summary, QString body, QStringList actions, QVariantMap hints, int expire_timeout)
50
51
{
51
52
    Q_EMIT MockNotificationReceived(app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout);
 
53
    static uint id = 1;
 
54
    return (replaces_id != 0 ? replaces_id : id++);
52
55
}
53
56
 
54
57
void NotificationsMock::MockInvokeAction(uint id, QString action_key)
62
65
    Q_EMIT NotificationClosed(id, 3); // 3 is closed by a CloseNotification() call
63
66
}
64
67
 
 
68
QString NotificationsMock::GetServerInformation(QString &vendor, QString &version, QString &spec_version)
 
69
{
 
70
    return QString();
 
71
}
 
72
 
65
73
int main(int argc, char **argv)
66
74
{
67
75
    QCoreApplication a(argc, argv);