telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestnetworksecurity.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 // Test step definitions for the NetworkSecurity functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #include "cctsyintegrationtestnetworksecurity.h"
       
    23 
       
    24 
       
    25 
       
    26 	
       
    27 CCTSYIntegrationTestNetworkSecurityBase::CCTSYIntegrationTestNetworkSecurityBase(CEtelSessionMgr& aEtelSessionMgr)
       
    28 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iNetworkTestHelper(*this)
       
    29 /**
       
    30  * Constructor
       
    31  */
       
    32 	{
       
    33 	}
       
    34 
       
    35 CCTSYIntegrationTestNetworkSecurityBase::~CCTSYIntegrationTestNetworkSecurityBase()
       
    36 /*
       
    37  * Destructor
       
    38  */
       
    39 	{
       
    40 	}
       
    41 	
       
    42 
       
    43 CCTSYIntegrationTestNetworkSecurity0001::CCTSYIntegrationTestNetworkSecurity0001(CEtelSessionMgr& aEtelSessionMgr)
       
    44 	: CCTSYIntegrationTestNetworkSecurityBase(aEtelSessionMgr)
       
    45 /**
       
    46  * Constructor.
       
    47  */
       
    48 	{
       
    49 	SetTestStepName(CCTSYIntegrationTestNetworkSecurity0001::GetTestStepName());
       
    50 	}
       
    51 
       
    52 CCTSYIntegrationTestNetworkSecurity0001::~CCTSYIntegrationTestNetworkSecurity0001()
       
    53 /**
       
    54  * Destructor.
       
    55  */
       
    56 	{
       
    57 	}
       
    58 
       
    59 TVerdict CCTSYIntegrationTestNetworkSecurity0001::doTestStepL()
       
    60 /**
       
    61  * @SYMTestCaseID BA-CTSY-INT-NTWS-0001
       
    62  * @SYMFssID BA/CTSY/NTWS-0001
       
    63  * @SYMTestCaseDesc Get the ciphering indicator status
       
    64  * @SYMTestPriority High
       
    65  * @SYMTestActions RCall::GetCipheringIndicatorStatus
       
    66  * @SYMTestExpectedResults Pass - Correct ciphering indicator status.
       
    67  * @SYMTestType CIT
       
    68  * @SYMTestCaseDependencies live/automatic
       
    69  *
       
    70  * Reason for test: Verify ciphering indicator status is correct
       
    71  *
       
    72  * @return - TVerdict code
       
    73  */
       
    74 	{
       
    75 
       
    76 	//
       
    77 	// SET UP
       
    78 	//
       
    79 
       
    80 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
    81 	
       
    82 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
    83 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
    84 	
       
    85 	//
       
    86 	// SET UP END
       
    87 	//
       
    88 	
       
    89 	StartTest();
       
    90 	
       
    91 	//
       
    92 	// TEST START
       
    93 	//
       
    94 		
       
    95 	// Check RMobilePhone::GetCipheringIndicatorStatus completes with aIndicatorStatus=ECipheringDisplayOn
       
    96 	TExtEtelRequestStatus getCipheringIndicatorStatusStatus(mobilePhone, EMobilePhoneGetCipheringIndicatorStatus);
       
    97 	RMobilePhone::TMobileCallCipheringIndicator callCipheringIndicator;
       
    98 	CleanupStack::PushL(getCipheringIndicatorStatusStatus);
       
    99 	
       
   100 	mobilePhone.GetCipheringIndicatorStatus(getCipheringIndicatorStatusStatus, callCipheringIndicator);
       
   101 	
       
   102 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getCipheringIndicatorStatusStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetCipheringIndicatorStatus timed-out"));
       
   103 	ASSERT_EQUALS(getCipheringIndicatorStatusStatus.Int(), KErrNone, _L("RMobilePhone::GetCipheringIndicatorStatus returned with an error"));
       
   104 	ASSERT_EQUALS(callCipheringIndicator, RMobilePhone::ECipheringDisplayOn, _L("RMobilePhone::GetCipheringIndicatorStatus returned with unexpected value"));
       
   105 			
       
   106 	//
       
   107 	// TEST END
       
   108 	//
       
   109 
       
   110     StartCleanup();
       
   111 	
       
   112 	CleanupStack::PopAndDestroy(&getCipheringIndicatorStatusStatus);
       
   113 	
       
   114 	return TestStepResult();
       
   115 	}
       
   116 
       
   117 TPtrC CCTSYIntegrationTestNetworkSecurity0001::GetTestStepName()
       
   118 /**
       
   119  * @return The test step name.
       
   120  */
       
   121 	{
       
   122 	return _L("CCTSYIntegrationTestNetworkSecurity0001");
       
   123 	}
       
   124 
       
   125 
       
   126 
       
   127 CCTSYIntegrationTestNetworkSecurity0002::CCTSYIntegrationTestNetworkSecurity0002(CEtelSessionMgr& aEtelSessionMgr)
       
   128 	: CCTSYIntegrationTestNetworkSecurityBase(aEtelSessionMgr)
       
   129 /**
       
   130  * Constructor.
       
   131  */
       
   132 	{
       
   133 	SetTestStepName(CCTSYIntegrationTestNetworkSecurity0002::GetTestStepName());
       
   134 	}
       
   135 
       
   136 CCTSYIntegrationTestNetworkSecurity0002::~CCTSYIntegrationTestNetworkSecurity0002()
       
   137 /**
       
   138  * Destructor.
       
   139  */
       
   140 	{
       
   141 	}
       
   142 
       
   143 TVerdict CCTSYIntegrationTestNetworkSecurity0002::doTestStepL()
       
   144 /**
       
   145  * @SYMTestCaseID BA-CTSY-INT-NTWS-0002
       
   146  * @SYMFssID BA/CTSY/NTWS-0002
       
   147  * @SYMTestCaseDesc Get network security notifications when moving from an 3G to 2G only cell.
       
   148  * @SYMTestPriority High
       
   149  * @SYMTestActions RMobilePhone::NotifyNetworkSecurityLevelChange
       
   150  * @SYMTestExpectedResults Pass - Network security notification completes.
       
   151  * @SYMTestType CIT
       
   152  * @SYMTestCaseDependencies simulated/manual
       
   153  *
       
   154  * Reason for test: Verify network security status notification completes.
       
   155  *
       
   156  * @return - TVerdict code
       
   157  */
       
   158 	{
       
   159 
       
   160 	//
       
   161 	// SET UP
       
   162 	//
       
   163 
       
   164 
       
   165 	// Ensure phone is camped on simulated 3G cell supporting ciphering.
       
   166 	DisplayUserInteractionPromptL(_L("Ensure phone is camped on simulated 3G cell supporting ciphering."), ETimeMedium);
       
   167 		
       
   168 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL	
       
   169 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   170 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
   171 
       
   172 	//
       
   173 	// SET UP END
       
   174 	//
       
   175 	
       
   176 	StartTest();
       
   177 	
       
   178 	//
       
   179 	// TEST START
       
   180 	//
       
   181 	
       
   182 	
       
   183 	// Check RMobilePhone::GetNetworkSecurityLevel returns aSecurity=ECipheringWCDMA
       
   184 	TExtEtelRequestStatus getNetworkSecurityLevelStatus(phone, EMobilePhoneGetNetworkSecurityLevel);
       
   185 	CleanupStack::PushL(getNetworkSecurityLevelStatus);
       
   186 	RMobilePhone::TMobilePhoneNetworkSecurity networkSecurity;
       
   187 	phone.GetNetworkSecurityLevel(getNetworkSecurityLevelStatus, networkSecurity);
       
   188 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkSecurityLevelStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetNetworkSecurityLevel timed out"));
       
   189 	ASSERT_EQUALS(getNetworkSecurityLevelStatus.Int(), KErrNone, _L("RMobilePhone::GetNetworkSecurityLevel returned an error"));
       
   190 	ASSERT_EQUALS(networkSecurity, RMobilePhone::ECipheringWCDMA, _L("RMobilePhone::GetNetworkSecurityLevel did not return ECipheringWCDMA as expected"));
       
   191 
       
   192     // post notify for networksecuritylevelchange
       
   193 	TExtEtelRequestStatus reqNotifyNetworkSecurityLevelChange(phone, EMobilePhoneNotifyNetworkSecurityLevelChange);
       
   194     CleanupStack::PushL(reqNotifyNetworkSecurityLevelChange);
       
   195     phone.NotifyNetworkSecurityLevelChange(reqNotifyNetworkSecurityLevelChange, networkSecurity);
       
   196 
       
   197 	// Simulate moving to a 2G only cell supporting ciphering 
       
   198 	DisplayUserInteractionPromptL(_L("Simulate moving to a 2G only cell supporting ciphering."), ETimeMedium);
       
   199 	
       
   200 	// Check RMobilePhone::NotifyNetworkSecurityLevelChange completes with aSecurity=ECipheringGSM
       
   201 	RMobilePhone::TMobilePhoneNetworkSecurity expectedNetworkSecurity = RMobilePhone::ECipheringGSM;
       
   202 	iNetworkTestHelper.WaitForMobilePhoneNotifyNetworkSecurityLevelChange(phone,
       
   203 														reqNotifyNetworkSecurityLevelChange,
       
   204 														networkSecurity,
       
   205 														expectedNetworkSecurity,
       
   206 														KErrNone);
       
   207 		
       
   208 	// Check RMobilePhone::GetNetworkSecurityLevel returns aSecurity=ECipheringGSM
       
   209 	phone.GetNetworkSecurityLevel(getNetworkSecurityLevelStatus, networkSecurity);
       
   210 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkSecurityLevelStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetNetworkSecurityLevel timed out"));
       
   211 	ASSERT_EQUALS(getNetworkSecurityLevelStatus.Int(), KErrNone, _L("RMobilePhone::GetNetworkSecurityLevel returned an error"));
       
   212 	ASSERT_EQUALS(networkSecurity, RMobilePhone::ECipheringGSM, _L("RMobilePhone::GetNetworkSecurityLevel did not return ECipheringGSM as expected"));
       
   213 
       
   214 	
       
   215 	//
       
   216 	// TEST END
       
   217 	//
       
   218 
       
   219     StartCleanup();
       
   220 	
       
   221 	// Pop
       
   222 	// getNetworkSecurityLevelStatus
       
   223 	// reqNotifyNetworkSecurityLevelChange
       
   224 	CleanupStack::PopAndDestroy(2, &getNetworkSecurityLevelStatus);
       
   225 	
       
   226 	return TestStepResult();
       
   227 	}
       
   228 
       
   229 TPtrC CCTSYIntegrationTestNetworkSecurity0002::GetTestStepName()
       
   230 /**
       
   231  * @return The test step name.
       
   232  */
       
   233 	{
       
   234 	return _L("CCTSYIntegrationTestNetworkSecurity0002");
       
   235 	}
       
   236 
       
   237 
       
   238