datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
branchRCL_3
changeset 13 0b0e9fce0b58
parent 0 dfb7c4ff071f
child 15 51722b10598b
equal deleted inserted replaced
12:8b5d60ce1e94 13:0b0e9fce0b58
   166 	iParams.iStartWithOldPreferences = IAPpresent;
   166 	iParams.iStartWithOldPreferences = IAPpresent;
   167 	iParams.iStartWithSnapPreferences = SNAPpresent;
   167 	iParams.iStartWithSnapPreferences = SNAPpresent;
   168 	iParams.iStartWithConPrefList = ConnPrefPresent;
   168 	iParams.iStartWithConPrefList = ConnPrefPresent;
   169 	iParams.iStartWithDummy = DummyPresent;
   169 	iParams.iStartWithDummy = DummyPresent;
   170 	iParams.iAsynch = AsynchPresent;
   170 	iParams.iAsynch = AsynchPresent;
   171 	
   171 
   172 	GetBoolFromConfig(iSection, KTe_AutoStartPrefName, iParams.iStartAuto);
   172 	GetBoolFromConfig(iSection, KTe_AutoStartPrefName, iParams.iStartAuto);
   173 
   173 
   174 	if (iParams.iStartWithOldPreferences && iParams.iStartWithSnapPreferences)
   174 	if (iParams.iStartWithOldPreferences && iParams.iStartWithSnapPreferences)
   175 		{
   175 		{
   176 		INFO_PRINTF2(_L("Connection preferences for (%S) have both snap and IAP."),&iParams.iConnectionName);
   176 		INFO_PRINTF2(_L("Connection preferences for (%S) have both snap and IAP."),&iParams.iConnectionName);
   642     }
   642     }
   643 
   643 
   644 TVerdict CAwaitRConnectionStartComplete::doSingleTestStep()
   644 TVerdict CAwaitRConnectionStartComplete::doSingleTestStep()
   645 	{
   645 	{
   646     INFO_PRINTF2(_L("Awaiting Connection (%S) to start."),&iParams.iConnectionName);
   646     INFO_PRINTF2(_L("Awaiting Connection (%S) to start."),&iParams.iConnectionName);
   647     TInt error = iEsockTest->AwaitRequestStatus(iParams.iConnectionName); 
   647     TInt error = iEsockTest->AwaitRequestStatus(iParams.iConnectionName);
   648 	if ( error == iExpectedError)
   648 	if ( error == iExpectedError)
   649 		{
   649 		{
   650         INFO_PRINTF3(_L("Connection (%S) start completed as expected (%d)"),&iParams.iConnectionName, error);		
   650         INFO_PRINTF3(_L("Connection (%S) start completed as expected (%d)"),&iParams.iConnectionName, error);
   651 		return EPass;
   651 		return EPass;
   652 		}
   652 		}
   653     INFO_PRINTF4(_L("Connection (%S) start completed with (%d), which is different to expected (%d)"),&iParams.iConnectionName, error, iExpectedError);	
   653     INFO_PRINTF4(_L("Connection (%S) start completed with (%d), which is different to expected (%d)"),&iParams.iConnectionName, error, iExpectedError);
   654 	return EFail;
   654 	return EFail;
   655     }
   655     }
   656 
   656 
   657 // Attach to connection
   657 // Attach to connection
   658 //---------------------
   658 //---------------------
   834 			return KErrNotFound;
   834 			return KErrNotFound;
   835 			}
   835 			}
   836 
   836 
   837 	if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarValue,iValue))
   837 	if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarValue,iValue))
   838 			{
   838 			{
   839 			INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file"));
   839 			INFO_PRINTF1(_L("Couldn't find appropriate Value field in config file"));
   840 			return KErrNotFound;
   840 			return KErrNotFound;
   841 			}
   841 			}
   842 
   842 
       
   843 	if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarKey,iKey))
       
   844 			{
       
   845 			// The key field was added at a later date, report but don't error.
       
   846 			INFO_PRINTF1(_L("Couldn't find appropriate Key field in config file, defaulting to 0"));
       
   847 			}
       
   848 
   843     return KErrNone;
   849     return KErrNone;
   844 	}
   850 	}
   845 
   851 
   846 TVerdict CCreatePublishSubscribeVar::doTestStepPreambleL()
   852 TVerdict CCreatePublishSubscribeVar::doTestStepPreambleL()
   847 	{
   853 	{
   849 	}
   855 	}
   850 
   856 
   851 TVerdict CCreatePublishSubscribeVar::doSingleTestStep()
   857 TVerdict CCreatePublishSubscribeVar::doSingleTestStep()
   852 	{
   858 	{
   853 	RProperty property;
   859 	RProperty property;
   854 	TInt result = property.Define(TUid::Uid(iUid),0,RProperty::EInt);
   860 	TInt result = property.Define(TUid::Uid(iUid),iKey,RProperty::EInt);
   855 	result = property.Attach(TUid::Uid(iUid), 0);
   861 	result = property.Attach(TUid::Uid(iUid), iKey);
   856 	if(result == KErrNone)
   862 	if(result == KErrNone)
   857 		{
   863 		{
   858 		result = property.Set(iValue);
   864 		result = property.Set(iValue);
   859 		if(result == KErrNone)
   865 		if(result == KErrNone)
   860 			return EPass;
   866 			return EPass;
   887 		{
   893 		{
   888 		INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file"));
   894 		INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file"));
   889 		return KErrNotFound;
   895 		return KErrNotFound;
   890 		}
   896 		}
   891 
   897 
       
   898 	if (!GetIntFromConfig(iSection,KTe_CheckPublishSubscribeVarKey,iKey))
       
   899 		{
       
   900 		// The key field was added at a later date, report but don't error.
       
   901 		INFO_PRINTF1(_L("Couldn't find appropriate Key field in config file, defaulting to 0"));
       
   902 		}
       
   903 
   892 	return KErrNone;
   904 	return KErrNone;
   893 	}
   905 	}
   894 
   906 
   895 TVerdict CCheckPublishSubscribeVar::doTestStepPreambleL()
   907 TVerdict CCheckPublishSubscribeVar::doTestStepPreambleL()
   896 	{
   908 	{
   898 	}
   910 	}
   899 
   911 
   900 TVerdict CCheckPublishSubscribeVar::doSingleTestStep()
   912 TVerdict CCheckPublishSubscribeVar::doSingleTestStep()
   901 	{
   913 	{
   902 	RProperty property;
   914 	RProperty property;
   903 	TInt result = property.Attach(TUid::Uid(iUid), 0);
   915 	TInt result = property.Attach(TUid::Uid(iUid), iKey);
   904 	if(result == KErrNone)
   916 	if(result == KErrNone)
   905 		{
   917 		{
   906 		TInt existingValue;
   918 		TInt existingValue;
   907 		result = property.Get(TUid::Uid(iUid), 0, existingValue);
   919 		result = property.Get(TUid::Uid(iUid), iKey, existingValue);
   908 		if(result == KErrNone && iValue == existingValue)
   920 		if(result == KErrNone && iValue == existingValue)
   909 			return EPass;
   921 			return EPass;
   910 		}
   922 		}
   911 	return EFail;
   923 	return EFail;
   912 	}
   924 	}
  1117 
  1129 
  1118 	if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError))
  1130 	if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError))
  1119 		{
  1131 		{
  1120 		iExpectedError = KExpectedErrorNotUsed;
  1132 		iExpectedError = KExpectedErrorNotUsed;
  1121 		}
  1133 		}
  1122 	
  1134 
  1123     // Get any timeout value and if we have one then we are not expecting any notification
  1135     // Get any timeout value and if we have one then we are not expecting any notification
  1124     if(!GetIntFromConfig(iSection, KTimeoutInMilliSeconds, iParams.iTimeoutMiliSecs))
  1136     if(!GetIntFromConfig(iSection, KTimeoutInMilliSeconds, iParams.iTimeoutMiliSecs))
  1125         {
  1137         {
  1126         // Default to 5 second timeout
  1138         // Default to 5 second timeout
  1127         iParams.iTimeoutMiliSecs = 5000; 
  1139         iParams.iTimeoutMiliSecs = 5000;
  1128         }
  1140         }
  1129 
  1141 
  1130 	if (iExpectedError != KExpectedErrorNotUsed)
  1142 	if (iExpectedError != KExpectedErrorNotUsed)
  1131 		{
  1143 		{
  1132 			INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError);
  1144 			INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError);
  1143 	TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName, iParams.iTimeoutMiliSecs);
  1155 	TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName, iParams.iTimeoutMiliSecs);
  1144 
  1156 
  1145 	if (event == NULL || err == KErrNone)
  1157 	if (event == NULL || err == KErrNone)
  1146 		{
  1158 		{
  1147 		INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName);
  1159 		INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName);
  1148 		
  1160 
  1149 		return EPass;
  1161 		return EPass;
  1150 		}
  1162 		}
  1151 		else if (event == NULL || err != KErrNone)
  1163 		else if (event == NULL || err != KErrNone)
  1152 		{
  1164 		{
  1153 		INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);
  1165 		INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);