commsconfig/commsdatabaseshim/TE_commdb/src/Step_023_xx.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 // step_023_XX.cpp
       
     2 //
       
     3 //
       
     4 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     5 // All rights reserved.
       
     6 // This component and the accompanying materials are made available
       
     7 // under the terms of "Eclipse Public License v1.0"
       
     8 // which accompanies this distribution, and is available
       
     9 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 //
       
    11 // Initial Contributors:
       
    12 // Nokia Corporation - initial contribution.
       
    13 //
       
    14 // Contributors:
       
    15 //
       
    16 // Description:
       
    17 //
       
    18 //
       
    19 //
       
    20 // This contains CommDb Unit Test Cases 023.XX
       
    21 
       
    22 // EPOC includes
       
    23 #include <e32base.h>
       
    24 #include <commdb.h>
       
    25 #include <d32comm.h>
       
    26 
       
    27 // Test system includes
       
    28 #include "Teststepcommdb.h"
       
    29 #include "Step_023_xx.h"
       
    30 
       
    31 
       
    32 /////////////////////
       
    33 //	Test step 023.01
       
    34 /////////////////////
       
    35 
       
    36 // constructor
       
    37 CCommDbTest023_01::CCommDbTest023_01()
       
    38 	{
       
    39 	// store the name of this test case
       
    40 	SetTestStepName(_L("step_023_01"));
       
    41 	}
       
    42 
       
    43 // destructor
       
    44 CCommDbTest023_01::~CCommDbTest023_01()
       
    45 	{
       
    46 	}
       
    47 
       
    48 
       
    49 TVerdict CCommDbTest023_01::doTestStepPreambleL()
       
    50 	{	
       
    51 	// Have a temp copy of database
       
    52 	openDbL();
       
    53         SetTestStepResult(EPass);	return TestStepResult();
       
    54 	}
       
    55 
       
    56 TInt CCommDbTest023_01::executeStepL()
       
    57 	{
       
    58 	TInt ret=KErrGeneral;
       
    59 
       
    60 	iTheView = iTheDb->OpenViewOnProxyRecordLC(1, TPtrC(DIAL_OUT_ISP) );
       
    61 	CleanupStack::Pop();
       
    62 	TUint32 value;
       
    63 
       
    64 	//Check the view contains the expected records
       
    65 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone);
       
    66 	iTheView->ReadUintL(TPtrC(PROXY_ISP), value);
       
    67 
       
    68 	CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound );
       
    69 
       
    70 	ret = KErrNone;
       
    71 	
       
    72 	return ret;
       
    73 	}
       
    74 
       
    75 
       
    76 TVerdict CCommDbTest023_01::doTestStepL( )
       
    77 	{
       
    78 	INFO_PRINTF1(_L("Step 023.01 called "));
       
    79 
       
    80 
       
    81 	if ( executeStepL() == KErrNone )
       
    82 		SetTestStepResult(EPass);	else
       
    83 		SetTestStepResult(EFail);
       
    84 	return TestStepResult();
       
    85 	}
       
    86 
       
    87 
       
    88 
       
    89 /////////////////////
       
    90 //	Test step 023.02
       
    91 /////////////////////
       
    92 
       
    93 // constructor
       
    94 CCommDbTest023_02::CCommDbTest023_02()
       
    95 	{
       
    96 	// store the name of this test case
       
    97 	SetTestStepName(_L("step_023_02"));
       
    98 	}
       
    99 
       
   100 // destructor
       
   101 CCommDbTest023_02::~CCommDbTest023_02()
       
   102 	{
       
   103 	}
       
   104 
       
   105 
       
   106 TVerdict CCommDbTest023_02::doTestStepPreambleL()
       
   107 	{	
       
   108 	openDbL();
       
   109         SetTestStepResult(EPass);	return TestStepResult();
       
   110 	}
       
   111 
       
   112 TInt CCommDbTest023_02::executeStepL()
       
   113 	{
       
   114 	TInt ret=KErrGeneral;
       
   115 
       
   116 	iTheView = iTheDb->OpenViewOnProxyRecordLC(99, TPtrC(DIAL_OUT_ISP) );
       
   117 	CleanupStack::Pop();
       
   118 
       
   119 	//The view should be empty
       
   120 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound);
       
   121 
       
   122 	ret = KErrNone;
       
   123 	
       
   124 	return ret;
       
   125 	}
       
   126 
       
   127 
       
   128 TVerdict CCommDbTest023_02::doTestStepL( )
       
   129 	{
       
   130 	INFO_PRINTF1(_L("Step 023.02 called "));
       
   131 
       
   132 
       
   133 	if ( executeStepL() == KErrNone )
       
   134 		SetTestStepResult(EPass);	else
       
   135 		SetTestStepResult(EFail);
       
   136 	return TestStepResult();
       
   137 	}
       
   138 
       
   139 
       
   140 /////////////////////
       
   141 //	Test step 023.03
       
   142 /////////////////////
       
   143 
       
   144 // constructor
       
   145 CCommDbTest023_03::CCommDbTest023_03()
       
   146 	{
       
   147 	// store the name of this test case
       
   148 	SetTestStepName(_L("step_023_03"));
       
   149 	}
       
   150 
       
   151 // destructor
       
   152 CCommDbTest023_03::~CCommDbTest023_03()
       
   153 	{
       
   154 	}
       
   155 
       
   156 
       
   157 TVerdict CCommDbTest023_03::doTestStepPreambleL()
       
   158 	{	
       
   159 	openDbL();
       
   160         SetTestStepResult(EPass);	return TestStepResult();
       
   161 	}
       
   162 
       
   163 
       
   164 #define INVALID_TABLE	_L("Invalid")
       
   165 
       
   166 TInt CCommDbTest023_03::executeStepL()
       
   167 	{
       
   168 	TInt ret=KErrGeneral;
       
   169 
       
   170 
       
   171 	iTheView = iTheDb->OpenViewOnProxyRecordLC(1, TPtrC(INVALID_TABLE) );
       
   172 	CleanupStack::Pop();
       
   173 	
       
   174 	//It should be an empty view
       
   175 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound );
       
   176 
       
   177 	ret = KErrNone;
       
   178 
       
   179 	return ret;
       
   180 	}
       
   181 
       
   182 
       
   183 TVerdict CCommDbTest023_03::doTestStepL( )
       
   184 	{
       
   185 	INFO_PRINTF1(_L("Step 023.03 called "));
       
   186 
       
   187 
       
   188 	if ( executeStepL() == KErrNone )
       
   189 		SetTestStepResult(EPass);	else
       
   190 		SetTestStepResult(EFail);
       
   191 	return TestStepResult();
       
   192 	}
       
   193 
       
   194 
       
   195 
       
   196 /////////////////////
       
   197 //	Test step 023.04
       
   198 /////////////////////
       
   199 
       
   200 // constructor
       
   201 CCommDbTest023_04::CCommDbTest023_04()
       
   202 	{
       
   203 	// store the name of this test case
       
   204 	SetTestStepName(_L("step_023_04"));
       
   205 	}
       
   206 
       
   207 // destructor
       
   208 CCommDbTest023_04::~CCommDbTest023_04()
       
   209 	{
       
   210 	}
       
   211 
       
   212 TVerdict CCommDbTest023_04::doTestStepL( )
       
   213 	{
       
   214 	INFO_PRINTF1(_L("Step 023.04 called "));
       
   215 
       
   216 	SetTestStepResult(EPass);
       
   217 		// Heap test for 023.01
       
   218 
       
   219 	CCommDbTest023_01* step023_01 = new(ELeave) CCommDbTest023_01;
       
   220 	CleanupStack::PushL(step023_01);
       
   221 	if ( doTestStepWithHeapFailureL( *step023_01, KErrNone) == EFail )
       
   222 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step023_01);
       
   223 
       
   224 
       
   225 	return TestStepResult();	
       
   226 
       
   227 }
       
   228 
       
   229 
       
   230 /////////////////////
       
   231 //	Test step 023.05
       
   232 /////////////////////
       
   233 
       
   234 // constructor
       
   235 CCommDbTest023_05::CCommDbTest023_05()
       
   236 	{
       
   237 	// store the name of this test case
       
   238 	SetTestStepName(_L("step_023_05"));
       
   239 	}
       
   240 
       
   241 // destructor
       
   242 CCommDbTest023_05::~CCommDbTest023_05()
       
   243 	{
       
   244 	}
       
   245 
       
   246 TVerdict CCommDbTest023_05::doTestStepL( )
       
   247 	{
       
   248 	INFO_PRINTF1(_L("Step 023.05 called "));
       
   249 
       
   250 	SetTestStepResult(EPass);	
       
   251 			// Heap test for 023.02
       
   252 
       
   253 	CCommDbTest023_02* step023_02 = new CCommDbTest023_02;
       
   254 	CleanupStack::PushL(step023_02);
       
   255 	if ( doTestStepWithHeapFailureL( *step023_02, KErrNone) == EFail ) 
       
   256 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step023_02);
       
   257 	
       
   258 	return TestStepResult();
       
   259 	}
       
   260 	
       
   261 /////////////////////
       
   262 //	Test step 023.06
       
   263 /////////////////////
       
   264 
       
   265 // constructor
       
   266 CCommDbTest023_06::CCommDbTest023_06()
       
   267 	{
       
   268 	// store the name of this test case
       
   269 	SetTestStepName(_L("step_023_06"));
       
   270 	}
       
   271 
       
   272 // destructor
       
   273 CCommDbTest023_06::~CCommDbTest023_06()
       
   274 	{
       
   275 	}
       
   276 
       
   277 TVerdict CCommDbTest023_06::doTestStepL( )
       
   278 	{
       
   279 	INFO_PRINTF1(_L("Step 023.06 called "));
       
   280 
       
   281 	SetTestStepResult(EPass);	
       
   282 		// Heap test for 023.03
       
   283 
       
   284 	CCommDbTest023_03* step023_03 = new CCommDbTest023_03;
       
   285 	CleanupStack::PushL(step023_03);
       
   286 	if ( doTestStepWithHeapFailureL( *step023_03, KErrNone) == EFail )
       
   287 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step023_03);
       
   288 	
       
   289 	return TestStepResult();
       
   290 	}
       
   291 
       
   292 //EOF