videocollection/videocollectionview/tsrc/testvideooperatorservice_p/src/testvideooperatorservice_p.cpp
changeset 67 72c709219fcd
parent 55 4bfa887905cf
equal deleted inserted replaced
66:adb51f74b890 67:72c709219fcd
    19 #include <hbapplication.h>
    19 #include <hbapplication.h>
    20 #include <hbmainwindow.h>
    20 #include <hbmainwindow.h>
    21 #include <hbinstance.h>
    21 #include <hbinstance.h>
    22 #include <qdebug.h>
    22 #include <qdebug.h>
    23 
    23 
       
    24 #include "apaidstub.h"
       
    25 #include "apgclistub.h"
       
    26 #include "apgtaskstub.h"
       
    27 #include "coemainstub.h"
       
    28 #include "xqappmgrstub.h"
       
    29 #include "xqaiwrequeststub.h"
    24 #include "testvideooperatorservice_p.h"
    30 #include "testvideooperatorservice_p.h"
    25 #include "videocollectionviewutilsdata.h"
    31 #include "videocollectionviewutilsdata.h"
    26 
    32 
    27 #define private public
    33 #define private public
    28 #include "videooperatorservice_p.h"
    34 #include "videooperatorservice_p.h"
    74     TApaTask::mExistsReturnValue = true;
    80     TApaTask::mExistsReturnValue = true;
    75     TApaTask::mExistsCallCount = 0;
    81     TApaTask::mExistsCallCount = 0;
    76     TApaTask::mBringToForegroundCallcount = 0;
    82     TApaTask::mBringToForegroundCallcount = 0;
    77     RApaLsSession::mGetAppInfoCallCount = 0;
    83     RApaLsSession::mGetAppInfoCallCount = 0;
    78     TApaAppInfo::mConstructCount = 0;
    84     TApaAppInfo::mConstructCount = 0;
       
    85     XQApplicationManager::reset();
       
    86     XQAiwRequest::reset();
    79     
    87     
    80     // create test object
    88     // create test object
    81     if (!mTestObject)
    89     if (!mTestObject)
    82     {
    90     {
    83         mTestObject = new VideoOperatorServicePrivate();
    91         mTestObject = new VideoOperatorServicePrivate();
   170 //
   178 //
   171 void TestVideoOperatorServicePrivate::testLaunchService()
   179 void TestVideoOperatorServicePrivate::testLaunchService()
   172 {
   180 {
   173     // Good case.
   181     // Good case.
   174     init();
   182     init();
       
   183     mTestObject->mServiceUri = "";
   175     mTestObject->mApplicationUid = 123456;
   184     mTestObject->mApplicationUid = 123456;
   176     RApaLsSession::mFileName.Copy(_L("test.exe"));
   185     RApaLsSession::mFileName.Copy(_L("test.exe"));
   177     mTestObject->launchService();
   186     mTestObject->launchService();
   178     QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1);
   187     QCOMPARE(RApaLsSession::mGetAppInfoCallCount, 1);
   179     QCOMPARE(TApaAppInfo::mConstructCount, 1);
   188     QCOMPARE(TApaAppInfo::mConstructCount, 1);
   245     mTestObject->processFinished(0, QProcess::NormalExit);
   254     mTestObject->processFinished(0, QProcess::NormalExit);
   246     // Nothing to verify
   255     // Nothing to verify
   247     cleanup();
   256     cleanup();
   248 }
   257 }
   249 
   258 
       
   259 // ---------------------------------------------------------------------------
       
   260 // testLaunchUrl
       
   261 // ---------------------------------------------------------------------------
       
   262 //
       
   263 void TestVideoOperatorServicePrivate::testLaunchUrl()
       
   264 {
       
   265     // First and second call, should succeed
       
   266     init();
       
   267     mTestObject->mServiceUri = "test";
       
   268     mTestObject->launchService();
       
   269     QCOMPARE(XQAiwRequest::mSendCallCount, 1);
       
   270     mTestObject->launchService();
       
   271     QCOMPARE(XQAiwRequest::mSendCallCount, 2);
       
   272     cleanup();
       
   273     
       
   274     // Request create fails.
       
   275     init();
       
   276     XQApplicationManager::mCreateFails = true;
       
   277     mTestObject->mServiceUri = "test";
       
   278     mTestObject->launchService();
       
   279     QCOMPARE(XQApplicationManager::mCreateCallCount, 1);
       
   280     QCOMPARE(XQAiwRequest::mSetArgumentsCallCount, 0);
       
   281     QCOMPARE(XQAiwRequest::mSendCallCount, 0);
       
   282     QCOMPARE(XQAiwRequest::mSetEmbeddedCallCount, 0);
       
   283     QCOMPARE(XQAiwRequest::mLastErrorCallCount, 0);
       
   284     cleanup();
       
   285 
       
   286     // Request send fails.
       
   287     init();
       
   288     XQAiwRequest::mSendFails = true;
       
   289     mTestObject->mServiceUri = "test";
       
   290     XQAiwRequest::mLastErrorReturnValue = 111;
       
   291     mTestObject->launchService();
       
   292     QCOMPARE(XQApplicationManager::mCreateCallCount, 1);
       
   293     QCOMPARE(XQAiwRequest::mSetArgumentsCallCount, 1);
       
   294     QCOMPARE(XQAiwRequest::mSendCallCount, 1);
       
   295     QCOMPARE(XQAiwRequest::mSetEmbeddedCallCount, 1);
       
   296     QCOMPARE(XQAiwRequest::mLastErrorCallCount, 1);
       
   297     cleanup();
       
   298 }
       
   299 
   250 // end of file
   300 // end of file