commsconfig/commsdatabaseshim/ts_commdb/Step_008_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 008.XX
       
    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_008_xx.h"
       
    29 
       
    30 
       
    31 
       
    32 //
       
    33 //	Test step 008.001
       
    34 //
       
    35 
       
    36 // constructor
       
    37 CCommDbTest008_01::CCommDbTest008_01()
       
    38 	{
       
    39 	// store the name of this test case
       
    40 	iTestStepName = _L("step_008_01");
       
    41 
       
    42 	}
       
    43 
       
    44 // destructor
       
    45 CCommDbTest008_01::~CCommDbTest008_01()
       
    46 	{
       
    47 	}
       
    48 
       
    49 TVerdict CCommDbTest008_01::doTestStepPreambleL()
       
    50 	{	
       
    51 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
    52 	return EPass;
       
    53 	}
       
    54 
       
    55 
       
    56 TInt CCommDbTest008_01::executeStepL()
       
    57 	{
       
    58 	TInt ret=KErrGeneral;
       
    59 	TUint32 id=0;
       
    60 
       
    61 	//Try to insert a record
       
    62 	TRAPD(r, ret = iTheView->InsertRecord( id ) );
       
    63 
       
    64 	//if we leave, return the leave value
       
    65 	if ( r!= KErrNone )
       
    66 		{
       
    67 		ret = r;
       
    68 		}
       
    69 		
       
    70 	return ret;
       
    71 	}
       
    72 
       
    73 
       
    74 TVerdict CCommDbTest008_01::doTestStepL( )
       
    75 	{
       
    76 	Log(_L("Step 008.01 called "));
       
    77 
       
    78 	
       
    79 	if ( executeStepL() == KErrNone )
       
    80 		iTestStepResult = EPass;
       
    81 	else
       
    82 		iTestStepResult = EFail;
       
    83 
       
    84 
       
    85 	return iTestStepResult;
       
    86 	}
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 //
       
    92 //	Test step 008.02
       
    93 //
       
    94 
       
    95 // constructor
       
    96 CCommDbTest008_02::CCommDbTest008_02()
       
    97 	{
       
    98 	// store the name of this test case
       
    99 	iTestStepName = _L("step_008_02");
       
   100 	}
       
   101 
       
   102 // destructor
       
   103 CCommDbTest008_02::~CCommDbTest008_02()
       
   104 	{
       
   105 	}
       
   106 
       
   107 TVerdict CCommDbTest008_02::doTestStepL( )
       
   108 	{
       
   109 	Log(_L("Step 008.02 called "));
       
   110 
       
   111 	iTestStepResult = EPass;
       
   112 
       
   113 	// Heap test for 008.01
       
   114 
       
   115 	CCommDbTest008_01* step008_01 = new(ELeave) CCommDbTest008_01;
       
   116 	CleanupStack::PushL(step008_01);
       
   117 	step008_01->iSuite = iSuite;
       
   118 	doTestStepWithHeapFailureL( *step008_01, KErrNone);
       
   119 	if ( step008_01->iTestStepResult == EFail )
       
   120 		iTestStepResult = EFail;
       
   121 	CleanupStack::PopAndDestroy(step008_01);
       
   122 
       
   123 	return iTestStepResult;
       
   124 
       
   125 	}
       
   126 
       
   127 //
       
   128 //	Test step 008.003
       
   129 //
       
   130 
       
   131 // constructor
       
   132 CCommDbTest008_03::CCommDbTest008_03()
       
   133 	{
       
   134 	// store the name of this test case
       
   135 	iTestStepName = _L("step_008_03");
       
   136 
       
   137 	}
       
   138 
       
   139 // destructor
       
   140 CCommDbTest008_03::~CCommDbTest008_03()
       
   141 	{
       
   142 	}
       
   143 
       
   144 TVerdict CCommDbTest008_03::doTestStepPreambleL()
       
   145 	{	
       
   146 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   147 	return EPass;
       
   148 	}
       
   149 
       
   150 
       
   151 TInt CCommDbTest008_03::executeStepL()
       
   152 	{
       
   153 	TInt ret=KErrGeneral;
       
   154 	TUint32 id=0;
       
   155 
       
   156 	//Position at record to copy
       
   157 	ret=iTheView->GotoFirstRecord();
       
   158 	if(ret != KErrNone)
       
   159 		{return ret;}
       
   160 
       
   161 	//Try to insert a copy of the first record
       
   162 	ret = iTheView->InsertCopyRecord(id);
       
   163 
       
   164 	return ret;
       
   165 	}
       
   166 
       
   167 TVerdict CCommDbTest008_03::doTestStepL( )
       
   168 	{
       
   169 	Log(_L("Step 008.03 called "));
       
   170 
       
   171 	
       
   172 	if ( executeStepL() == KErrNone )
       
   173 		iTestStepResult = EPass;
       
   174 	else
       
   175 		iTestStepResult = EFail;
       
   176 
       
   177 
       
   178 	return iTestStepResult;
       
   179 	}
       
   180 
       
   181 //
       
   182 //	Test step 008.04
       
   183 //
       
   184 
       
   185 // constructor
       
   186 CCommDbTest008_04::CCommDbTest008_04()
       
   187 	{
       
   188 	// store the name of this test case
       
   189 	iTestStepName = _L("step_008_04");
       
   190 	}
       
   191 
       
   192 // destructor
       
   193 CCommDbTest008_04::~CCommDbTest008_04()
       
   194 	{
       
   195 	}
       
   196 
       
   197 TVerdict CCommDbTest008_04::doTestStepL( )
       
   198 	{
       
   199 	Log(_L("Step 008.04 called "));
       
   200 
       
   201 	iTestStepResult = EPass;
       
   202 
       
   203 	// Heap test for 008.01
       
   204 
       
   205 	CCommDbTest008_03* step008_03 = new(ELeave) CCommDbTest008_03;
       
   206 	CleanupStack::PushL(step008_03);
       
   207 	step008_03->iSuite = iSuite;
       
   208 	doTestStepWithHeapFailureL( *step008_03, KErrNone);
       
   209 	if ( step008_03->iTestStepResult == EFail )
       
   210 		iTestStepResult = EFail;
       
   211 	CleanupStack::PopAndDestroy(step008_03);
       
   212 
       
   213 	return iTestStepResult;
       
   214 
       
   215 	}