X-Git-Url: http://git.maemo.org/git/?p=qtmeetings;a=blobdiff_plain;f=tests%2FIO%2FCommunication%2FTestCommunication.cpp;h=65fc2a7f83616c95601ad4ed84bef4a56349d7ad;hp=df94925757ab1dcf206181e408e6d85e5d997ba5;hb=5810de08d3a5b5311ba1b4175fba51072aa0e754;hpb=9ee999fe4a7de48abc3b4f950699cd4564d16562 diff --git a/tests/IO/Communication/TestCommunication.cpp b/tests/IO/Communication/TestCommunication.cpp index df94925..65fc2a7 100644 --- a/tests/IO/Communication/TestCommunication.cpp +++ b/tests/IO/Communication/TestCommunication.cpp @@ -21,9 +21,9 @@ void TestCommunication::initTestCase() delete conn; conn = NULL; connect( iComm, - SIGNAL( requestFinished( int, QHttp::Error ) ), + SIGNAL( requestFinished( int, int ) ), this, - SLOT( requestFinished( int, QHttp::Error ) ) + SLOT( requestFinished( int, int ) ) ); } @@ -42,8 +42,7 @@ void TestCommunication::testPublicSignals() QCOMPARE( rp.isValid(), true ); QSignalSpy rs( iComm, SIGNAL(requestStarted( int )) ); QCOMPARE( rs.isValid(), true ); - qRegisterMetaType("QHttp::Error"); - QSignalSpy rf( iComm, SIGNAL(requestFinished( int, QHttp::Error )) ); + QSignalSpy rf( iComm, SIGNAL(requestFinished( int, int )) ); QCOMPARE( rf.isValid(), true ); iRequestId = iComm->request( "", QString("").toAscii() ); @@ -59,7 +58,7 @@ void TestCommunication::testPublicSignals() QCOMPARE( rf.count(), 1 ); args = rf.takeFirst(); QCOMPARE( args.at(0).type(), QVariant::Int ); - QCOMPARE( args.at(1).typeName(), "QHttp::Error" ); + QCOMPARE( args.at(1).type(), QVariant::Int ); //verify readProgress QCOMPARE( rp.count(), 1 ); @@ -79,22 +78,36 @@ void TestCommunication::testRequestAndResponse() } QByteArray content = file.readAll(); - iRequestId = iComm->request( command, content ); + iError = 0; + int id_ok = iComm->request( command, content ); + iRequestId = id_ok; int id_fail = iComm->request( "", QString("").toAscii() ); QVERIFY( iRequestId != 0 ); - QCOMPARE( id_fail, 0 ); + QVERIFY( id_fail != 0 ); + qDebug() << "id_ok:" << id_ok; + qDebug() << "id_fail: " << id_fail; for(int i=0; iRequestId != 0 && i < 5000/250; i++ ) QTest::qWait( 250 ); - const QByteArray& response = iComm->response( 0 ); - QVERIFY( response.contains("GetUserAvailabilityResponse") ); - iRequestId = iComm->request( "", QString("").toAscii() ); - QVERIFY( iRequestId != 0 ); - QVERIFY( response.isEmpty() ); + qDebug() << "iError:" << iError; + QVERIFY( iError == 0 ); + QByteArray* response = iComm->response( id_ok ); + QVERIFY( response != NULL ); + QVERIFY( !response->isEmpty() ); + if( response->contains("GetUserAvailabilityResponse") == FALSE ) + { + QWARN( *response ); + } + QVERIFY( response->contains("GetUserAvailabilityResponse") ); + delete response; + response = iComm->response( 0 ); + QVERIFY( response == NULL ); } -void TestCommunication::requestFinished( int aRequestId, QHttp::Error /*aError*/ ) +void TestCommunication::requestFinished( int aRequestId, int aError ) { - QCOMPARE( aRequestId, iRequestId ); + qDebug() << "TestCommunication::requestFinished:" << aRequestId << aError; + if( aRequestId == iRequestId ) + iError = aError; iRequestId = 0; }