~phablet-team/telephony-service/qml-start-chat

« back to all changes in this revision

Viewing changes to tests/handler/HandlerTest.cpp

  • Committer: Gustavo Pichorim Boiko
  • Date: 2016-10-29 02:20:13 UTC
  • mfrom: (1228.2.3 fix_tests)
  • Revision ID: gustavo.boiko@canonical.com-20161029022013-a1uxqqq8g93scwsi
Fix tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2013-2015 Canonical, Ltd.
 
2
 * Copyright (C) 2013-2016 Canonical, Ltd.
3
3
 *
4
4
 * This file is part of telephony-service.
5
5
 *
313
313
 
314
314
void HandlerTest::testSendMessageWithAttachments()
315
315
{
 
316
    // just to avoid the account fallback, remove the multimedia account
 
317
    QVERIFY(removeAccount(mMultimediaTpAccount));
 
318
 
316
319
    QString recipient("22222222");
317
320
    QString message("Hello, world!");
318
321
    QSignalSpy messageSentSpy(mOfonoMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap)));
329
332
    QCOMPARE(sentMessage, message);
330
333
    QCOMPARE(messageProperties["Recipients"].value<QStringList>().count(), 1);
331
334
    QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient);
332
 
    
 
335
 
333
336
    QVariantList messageAttachments = qdbus_cast<QVariantList>(messageSentSpy.first()[1]);
334
337
    QVariantMap firstAttachment = qdbus_cast<QVariantMap>(messageAttachments.first());
335
338
    QCOMPARE(firstAttachment["content-type"].toString(), QString("audio/ogg"));
526
529
 
527
530
    messageSentMultimediaSpy.clear();
528
531
    messageSentOfonoSpy.clear();
529
 
 
530
 
    mMultimediaMockController->SetContactPresence(recipient, Tp::ConnectionPresenceTypeUnknown, "offline", "");
531
 
    // We have to make sure the handler already has the new state
532
 
    QTest::qWait(1000);
533
 
    HandlerController::instance()->sendMessage(mOfonoTpAccount->uniqueIdentifier(), QStringList() << recipient, message);
534
 
    TRY_COMPARE(messageSentOfonoSpy.count(), 1);
535
 
    QCOMPARE(messageSentMultimediaSpy.count(), 0);
536
 
 
537
 
    sentMessage = messageSentOfonoSpy.first().first().toString();
538
 
    messageProperties = messageSentOfonoSpy.first().last().value<QVariantMap>();
539
 
    QCOMPARE(sentMessage, message);
540
 
    QCOMPARE(messageProperties["Recipients"].value<QStringList>().count(), 1);
541
 
    QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient);
542
532
}
543
533
 
544
534
void HandlerTest::registerApprover()