1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
|
14 // t_rapalssessionstep.cpp |
14 // |
15 // |
15 |
16 |
16 |
17 /** |
17 |
18 @file t_rapalssessionstep.cpp |
18 /** |
|
19 @file |
|
20 @test |
19 @test |
21 @internalComponent - Internal Symbian test code |
20 @internalComponent - Internal Symbian test code |
22 */ |
21 */ |
23 |
22 |
24 #include <f32file.h> |
23 #include <f32file.h> |
668 TEST(EFalse); |
667 TEST(EFalse); |
669 } |
668 } |
670 |
669 |
671 INFO_PRINTF1(KCompleted); |
670 INFO_PRINTF1(KCompleted); |
672 } |
671 } |
673 |
672 |
|
673 /** |
|
674 @SYMTestCaseID APPFWK-APPARC-00105 |
|
675 |
|
676 @SYMDEF DEF139507 :API for recognizing data from memory buffer |
|
677 |
|
678 @SYMTestCaseDesc Test data recognition functions of RApaLsSession passing data only by buffer. |
|
679 |
|
680 @SYMTestPriority High |
|
681 |
|
682 @SYMTestStatus Implemented |
|
683 |
|
684 @SYMTestActions Test RApaLsSession::RecognizeData() to recognize the data type of the data passed only by buffer. |
|
685 |
|
686 @SYMTestExpectedResults Test ensures that the data recognition functions identify the data type of |
|
687 data passed by buffer. |
|
688 */ |
|
689 void CT_RApaLsSessionTestStep::TestAppListRecognizeDataPassedByBufferL() |
|
690 { |
|
691 INFO_PRINTF1(_L("Testing data recognition functions of RApaLsSession passing data only by buffer")); |
|
692 |
|
693 //tbufferonlyrec.dll recognizes KTestBuffer with confidence as ECertain |
|
694 TDataRecognitionResult rr; |
|
695 _LIT8(KTestBuffer, "Text_TestRecognizer"); |
|
696 rr.Reset(); |
|
697 TInt error = iLs.RecognizeData(KTestBuffer, rr); |
|
698 if (rr.iConfidence != CApaDataRecognizerType::ECertain) |
|
699 { |
|
700 INFO_PRINTF1(_L("Error: confidence should be ECertain")); |
|
701 TEST(EFalse); |
|
702 } |
|
703 |
|
704 //tbufferonlyrec.dll recognizes KAnotherBuffer with confidence as EProbable |
|
705 _LIT8(KAnotherBuffer, "AnotherText"); |
|
706 rr.Reset(); |
|
707 error = iLs.RecognizeData(KAnotherBuffer, rr); |
|
708 if (rr.iConfidence != CApaDataRecognizerType::EProbable) |
|
709 { |
|
710 INFO_PRINTF1(_L("Error: confidence should be EProbable")); |
|
711 TEST(EFalse); |
|
712 } |
|
713 |
|
714 //tbufferonlyrec.dll recognizes KSampleBuffer with confidence as ENotRecognized |
|
715 _LIT8(KSampleBuffer, "Sample Application"); |
|
716 rr.Reset(); |
|
717 error = iLs.RecognizeData(KSampleBuffer, rr); |
|
718 if (rr.iConfidence != CApaDataRecognizerType::ENotRecognized) |
|
719 { |
|
720 INFO_PRINTF1(_L("Error: confidence should be ENotRecognized")); |
|
721 TEST(EFalse); |
|
722 } |
|
723 INFO_PRINTF1(KCompleted); |
|
724 } |
|
725 |
674 /** |
726 /** |
675 @SYMTestCaseID T-Serv2Step-DoEnquiryTestsL |
727 @SYMTestCaseID T-Serv2Step-DoEnquiryTestsL |
676 |
728 |
677 @SYMPREQ |
729 @SYMPREQ |
678 |
730 |
1695 HBufC* fullIconFileName = NULL; |
1747 HBufC* fullIconFileName = NULL; |
1696 ret = iLs.GetAppViewIcon(TUid::Uid(KGroupNameApp), viewInfo.iUid, fullIconFileName); |
1748 ret = iLs.GetAppViewIcon(TUid::Uid(KGroupNameApp), viewInfo.iUid, fullIconFileName); |
1697 TEST(ret == KErrNone); |
1749 TEST(ret == KErrNone); |
1698 TEST(fullIconFileName != NULL); |
1750 TEST(fullIconFileName != NULL); |
1699 INFO_PRINTF2(_L("The View icon's UID is - %X"), viewInfo.iUid); |
1751 INFO_PRINTF2(_L("The View icon's UID is - %X"), viewInfo.iUid); |
1700 TEST(!fullIconFileName->Compare(_L("file:///c/resource/apps/tcheckiconapp.xyz"))); |
1752 TEST(!fullIconFileName->Compare(_L("file://c/resource/apps/tcheckiconapp.xyz"))); |
1701 INFO_PRINTF2(_L("View's icon file name is - %S"), fullIconFileName); |
1753 INFO_PRINTF2(_L("View's icon file name is - %S"), fullIconFileName); |
1702 |
1754 |
1703 delete fullIconFileName; |
1755 delete fullIconFileName; |
1704 CleanupStack::PopAndDestroy(appViews); |
1756 CleanupStack::PopAndDestroy(appViews); |
1705 |
1757 |
1986 CleanupStack::PopAndDestroy(2, &theFS); |
2038 CleanupStack::PopAndDestroy(2, &theFS); |
1987 |
2039 |
1988 INFO_PRINTF1(_L("Test TestAppListInstallation1L completed")); |
2040 INFO_PRINTF1(_L("Test TestAppListInstallation1L completed")); |
1989 } |
2041 } |
1990 |
2042 |
|
2043 /** |
|
2044 @SYMTestCaseID APPFWK-APPARC-0107 |
|
2045 |
|
2046 @SYMDEF DEF141484 |
|
2047 |
|
2048 @SYMTestCaseDesc Tests whether Phone booting is failed or not with pesense of |
|
2049 an .mbm file of size zero in the path resource\apps |
|
2050 |
|
2051 @SYMTestPriority |
|
2052 |
|
2053 @SYMTestStatus Implemented |
|
2054 |
|
2055 @SYMTestActions Place an .mbm file of size zero in the path resource\apps |
|
2056 |
|
2057 @SYMTestExpectedResults Phone booting should not fail with pesense of |
|
2058 an .mbm file of size zero in the path resource\apps |
|
2059 |
|
2060 */ |
|
2061 void CT_RApaLsSessionTestStep::TestZeroSizedIconFileL() |
|
2062 { |
|
2063 |
|
2064 INFO_PRINTF1(_L("Test TestZeroSizedIconFileL Started..........")); |
|
2065 |
|
2066 _LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" ); |
|
2067 _LIT(KTestAppResourceDir, "C:\\resource\\apps\\" ); |
|
2068 |
|
2069 _LIT(KTestAppSource, "Z:\\apparctest\\zerosizedicon_reg.rsc" ); |
|
2070 _LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\zerosizedicon_reg.rsc" ); |
|
2071 |
|
2072 _LIT(KTestMbmSource, "Z:\\resource\\apps\\zerosizedicon.mbm"); |
|
2073 _LIT(KTestMbmDest, "C:\\resource\\apps\\zerosizedicon.mbm"); |
|
2074 |
|
2075 _LIT(KTestLocSource, "Z:\\apparctest\\zerosizedicon_loc.rsc"); |
|
2076 _LIT(KTestLocDest, "C:\\resource\\apps\\zerosizedicon_loc.rsc"); |
|
2077 |
|
2078 TRequestStatus appScanCompleted=KRequestPending; |
|
2079 iLs.SetNotify(EFalse,appScanCompleted); |
|
2080 |
|
2081 RSmlTestUtils utils; |
|
2082 CleanupClosePushL(utils); |
|
2083 TEST(KErrNone == utils.Connect()); |
|
2084 |
|
2085 INFO_PRINTF1(_L("Creating directory C:\\private\\10003a3f\\import\\apps\\ folder")); |
|
2086 TInt err=utils.CreateDirectoryL(KTestAppDestDir); |
|
2087 TESTEL((err==KErrNone) || (err==KErrAlreadyExists),err); |
|
2088 |
|
2089 INFO_PRINTF1(_L("Creating directory C:\\resource\\apps\\ folder")); |
|
2090 err=utils.CreateDirectoryL(KTestAppResourceDir); |
|
2091 TESTEL((err==KErrNone) || (err==KErrAlreadyExists),err); |
|
2092 |
|
2093 INFO_PRINTF1(_L("Copying _reg.rsc to C:\\private\\10003a3f\\import\\apps\\ folder")); |
|
2094 User::LeaveIfError(utils.CopyFileL(KTestAppSource,KTestAppDest)); |
|
2095 INFO_PRINTF1(_L("Copying the mbm and _loc.rsc to C:\\resource\\apps\\ folder")); |
|
2096 User::LeaveIfError(utils.CopyFileL(KTestMbmSource,KTestMbmDest)); |
|
2097 User::LeaveIfError(utils.CopyFileL(KTestLocSource,KTestLocDest)); |
|
2098 |
|
2099 User::WaitForRequest(appScanCompleted); |
|
2100 TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged); |
|
2101 |
|
2102 appScanCompleted=KRequestPending; |
|
2103 iLs.SetNotify(EFalse,appScanCompleted); |
|
2104 INFO_PRINTF1(_L("Removing _reg.rsc from C:\\private\\10003a3f\\import\\apps\\ folder")); |
|
2105 TEST(KErrNone == DeleteFileL(utils, KTestAppDest)); |
|
2106 INFO_PRINTF1(_L("Removing the mbm and _loc.rsc from C:\\resource\\apps\\ folder")); |
|
2107 TEST(KErrNone == DeleteFileL(utils, KTestMbmDest)); |
|
2108 TEST(KErrNone == DeleteFileL(utils, KTestLocDest)); |
|
2109 INFO_PRINTF1(_L("Removing the C:\\private\\10003a3f\\import\\apps\\ dir ")); |
|
2110 TEST(KErrNone == utils.DeleteDirectoryL(KTestAppDestDir)); |
|
2111 |
|
2112 User::WaitForRequest(appScanCompleted); |
|
2113 CleanupStack::PopAndDestroy(&utils);//utils |
|
2114 INFO_PRINTF1(_L("Test TestZeroSizedIconFileL completed")); |
|
2115 } |
|
2116 |
|
2117 //Deletes the file if it exists. |
|
2118 TInt CT_RApaLsSessionTestStep::DeleteFileL(RSmlTestUtils &aFs, const TDesC &aFileName) |
|
2119 { |
|
2120 TInt fileExists = EFalse; |
|
2121 TInt err; |
|
2122 aFs.IsFilePresent(aFileName, fileExists); |
|
2123 if (fileExists) |
|
2124 { |
|
2125 aFs.ChangeFilePermissionL(aFileName); |
|
2126 err=aFs.DeleteFileL(aFileName); |
|
2127 if(err==KErrNone) |
|
2128 INFO_PRINTF2(_L("Removed file %S"), &aFileName); |
|
2129 else |
|
2130 INFO_PRINTF2(_L("Failed to remove file %S"), &aFileName); |
|
2131 } |
|
2132 else |
|
2133 { |
|
2134 err=KErrNotFound; |
|
2135 } |
|
2136 |
|
2137 return(err); |
|
2138 } |
|
2139 |
|
2140 |
1991 /** |
2141 /** |
1992 @SYMTestCaseID T-RApaLsSessionTestStep-TestAppFolderNonRomDrivesL |
2142 @SYMTestCaseID T-RApaLsSessionTestStep-TestAppFolderNonRomDrivesL |
1993 |
2143 |
1994 @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications |
2144 @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications |
1995 |
2145 |
2380 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListInvalidL(), iLs.ClearAppInfoArray() ); |
2531 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListInvalidL(), iLs.ClearAppInfoArray() ); |
2381 //DONT_CHECK due to file system changes |
2532 //DONT_CHECK due to file system changes |
2382 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallationL(), NO_CLEANUP); |
2533 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallationL(), NO_CLEANUP); |
2383 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallation1L(), NO_CLEANUP); |
2534 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallation1L(), NO_CLEANUP); |
2384 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppFolderNonRomDrivesL(), NO_CLEANUP); |
2535 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppFolderNonRomDrivesL(), NO_CLEANUP); |
2385 HEAP_TEST_LS_SESSION(iLs, 0, 0, IconLoadingTestCasesL(), NO_CLEANUP); |
2536 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestZeroSizedIconFileL(), NO_CLEANUP); |
|
2537 HEAP_TEST_LS_SESSION(iLs, 0, 0, IconLoadingTestCasesL(), NO_CLEANUP); |
2386 HEAP_TEST_LS_SESSION(iLs, 0, 0, AppInfoTestCasesL(), iLs.ClearAppInfoArray(); NO_CLEANUP); |
2538 HEAP_TEST_LS_SESSION(iLs, 0, 0, AppInfoTestCasesL(), iLs.ClearAppInfoArray(); NO_CLEANUP); |
2387 HEAP_TEST_LS_SESSION(iLs, 0, 0, EmbeddedAppsTestCases(), iLs.ClearAppInfoArray() ); |
2539 HEAP_TEST_LS_SESSION(iLs, 0, 0, EmbeddedAppsTestCases(), iLs.ClearAppInfoArray() ); |
2388 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, DoNumDefIconsTestL(), NO_CLEANUP); |
2540 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, DoNumDefIconsTestL(), NO_CLEANUP); |
2389 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestMatchesSecurityPolicy(), NO_CLEANUP); |
2541 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestMatchesSecurityPolicy(), NO_CLEANUP); |
2390 //DONT_CHECK since there's a new typestore |
2542 //DONT_CHECK since there's a new typestore |
2391 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestNotifyOnDataMappingChangeL(), NO_CLEANUP); |
2543 HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestNotifyOnDataMappingChangeL(), NO_CLEANUP); |
2392 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataBufferOnlyL(), iLs.FlushRecognitionCache() ); |
2544 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataBufferOnlyL(), iLs.FlushRecognitionCache() ); |
|
2545 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataPassedByBufferL(), iLs.FlushRecognitionCache() ); |
2393 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataL(), iLs.FlushRecognitionCache() ); |
2546 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataL(), iLs.FlushRecognitionCache() ); |
2394 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedApps(), NO_CLEANUP); |
2547 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedApps(), NO_CLEANUP); |
2395 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedAppsRegFile(), NO_CLEANUP); |
2548 HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedAppsRegFile(), NO_CLEANUP); |
2396 TestIconLoaderAndIconArrayMemoryLeaksL(); |
2549 TestIconLoaderAndIconArrayMemoryLeaksL(); |
2397 } |
2550 } |