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 ) )
);
}
QCOMPARE( rp.isValid(), true );
QSignalSpy rs( iComm, SIGNAL(requestStarted( int )) );
QCOMPARE( rs.isValid(), true );
- qRegisterMetaType<QHttp::Error>("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() );
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 );
}
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;
}