commsconfig/commsdatabaseshim/TE_commdb/src/Step_008_xx.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 //
       
    16 //
       
    17 //
       
    18 // This contains CommDb Unit Test Cases 008.XX
       
    19 
       
    20 // EPOC includes
       
    21 #include <e32base.h>
       
    22 #include <commdb.h>
       
    23 
       
    24 
       
    25 // Test system includes
       
    26 #include "Teststepcommdb.h"
       
    27 #include "Step_008_xx.h"
       
    28 
       
    29 
       
    30 
       
    31 /////////////////////
       
    32 //	Test step 008.001
       
    33 /////////////////////
       
    34 
       
    35 // constructor
       
    36 CCommDbTest008_01::CCommDbTest008_01()
       
    37 	{
       
    38 	// store the name of this test case
       
    39 	SetTestStepName(_L("step_008_01"));
       
    40 
       
    41 	}
       
    42 
       
    43 // destructor
       
    44 CCommDbTest008_01::~CCommDbTest008_01()
       
    45 	{
       
    46 	}
       
    47 
       
    48 TVerdict CCommDbTest008_01::doTestStepPreambleL()
       
    49 	{	
       
    50 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
    51         SetTestStepResult(EPass);	return TestStepResult();
       
    52 	}
       
    53 
       
    54 
       
    55 TInt CCommDbTest008_01::executeStepL()
       
    56 	{
       
    57 	TInt ret=KErrGeneral;
       
    58 	TUint32 id=0;
       
    59 
       
    60 	//Try to insert a record
       
    61 	TRAPD(r, ret = iTheView->InsertRecord( id ) );
       
    62 
       
    63 	//if we leave, return the leave value
       
    64 	if ( r!= KErrNone )
       
    65 		{
       
    66 		ret = r;
       
    67 		}
       
    68 		
       
    69 	return ret;
       
    70 	}
       
    71 
       
    72 
       
    73 TVerdict CCommDbTest008_01::doTestStepL( )
       
    74 	{
       
    75 	INFO_PRINTF1(_L("Step 008.01 called "));
       
    76 
       
    77 	
       
    78 	if ( executeStepL() == KErrNone )
       
    79 		SetTestStepResult(EPass);	else
       
    80 		SetTestStepResult(EFail);
       
    81 
       
    82 	return TestStepResult();
       
    83 	}
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 /////////////////////
       
    89 //	Test step 008.02
       
    90 /////////////////////
       
    91 
       
    92 // constructor
       
    93 CCommDbTest008_02::CCommDbTest008_02()
       
    94 	{
       
    95 	// store the name of this test case
       
    96 	SetTestStepName(_L("step_008_02"));
       
    97 	}
       
    98 
       
    99 // destructor
       
   100 CCommDbTest008_02::~CCommDbTest008_02()
       
   101 	{
       
   102 	}
       
   103 
       
   104 TVerdict CCommDbTest008_02::doTestStepL( )
       
   105 	{
       
   106 	INFO_PRINTF1(_L("Step 008.02 called "));
       
   107 
       
   108 	SetTestStepResult(EPass);
       
   109 	// Heap test for 008.01
       
   110 
       
   111 	CCommDbTest008_01* step008_01 = new(ELeave) CCommDbTest008_01;
       
   112 	CleanupStack::PushL(step008_01);
       
   113 	doTestStepWithHeapFailureL( *step008_01, KErrNone);
       
   114 	if ( step008_01->TestStepResult() == EFail )
       
   115 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step008_01);
       
   116 
       
   117 	return TestStepResult();
       
   118 
       
   119 	}
       
   120 
       
   121 /////////////////////
       
   122 //	Test step 008.003
       
   123 /////////////////////
       
   124 
       
   125 // constructor
       
   126 CCommDbTest008_03::CCommDbTest008_03()
       
   127 	{
       
   128 	// store the name of this test case
       
   129 	SetTestStepName(_L("step_008_03"));
       
   130 
       
   131 	}
       
   132 
       
   133 // destructor
       
   134 CCommDbTest008_03::~CCommDbTest008_03()
       
   135 	{
       
   136 	}
       
   137 
       
   138 TVerdict CCommDbTest008_03::doTestStepPreambleL()
       
   139 	{	
       
   140 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   141         SetTestStepResult(EPass);	return TestStepResult();
       
   142 	}
       
   143 
       
   144 
       
   145 TInt CCommDbTest008_03::executeStepL()
       
   146 	{
       
   147 	TInt ret=KErrGeneral;
       
   148 	TUint32 id=0;
       
   149 
       
   150 	//Position at record to copy
       
   151 	ret=iTheView->GotoFirstRecord();
       
   152 	if(ret != KErrNone)
       
   153 		{return ret;}
       
   154 
       
   155 	//Try to insert a copy of the first record
       
   156 	ret = iTheView->InsertCopyRecord(id);
       
   157 
       
   158 	return ret;
       
   159 	}
       
   160 
       
   161 TVerdict CCommDbTest008_03::doTestStepL( )
       
   162 	{
       
   163 	INFO_PRINTF1(_L("Step 008.03 called "));
       
   164 
       
   165 	
       
   166 	if ( executeStepL() == KErrNone )
       
   167 		SetTestStepResult(EPass);	else
       
   168 		SetTestStepResult(EFail);
       
   169 
       
   170 	return TestStepResult();
       
   171 	}
       
   172 
       
   173 /////////////////////
       
   174 //	Test step 008.04
       
   175 /////////////////////
       
   176 
       
   177 // constructor
       
   178 CCommDbTest008_04::CCommDbTest008_04()
       
   179 	{
       
   180 	// store the name of this test case
       
   181 	SetTestStepName(_L("step_008_04"));
       
   182 	}
       
   183 
       
   184 // destructor
       
   185 CCommDbTest008_04::~CCommDbTest008_04()
       
   186 	{
       
   187 	}
       
   188 
       
   189 TVerdict CCommDbTest008_04::doTestStepL( )
       
   190 	{
       
   191 	INFO_PRINTF1(_L("Step 008.04 called "));
       
   192 
       
   193 	SetTestStepResult(EPass);
       
   194 	// Heap test for 008.01
       
   195 
       
   196 	CCommDbTest008_03* step008_03 = new(ELeave) CCommDbTest008_03;
       
   197 	CleanupStack::PushL(step008_03);
       
   198 	doTestStepWithHeapFailureL( *step008_03, KErrNone);
       
   199 	if ( step008_03->TestStepResult() == EFail )
       
   200 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step008_03);
       
   201 
       
   202 	return TestStepResult();
       
   203 
       
   204 	}