qthighway/tsrc/at_xqapplicationmanager/at_xqapplicationmanager.cpp
changeset 24 9d760f716ca8
parent 19 46686fb6258c
equal deleted inserted replaced
19:46686fb6258c 24:9d760f716ca8
    46 }
    46 }
    47 
    47 
    48 
    48 
    49 void Test_XQApplicationManager::init()
    49 void Test_XQApplicationManager::init()
    50 {
    50 {
       
    51     testSharableFile = new XQSharableFile();
       
    52     QVERIFY2(testSharableFile->open(testFileStr), mLog.join(endOfLine).toAscii());
    51     mAppManager = new XQApplicationManager();
    53     mAppManager = new XQApplicationManager();
    52     QVERIFY2(mAppManager != NULL, mLog.join(endOfLine).toAscii()); 
    54     QVERIFY2(mAppManager != NULL, mLog.join(endOfLine).toAscii()); 
    53     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii()); 
    55     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii()); 
    54 }
    56 }
    55 
    57 
    56 void Test_XQApplicationManager::drm_file()
    58 void Test_XQApplicationManager::drm_file()
    57 {
    59 {
    58     mLog << "[QTH] [Test_XQApplicationManager] drm_file";
    60     mLog << "[QTH] [Test_XQApplicationManager] drm_file";
    59 
    61 
       
    62 #ifdef __WINS__
       
    63     QSKIP("Checking drm attributes does not work correctly on emulator", SkipAll);
       
    64 #endif
       
    65     
    60     QStringList logmem = mLog;
    66     QStringList logmem = mLog;
    61     
    67     
    62     foreach (QString fileStr, testData.files.keys()) {
    68     foreach (QString fileStr, testData.files.keys()) {
    63         QFile file(fileStr);
    69         QFile file(fileStr);
    64         QVariantList drmValues;
    70         QVariantList drmValues;
    94 }
   100 }
    95 
   101 
    96 void Test_XQApplicationManager::drm_sharablefile()
   102 void Test_XQApplicationManager::drm_sharablefile()
    97 {
   103 {
    98     mLog << "[QTH] [Test_XQApplicationManager] drm_sharablefile";
   104     mLog << "[QTH] [Test_XQApplicationManager] drm_sharablefile";
       
   105     
       
   106 #ifdef __WINS__
       
   107     QSKIP("Checking drm attributes does not work correctly on emulator", SkipAll);
       
   108 #endif
    99     
   109     
   100     QStringList logmem = mLog;
   110     QStringList logmem = mLog;
   101 
   111 
   102     foreach (QString fileStr, testData.files.keys()) {
   112     foreach (QString fileStr, testData.files.keys()) {
   103         XQSharableFile sharableFile;
   113         XQSharableFile sharableFile;
   251 
   261 
   252 void Test_XQApplicationManager::list_file()
   262 void Test_XQApplicationManager::list_file()
   253 {
   263 {
   254     mLog << "[QTH] [Test_XQApplicationManager] list_file";
   264     mLog << "[QTH] [Test_XQApplicationManager] list_file";
   255     
   265     
       
   266     QSKIP("Currently function list(const QFile& file) returns maximum one interface", SkipAll);
       
   267     
   256     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(testFile);
   268     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(testFile);
   257     
   269     
   258     foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   270     foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   259         bool equal = false;
   271         bool equal = false;
   260         foreach (XQAiwInterfaceDescriptor interfaceDesc, list)
   272         foreach (XQAiwInterfaceDescriptor interfaceDesc, list)
   277 
   289 
   278 void Test_XQApplicationManager::list_sharablefile()
   290 void Test_XQApplicationManager::list_sharablefile()
   279 {
   291 {
   280     mLog << "[QTH] [Test_XQApplicationManager] list_sharablefile";
   292     mLog << "[QTH] [Test_XQApplicationManager] list_sharablefile";
   281 
   293 
   282     XQSharableFile testSharableFile;
   294     QSKIP("Currently function list(const XQSharableFile& file) returns maximum one interface", SkipAll);
   283     testSharableFile.open(testFileStr);
   295     
   284     
   296     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(*testSharableFile);
   285     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(testSharableFile);
       
   286     
   297     
   287     foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   298     foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   288         bool equal = false;
   299         bool equal = false;
   289         foreach (XQAiwInterfaceDescriptor interfaceDesc, list) {
   300         foreach (XQAiwInterfaceDescriptor interfaceDesc, list) {
   290             if (interfaceData->compare(interfaceDesc, mLog)) {
   301             if (interfaceData->compare(interfaceDesc, mLog)) {
   299         
   310         
   300         QVERIFY2(equal, mLog.join(endOfLine).toAscii());
   311         QVERIFY2(equal, mLog.join(endOfLine).toAscii());
   301     }
   312     }
   302     
   313     
   303     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   314     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   304     
       
   305     testSharableFile.close();
       
   306     
   315     
   307     mLog << "[QTH] [Test_XQApplicationManager] list_sharablefile end";
   316     mLog << "[QTH] [Test_XQApplicationManager] list_sharablefile end";
   308 }
   317 }
   309 
   318 
   310 void Test_XQApplicationManager::create_interface()
   319 void Test_XQApplicationManager::create_interface()
   546 
   555 
   547 void Test_XQApplicationManager::create_sharablefile()
   556 void Test_XQApplicationManager::create_sharablefile()
   548 {
   557 {
   549     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile";
   558     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile";
   550     
   559     
   551     XQSharableFile testSharableFile;
       
   552     QVERIFY2(testSharableFile.open(testFileStr), mLog.join(endOfLine).toAscii());
       
   553     
       
   554     {
   560     {
   555         XQAiwRequest* request = mAppManager->create(testSharableFile, true);
   561         XQAiwRequest* request = mAppManager->create(*testSharableFile, true);
   556         testRequest(request, QString(), QString(), true, true, &testSharableFile);
   562         testRequest(request, QString(), QString(), true, true, testSharableFile);
   557         delete request;
   563         delete request;
   558     }
   564     }
   559         
   565         
   560     {
   566     {
   561         XQAiwRequest* request = mAppManager->create(testSharableFile, false);
   567         XQAiwRequest* request = mAppManager->create(*testSharableFile, false);
   562         testRequest(request, QString(), testFileStr, false, true, &testSharableFile);
   568         testRequest(request, QString(), testFileStr, false, true, testSharableFile);
   563         delete request;
   569         delete request;
   564     }
   570     }
   565             
   571             
   566     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   572     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   567     
   573     
   568     testSharableFile.close();
       
   569     
       
   570     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile end";
   574     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile end";
   571 }
   575 }
   572 
   576 
   573 void Test_XQApplicationManager::create_sharablefile_implementation()
   577 void Test_XQApplicationManager::create_sharablefile_implementation()
   574 {
   578 {
   575     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile_implementation";
   579     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile_implementation";
   576     
   580     
   577     XQSharableFile testSharableFile;
   581     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(*testSharableFile);
   578     testSharableFile.open(testFileStr);
       
   579     QList<XQAiwInterfaceDescriptor> list = mAppManager->list(testSharableFile);
       
   580     QVERIFY2(list.count() > 0, mLog.join(endOfLine).toAscii());
   582     QVERIFY2(list.count() > 0, mLog.join(endOfLine).toAscii());
   581     
   583     
   582     foreach (XQAiwInterfaceDescriptor interfaceDesc, list) {
   584     foreach (XQAiwInterfaceDescriptor interfaceDesc, list) {
   583         foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   585         foreach (InterfaceData* interfaceData, testData.interfaces.values(IFileView)) {
   584             if (interfaceData->compare(interfaceDesc, mLog)) {
   586             if (interfaceData->compare(interfaceDesc, mLog)) {
   585                 {
   587                 {
   586                     XQAiwRequest* request = mAppManager->create(testSharableFile, interfaceDesc, true);
   588                     XQAiwRequest* request = mAppManager->create(*testSharableFile, interfaceDesc, true);
   587                     testRequest(request, QString(), testFileStr, true, true, &testSharableFile);
   589                     testRequest(request, QString(), testFileStr, true, true, testSharableFile);
   588                     delete request;
   590                     delete request;
   589                 }
   591                 }
   590                     
   592                     
   591                 {
   593                 {
   592                     XQAiwRequest* request = mAppManager->create(testSharableFile, interfaceDesc, false);
   594                     XQAiwRequest* request = mAppManager->create(*testSharableFile, interfaceDesc, false);
   593                     testRequest(request, QString(), testFileStr, false, true, &testSharableFile);
   595                     testRequest(request, QString(), testFileStr, false, true, testSharableFile);
   594                     delete request;
   596                     delete request;
   595                 }
   597                 }
   596             }
   598             }
   597         }
   599         }
   598         
   600         
   604         QVERIFY2(interfaceDesc.isValid(), mLog.join(endOfLine).toAscii());
   606         QVERIFY2(interfaceDesc.isValid(), mLog.join(endOfLine).toAscii());
   605     }
   607     }
   606             
   608             
   607     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   609     QVERIFY2(mAppManager->lastError() == XQService::ENoError, mLog.join(endOfLine).toAscii());
   608     
   610     
   609     testSharableFile.close();
       
   610     
       
   611     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile_implementation end";
   611     mLog << "[QTH] [Test_XQApplicationManager] create_sharablefile_implementation end";
   612 }
   612 }
   613 
   613 
   614 const QList<int> Test_XQApplicationManager::listDrmAttr()
   614 const QList<int> Test_XQApplicationManager::listDrmAttr()
   615 {
   615 {
   627 void Test_XQApplicationManager::cleanup()
   627 void Test_XQApplicationManager::cleanup()
   628 {
   628 {
   629     delete mAppManager;
   629     delete mAppManager;
   630     mAppManager = NULL;
   630     mAppManager = NULL;
   631     mLog.clear();
   631     mLog.clear();
       
   632     testSharableFile->close();
       
   633     delete testSharableFile;
       
   634     testSharableFile = NULL;
   632 }
   635 }
   633 
   636 
   634 void Test_XQApplicationManager::testRequest(XQAiwRequest* request, const QString &operation, 
   637 void Test_XQApplicationManager::testRequest(XQAiwRequest* request, const QString &operation, 
   635         const QString &arguments, bool embedded, bool synchronous, XQSharableFile *sharablefile)
   638         const QString &arguments, bool embedded, bool synchronous, XQSharableFile *sharablefile)
   636 {
   639 {