imagingandcamerafws/cameraunittest/src/ECamInfoTest.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 
       
     2 // ECamInfoTest.cpp
       
     3 
       
     4 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     5 // All rights reserved.
       
     6 // This component and the accompanying materials are made available
       
     7 // under the terms of "Eclipse Public License v1.0"
       
     8 // which accompanies this distribution, and is available
       
     9 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 //
       
    11 // Initial Contributors:
       
    12 // Nokia Corporation - initial contribution.
       
    13 //
       
    14 // Contributors:
       
    15 //
       
    16 // Description:
       
    17 //
       
    18 
       
    19 #include "ECamInfoTest.h"
       
    20 #include <ecam.h>
       
    21 #include <ecam/ecamplugin.h>
       
    22 #include <ecam/ecaminfoplugin.h>
       
    23 #include <ecamuids.hrh>
       
    24 #include <ecom/ecomresolverparams.h>
       
    25 
       
    26 #include <mm/mmpluginutils.h>
       
    27 
       
    28 //
       
    29 // RECamInfoTest
       
    30 //
       
    31 
       
    32 RECamInfoTest* RECamInfoTest::NewL(TBool aAllocTest)
       
    33 	{
       
    34 	RECamInfoTest* self = new (ELeave) RECamInfoTest(aAllocTest);
       
    35 	return self;	
       
    36 	}
       
    37 	
       
    38 RECamInfoTest::RECamInfoTest(TBool /*aAllocTest*/)
       
    39 	{
       
    40 	iTestStepName = _L("MM-ECM-API-U-001");
       
    41 	}
       
    42 	
       
    43 TVerdict RECamInfoTest::DoTestStepL()
       
    44 	{
       
    45 	INFO_PRINTF1(_L("Check CCamera::CamerasAvailable"));
       
    46 	__MM_HEAP_MARK;
       
    47 	TInt numCameras = CCamera::CamerasAvailable();
       
    48 	__MM_HEAP_MARKEND;
       
    49 	if (numCameras!=0)
       
    50 		{
       
    51 		INFO_PRINTF2(_L("Error - %d returned"), numCameras);
       
    52 		return EFail;
       
    53 		}
       
    54 	return EPass;
       
    55 	}
       
    56 	
       
    57 //
       
    58 // RECamInnerInfoTest
       
    59 //
       
    60 
       
    61 RECamInnerInfoTest* RECamInnerInfoTest::NewL(TBool aAllocTest)
       
    62 	{
       
    63 	RECamInnerInfoTest* self = new (ELeave) RECamInnerInfoTest(aAllocTest);
       
    64 	return self;	
       
    65 	}
       
    66 	
       
    67 RECamInnerInfoTest::RECamInnerInfoTest(TBool /*aAllocTest*/)
       
    68 	{
       
    69 	iTestStepName = _L("MM-ECM-API-U-002");
       
    70 	}
       
    71 	
       
    72 TVerdict RECamInnerInfoTest::DoTestStepL()
       
    73 	{
       
    74 	TVerdict verdict = EPass;
       
    75 	INFO_PRINTF1(_L("Check CCameraInfoPlugin"));
       
    76 	__MM_HEAP_MARK;
       
    77 
       
    78 	TUid interfaceUid = {KUidOnboardCameraInfoPlugin};
       
    79 	TUid destructorKey = {0};
       
    80 
       
    81 	CCameraInfoPlugin* info = NULL;
       
    82 
       
    83 	TRAPD(error, info = static_cast<CCameraInfoPlugin*>
       
    84 			(MmPluginUtils::CreateImplementationL(interfaceUid, destructorKey, KECamPluginMatchString, KRomOnlyResolverUid)));
       
    85 
       
    86 	if (error!=KErrNone)
       
    87 		{
       
    88 		INFO_PRINTF2(_L("Could not open InfoPlugin - error %d"), error);
       
    89 		return EFail;
       
    90 		}
       
    91 
       
    92 	TInt numCameras = info->CamerasAvailable();
       
    93 	delete info;
       
    94 	REComSession::DestroyedImplementation(destructorKey);
       
    95 	REComSession::FinalClose();
       
    96 	__MM_HEAP_MARKEND;
       
    97 	if (numCameras!=0)
       
    98 		{
       
    99 		INFO_PRINTF2(_L("Error - %d returned"), numCameras);
       
   100 		verdict = EFail;
       
   101 		}
       
   102 	return verdict;
       
   103 	}