telephonyserverplugins/common_tsy/test/component/src/cctsyfeatmgr.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The TEFUnit test that tests tests support for the Common TSY features in Feature Manager
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsyfeatmgr.h"
       
    23 #include "tmockltsydata.h"
       
    24 #include <featmgr/featurecontrol.h>
       
    25 #include <featureuids.h>
       
    26 
       
    27 CTestSuite* CCTsyFeatMgr::CreateSuiteL(const TDesC& aName)
       
    28 	{
       
    29 	SUB_SUITE;
       
    30 
       
    31 	ADD_TEST_STEP_ISO_CPP(CCTsyFeatMgr, TestFeatMgr0001L);
       
    32 	
       
    33 	END_SUITE;
       
    34 	}
       
    35 
       
    36 //
       
    37 // Actual test cases
       
    38 //
       
    39 
       
    40 /**
       
    41 @SYMTestCaseID BA-CTSY-FEAT-FEATMGR-0001
       
    42 @SYMComponent telephony_ctsy
       
    43 @SYMTestCaseDesc Test support for CommonTSY features in Feature Manager
       
    44 @SYMTestPriority High
       
    45 @SYMTestActions Opens connection to Feature Manager and queries support for CsVideoTelephony, EmergencyCallsEnabledInOfflineMode and DriveModeCanRestrictMtCalls features
       
    46 @SYMTestExpectedResults Pass
       
    47 @SYMTestType CT
       
    48 */
       
    49 void CCTsyFeatMgr::TestFeatMgr0001L()
       
    50 	{
       
    51 	TInt allFeaturesSupported(KFeatureSupported);
       
    52 	TBool allFeaturesFound(ETrue);
       
    53 	RFeatureControl featureControl;
       
    54 	TInt ret = featureControl.Open();
       
    55 	if (ret != KErrNone)
       
    56 		{
       
    57 		ERR_PRINTF1(_L("CCTsyFeatMgr::TestFeatMgr0001 - Could not connect to Feature Manager"));
       
    58 		}
       
    59 	ASSERT_EQUALS(KErrNone, ret);
       
    60 	CleanupClosePushL(featureControl);
       
    61 	ret = featureControl.FeatureSupported(NFeature::KCsVideoTelephony); 
       
    62 	if (ret != KFeatureSupported)
       
    63 		{
       
    64 		ERR_PRINTF1(_L("CCTsyFeatMgr::TestFeatMgr0001 - No support for CsVideoTelephony"));
       
    65 		allFeaturesSupported = KFeatureUnsupported;
       
    66         if (ret == KErrNotFound)
       
    67             {
       
    68             ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - CsVideoTelephony (UID 0x%x) not found in features.dat"),NFeature::KCsVideoTelephony);
       
    69             allFeaturesFound = EFalse;
       
    70             }
       
    71 		else if (ret == KFeatureUnsupported)
       
    72 			{
       
    73 			ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - CsVideoTelephony (UID 0x%x) is disabled according to features.dat"),NFeature::KCsVideoTelephony);
       
    74 			}		
       
    75 		}
       
    76 	ret = featureControl.FeatureSupported(NFeature::KEmergencyCallsEnabledInOfflineMode); 
       
    77 	if (ret != KFeatureSupported)
       
    78 		{
       
    79 		ERR_PRINTF1(_L("CCTsyFeatMgr::TestFeatMgr0001 - No support for EmergencyCallsEnabledInOfflineMode"));
       
    80 		allFeaturesSupported = KFeatureUnsupported;
       
    81         if (ret == KErrNotFound)
       
    82             {
       
    83             ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - EmergencyCallsEnabledInOfflineMode (UID 0x%x) not found in features.dat"),NFeature::KEmergencyCallsEnabledInOfflineMode);
       
    84             allFeaturesFound = EFalse;
       
    85             }
       
    86 		else if (ret == KFeatureUnsupported)
       
    87 			{
       
    88 			ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - EmergencyCallsEnabledInOfflineMode (UID 0x%x) is disabled according to features.dat"),NFeature::KEmergencyCallsEnabledInOfflineMode);
       
    89 			}					
       
    90 		}	
       
    91 	ret = featureControl.FeatureSupported(NFeature::KDriveModeCanRestrictMtCalls); 
       
    92 	if (ret != KFeatureSupported)
       
    93 		{
       
    94 		ERR_PRINTF1(_L("CCTsyFeatMgr::TestFeatMgr0001 - No support for DriveModeCanRestrictMtCalls"));
       
    95 		allFeaturesSupported = KFeatureUnsupported;
       
    96         if (ret == KErrNotFound)
       
    97             {
       
    98             ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - DriveModeCanRestrictMtCalls (UID 0x%x) not found in features.dat"),NFeature::KDriveModeCanRestrictMtCalls);
       
    99             allFeaturesFound = EFalse;
       
   100             }
       
   101 		else if (ret == KFeatureUnsupported)
       
   102 			{
       
   103 			ERR_PRINTF2(_L("CCTsyFeatMgr::TestFeatMgr0001 - DriveModeCanRestrictMtCalls (UID 0x%x) is disabled according to features.dat"),NFeature::KDriveModeCanRestrictMtCalls);
       
   104 			}           
       
   105 		}	
       
   106 
       
   107 	// features not found by Feature Manager indicates that we are likely to be using an outdated
       
   108 	// feature manager file (features.dat or featuredatabase.xml), with old or incorrect feature UIDs.
       
   109     ASSERT_TRUE(allFeaturesFound);
       
   110 	ASSERT_EQUALS(KFeatureSupported, allFeaturesSupported);
       
   111 	
       
   112 	INFO_PRINTF1(_L("CCTsyFeatMgr::TestFeatMgr0001 - SUCCESS: All required features are supported"));
       
   113     CleanupStack::PopAndDestroy(&featureControl);
       
   114 	}