commsconfig/commsdatabaseshim/ts_commdb/step_006_xx.cpp
changeset 72 ae47d0499bee
parent 68 5da8188e392b
child 77 c9776eadbffd
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
     1 // Copyright (c) 2001-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 // This contains CommDb Unit Test Cases 006.01 - 006.05
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 
       
    22 
       
    23 // Test system includes
       
    24 #include <networking/log.h>
       
    25 #include <networking/teststep.h>
       
    26 #include "Teststepcommdb.h"
       
    27 #include "TestSuiteCommdb.h"
       
    28 #include "step_006_xx.h"
       
    29 
       
    30 
       
    31 
       
    32 //
       
    33 //	Test step 006.001
       
    34 //
       
    35 
       
    36 // constructor
       
    37 CCommDbTest006_01::CCommDbTest006_01()
       
    38 	{
       
    39 	// store the name of this test case
       
    40 	iTestStepName = _L("step_006_01");
       
    41 	}
       
    42 
       
    43 // destructor
       
    44 CCommDbTest006_01::~CCommDbTest006_01()
       
    45 	{
       
    46 	}
       
    47 
       
    48 TVerdict CCommDbTest006_01::doTestStepPreambleL()
       
    49 	{	
       
    50 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
    51 	return EPass;
       
    52 	}
       
    53 
       
    54 TInt CCommDbTest006_01::executeStepL()
       
    55 	{
       
    56 	TInt ret = iTheView->GotoFirstRecord(); 	
       
    57 	return ret;
       
    58 	}
       
    59 
       
    60 TVerdict CCommDbTest006_01::doTestStepL( )
       
    61 	{
       
    62 	Log(_L("Step 006.01 called "));
       
    63 
       
    64 	if ( executeStepL() == KErrNone )
       
    65 		iTestStepResult = EPass;
       
    66 	else
       
    67 		iTestStepResult = EFail;
       
    68 	
       
    69 	return iTestStepResult;
       
    70 	}
       
    71 
       
    72 
       
    73 //
       
    74 //	Test step 006.002
       
    75 //
       
    76 
       
    77 // constructor
       
    78 CCommDbTest006_02::CCommDbTest006_02()
       
    79 	{
       
    80 	// store the name of this test case
       
    81 	iTestStepName = _L("step_006_02");
       
    82 	// default to no local objects allocated
       
    83 	iLocalObjects = EFalse;
       
    84 	}
       
    85 
       
    86 // destructor
       
    87 CCommDbTest006_02::~CCommDbTest006_02()
       
    88 	{
       
    89 	}
       
    90 
       
    91 TVerdict CCommDbTest006_02::doTestStepPreambleL()
       
    92 	{	
       
    93 	openDbAndViewL(TPtrC(IAP));
       
    94 	return EPass;
       
    95 	}
       
    96 
       
    97 TInt CCommDbTest006_02::executeStepL()
       
    98 	{
       
    99 	TInt ret = iTheView->GotoFirstRecord(); 	
       
   100 	return ret;
       
   101 	}
       
   102 
       
   103 TVerdict CCommDbTest006_02::doTestStepL( )
       
   104 	{
       
   105 	Log(_L("Step 006.02 called "));
       
   106 	
       
   107 	if ( executeStepL() == KErrNotFound )
       
   108 		iTestStepResult = EPass;
       
   109 	else
       
   110 		iTestStepResult = EFail;
       
   111 	
       
   112 	return iTestStepResult;
       
   113 	}
       
   114 
       
   115 //
       
   116 //	Test step 006.003
       
   117 //
       
   118 
       
   119 // constructor
       
   120 CCommDbTest006_03::CCommDbTest006_03()
       
   121 	{
       
   122 	// store the name of this test case
       
   123 	iTestStepName = _L("step_006_03");
       
   124 	}
       
   125 
       
   126 // destructor
       
   127 CCommDbTest006_03::~CCommDbTest006_03()
       
   128 	{
       
   129 	}
       
   130 
       
   131 TVerdict CCommDbTest006_03::doTestStepPreambleL()
       
   132 	{
       
   133 	openDbAndViewL(TPtrC(DIAL_IN_ISP));
       
   134 	return EPass;
       
   135 	}
       
   136 
       
   137 TInt CCommDbTest006_03::executeStepL()
       
   138 	{
       
   139 	TInt ret = iTheView->GotoFirstRecord(); 	
       
   140 	return ret;
       
   141 	}
       
   142 
       
   143 TVerdict CCommDbTest006_03::doTestStepL( )
       
   144 	{
       
   145 	Log(_L("Step 006.03 called "));
       
   146 
       
   147 	if ( executeStepL() == KErrNotFound )
       
   148 		iTestStepResult = EPass;
       
   149 	else
       
   150 		iTestStepResult = EFail;
       
   151 	
       
   152 		
       
   153 	return iTestStepResult;
       
   154 	}
       
   155 
       
   156 
       
   157 //
       
   158 //	Test step 006.004
       
   159 //
       
   160 
       
   161 // constructor
       
   162 CCommDbTest006_04::CCommDbTest006_04()
       
   163 	{
       
   164 	// store the name of this test case
       
   165 	iTestStepName = _L("step_006_04");
       
   166 	// default to no local objects allocated
       
   167 	iLocalObjects = EFalse;
       
   168 	}
       
   169 
       
   170 // destructor
       
   171 CCommDbTest006_04::~CCommDbTest006_04()
       
   172 	{
       
   173 	}
       
   174 
       
   175 
       
   176 TVerdict CCommDbTest006_04::doTestStepPreambleL()
       
   177 	{	
       
   178 	openDbAndViewL(TPtrC(IAP));
       
   179 	return EPass;
       
   180 	}
       
   181 
       
   182 
       
   183 TInt CCommDbTest006_04::executeStepL()
       
   184 	{
       
   185 	TInt ret = iTheView->GotoFirstRecord(); 	
       
   186 	return ret;
       
   187 	}
       
   188 
       
   189 TVerdict CCommDbTest006_04::doTestStepL( )
       
   190 	{
       
   191 	Log(_L("Step 006.04 called "));
       
   192 	
       
   193 	if ( executeStepL() == KErrNotFound )
       
   194 		iTestStepResult = EPass;
       
   195 	else
       
   196 		iTestStepResult = EFail;
       
   197 	
       
   198 	return iTestStepResult;
       
   199 	}
       
   200 
       
   201 
       
   202 //
       
   203 //	Test step 006.005
       
   204 //
       
   205 
       
   206 // constructor
       
   207 CCommDbTest006_05::CCommDbTest006_05()
       
   208 	{
       
   209 	// store the name of this test case
       
   210 	iTestStepName = _L("step_006_05");
       
   211 	}
       
   212 
       
   213 // destructor
       
   214 CCommDbTest006_05::~CCommDbTest006_05()
       
   215 	{
       
   216 	}
       
   217 
       
   218 
       
   219 TVerdict CCommDbTest006_05::doTestStepL( )
       
   220 	{
       
   221 	Log(_L("Step 006.04 called "));
       
   222 	
       
   223 	iTestStepResult = EPass;
       
   224 
       
   225 	//Heap test for 006.01
       
   226 	CCommDbTest006_01* step006_01 = new CCommDbTest006_01;
       
   227 	CleanupStack::PushL(step006_01);
       
   228 	step006_01->iSuite = iSuite;				
       
   229 	doTestStepWithHeapFailureL( *step006_01, KErrNone);
       
   230 	if( step006_01->iTestStepResult == EFail )
       
   231 		iTestStepResult = EFail;
       
   232 	CleanupStack::PopAndDestroy(step006_01);
       
   233 		
       
   234 	//Heap test for 006.02
       
   235 	
       
   236 	CCommDbTest006_02* step006_02 = new CCommDbTest006_02;
       
   237 	CleanupStack::PushL(step006_02);
       
   238 	step006_02->iSuite = iSuite;				
       
   239 	doTestStepWithHeapFailureL( *step006_02, KErrNotFound);
       
   240 	if( step006_02->iTestStepResult == EFail )
       
   241 		iTestStepResult = EFail;
       
   242 	CleanupStack::PopAndDestroy(step006_02);
       
   243 
       
   244 
       
   245 	
       
   246 	//Heap test for 006.03
       
   247 // it is not possible to copy database files, so this tests couldn't run 
       
   248 // with proper conditions(database)
       
   249 	//Heap test for 006.04
       
   250 	CCommDbTest006_04* step006_04 = new CCommDbTest006_04;
       
   251 	CleanupStack::PushL(step006_04);
       
   252 	step006_04->iSuite = iSuite;				
       
   253 	doTestStepWithHeapFailureL( *step006_04, KErrNotFound);
       
   254 	if( step006_04->iTestStepResult == EFail )
       
   255 		iTestStepResult = EFail;
       
   256 	CleanupStack::PopAndDestroy(step006_04);
       
   257 
       
   258 
       
   259 	return iTestStepResult;
       
   260 	}