sl@0: sl@0: // ECamInfoAdvTest.cpp sl@0: sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "ECamInfoAdvTest.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "ECamUnitTestPluginUids.hrh" sl@0: sl@0: const TInt KInvalidNumberOfCameras = -1; sl@0: const TInt KEmptyKeyValue = 0; sl@0: // sl@0: // RECamInfoTest sl@0: // sl@0: sl@0: RECamInfoTest* RECamInfoTest::NewL(TBool aAllocTest) sl@0: { sl@0: RECamInfoTest* self = new (ELeave) RECamInfoTest(aAllocTest); sl@0: return self; sl@0: } sl@0: sl@0: RECamInfoTest::RECamInfoTest(TBool /*aAllocTest*/) sl@0: { sl@0: iTestStepName = _L("MM-ECM-ADV-U-001-HP"); sl@0: } sl@0: sl@0: TVerdict RECamInfoTest::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Check CCamera::CamerasAvailable")); sl@0: INFO_PRINTF1(_L("using static function call")); sl@0: __MM_HEAP_MARK; sl@0: TInt numCameras = CCamera::CamerasAvailable(); sl@0: __MM_HEAP_MARKEND; sl@0: // the verdict sl@0: if (numCameras <= 0) sl@0: { sl@0: INFO_PRINTF2(_L("Error %d returned"), numCameras); sl@0: return EFail; sl@0: } sl@0: INFO_PRINTF2(_L("Available cameras %d returned"), numCameras); sl@0: return EPass; sl@0: } sl@0: sl@0: // sl@0: // RECamInnerInfoTest sl@0: // sl@0: RECamInnerInfoTest* RECamInnerInfoTest::NewL(TBool aAllocTest) sl@0: { sl@0: RECamInnerInfoTest* self = new (ELeave) RECamInnerInfoTest(aAllocTest); sl@0: return self; sl@0: } sl@0: sl@0: RECamInnerInfoTest::RECamInnerInfoTest(TBool /*aAllocTest*/) sl@0: { sl@0: iTestStepName = _L("MM-ECM-ADV-U-002-LP"); sl@0: } sl@0: sl@0: TVerdict RECamInnerInfoTest::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Check CCameraInfoPlugin")); sl@0: INFO_PRINTF1(_L("Use CCamera::CamerasAvailable")); sl@0: TInt numCameras = KInvalidNumberOfCameras; sl@0: TVerdict result = EPass; sl@0: sl@0: INFO_PRINTF1(_L("Open set plugin directly")); sl@0: sl@0: __MM_HEAP_MARK; sl@0: TUid implementationUid = {KUidCameraUnitTestInfo}; sl@0: TUid destructorKey = {KEmptyKeyValue}; sl@0: CCameraInfoPlugin* info = NULL; sl@0: TRAPD(error, info = static_cast sl@0: (REComSession::CreateImplementationL(implementationUid, destructorKey))); sl@0: sl@0: if (error != KErrNone) sl@0: { sl@0: INFO_PRINTF3(_L("CreateImplementationL InfoPlugin %x failed %d"), KUidCameraUnitTestInfo, error); sl@0: result = EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("CreateImplementationL InfoPlugin %x is OK"), destructorKey.iUid); sl@0: sl@0: numCameras = info->CamerasAvailable(); sl@0: INFO_PRINTF2(_L("Available cameras %d returned"), numCameras); sl@0: delete info; sl@0: REComSession::DestroyedImplementation(destructorKey); sl@0: REComSession::FinalClose(); sl@0: } sl@0: sl@0: // the verdict sl@0: if (numCameras <= 0) sl@0: { sl@0: INFO_PRINTF2(_L("Error - camera %d returned"), numCameras); sl@0: result = EFail; sl@0: } sl@0: __MM_HEAP_MARKEND; sl@0: sl@0: return result; sl@0: }