localisation/apparchitecture/tef/T_File2Step.cpp
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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.
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // Tests CApaAppRegFinder APIs.
    14 // Tests CApaAppRegFinder APIs.
    15 // 
    15 // 
       
    16 // t_file2step.cpp
    16 //
    17 //
    17 
    18 
    18 
       
    19 
       
    20 /**
    19 /**
    21  @file
    20  @file t_file2step.cpp
    22  @internalComponent - Internal Symbian test code
    21  @internalComponent - Internal Symbian test code
    23 */
    22 */
    24 
    23 
    25 #include "T_File2Step.h"
    24 #include "T_File2Step.h"
    26 #include "..\apfile\aprfndr.h"
    25 #include "../aplist/aplappregfinder.h"	// class CApaAppRegFinder
       
    26 #include "../aplist/aplapplistitem.h"	// class TApaAppEntry
    27 
    27 
    28 //
    28 //
    29 #if !defined(__E32TEST_H__)
    29 #if !defined(__E32TEST_H__)
    30 #include <e32test.h>
    30 #include <e32test.h>
    31 #endif
    31 #endif
    56 	INFO_PRINTF1(_L("Testing CApaAppRegFinder::FindAllAppsL()"));
    56 	INFO_PRINTF1(_L("Testing CApaAppRegFinder::FindAllAppsL()"));
    57 	RFs fSession;
    57 	RFs fSession;
    58 	fSession.Connect();
    58 	fSession.Connect();
    59 	CApaAppRegFinder* regFinder=CApaAppRegFinder::NewL(fSession);
    59 	CApaAppRegFinder* regFinder=CApaAppRegFinder::NewL(fSession);
    60 	//
    60 	//
    61 	TRAPD(ret, regFinder->FindAllAppsL() );
    61 	TRAPD(ret, regFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives) );
    62 	TEST(ret==KErrNone);
    62 	TEST(ret==KErrNone);
    63 	//
    63 	//
       
    64 	CDesCArray* dummyArray = new (ELeave) CDesCArraySeg(1);
       
    65 	CleanupStack::PushL(dummyArray);
    64 	TBool more=ETrue;
    66 	TBool more=ETrue;
    65 	TInt count=0;
    67 	TInt count=0;
    66 	while (more) 
    68 	while (more) 
    67 		{
    69 		{
    68 		TApaAppEntry entry;
    70 		TApaAppEntry entry;
    69 		RPointerArray<HBufC> dummy;
    71 		TRAPD(ret, more=regFinder->NextL(entry, *dummyArray) );
    70 		TRAPD(ret, more=regFinder->NextL(entry, dummy) );
       
    71 		TEST(ret==KErrNone);
    72 		TEST(ret==KErrNone);
    72 		if (more)
    73 		if (more)
    73 			count++;
    74 			count++;
    74 		}
    75 		}
    75 	TEST(count>0);
    76 	TEST(count>0);
    76 	INFO_PRINTF2(_L("     Apps found: %D"),count);
    77 	INFO_PRINTF2(_L("     Apps found: %D"),count);
    77 	//
    78 	//
       
    79 	CleanupStack::PopAndDestroy(dummyArray);
    78 	delete regFinder;
    80 	delete regFinder;
    79 	fSession.Close();
    81 	fSession.Close();
    80 	}
    82 	}
    81 
    83 
    82 CT_File2Step::~CT_File2Step()
    84 CT_File2Step::~CT_File2Step()
   129 	__UHEAP_MARKEND;
   131 	__UHEAP_MARKEND;
   130 
   132 
   131 	INFO_PRINTF1(_L("Test completed!"));
   133 	INFO_PRINTF1(_L("Test completed!"));
   132 	return TestStepResult();
   134 	return TestStepResult();
   133 	}
   135 	}
       
   136