commsconfig/commsdatabaseshim/ts_commdb/Step_035_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 035.XX
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 #include <d32comm.h>
       
    22 #include <cdbtemp.h>
       
    23 
       
    24 // Test system includes
       
    25 #include <networking/log.h>
       
    26 #include <networking/teststep.h>
       
    27 #include "Teststepcommdb.h"
       
    28 #include "TestSuiteCommdb.h"
       
    29 #include "Step_035_xx.h"
       
    30 
       
    31 
       
    32 CCommDbTest035_01::CCommDbTest035_01()
       
    33 	{
       
    34 	// store the name of this test case
       
    35 	iTestStepName = _L("step_035_01");
       
    36 	}
       
    37 
       
    38 CCommDbTest035_01::~CCommDbTest035_01()
       
    39 	{}
       
    40 
       
    41 TVerdict CCommDbTest035_01::doTestStepL( void )
       
    42 	{
       
    43 	executeStepL();
       
    44 	return EPass;	//If we've got this far we've passed
       
    45 	}
       
    46 
       
    47 TVerdict CCommDbTest035_01::doTestStepPreambleL()
       
    48 	{
       
    49 	iTheDb=CCommsDatabase::NewL();
       
    50 
       
    51 	return EPass;
       
    52 	}
       
    53 
       
    54 TInt CCommDbTest035_01::executeStepL()
       
    55 	{
       
    56 	CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(DIAL_IN_ISP));
       
    57 	delete templateRecord;
       
    58 	return KErrNone;
       
    59 	}
       
    60 	
       
    61 TVerdict CCommDbTest035_01::doTestStepPostambleL()
       
    62 	{
       
    63 	delete iTheDb;
       
    64 	iTheDb=NULL;
       
    65 	return EPass;
       
    66 	}
       
    67 
       
    68 //
       
    69 
       
    70 CCommDbTest035_02::CCommDbTest035_02()
       
    71 	{
       
    72 	// store the name of this test case
       
    73 	iTestStepName = _L("step_035_02");
       
    74 	}
       
    75 
       
    76 CCommDbTest035_02::~CCommDbTest035_02()
       
    77 	{}
       
    78 
       
    79 TVerdict CCommDbTest035_02::doTestStepL( void )
       
    80 	{
       
    81 	if(executeStepL()!=KErrNotSupported)
       
    82 		return EFail;
       
    83 	return EPass;
       
    84 	}
       
    85 
       
    86 TVerdict CCommDbTest035_02::doTestStepPreambleL()
       
    87 	{
       
    88 	iTheDb=CCommsDatabase::NewL();
       
    89 
       
    90 	return EPass;
       
    91 	}
       
    92 
       
    93 TInt CCommDbTest035_02::executeStepL()
       
    94 	{
       
    95 	CCommsDbTemplateRecord* templateRecord=NULL;
       
    96 	//CCommsDbTemplateRecord::NewL should leave with KErrNotSupported, since IAP table doesn't support templates
       
    97 	TRAPD(err, templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(IAP)));
       
    98 	delete templateRecord;
       
    99 	return err;
       
   100 	}
       
   101 	
       
   102 TVerdict CCommDbTest035_02::doTestStepPostambleL()
       
   103 	{
       
   104 	delete iTheDb;
       
   105 	iTheDb=NULL;
       
   106 	return EPass;
       
   107 	}
       
   108 
       
   109 //
       
   110 
       
   111 CCommDbTest035_03::CCommDbTest035_03()
       
   112 	{
       
   113 	// store the name of this test case
       
   114 	iTestStepName = _L("step_035_03");
       
   115 	}
       
   116 
       
   117 CCommDbTest035_03::~CCommDbTest035_03()
       
   118 	{}
       
   119 
       
   120 TVerdict CCommDbTest035_03::doTestStepL( void )
       
   121 	{
       
   122 	if(executeStepL()!=KErrArgument)
       
   123 		return EFail;
       
   124 	return EPass;
       
   125 	}
       
   126 
       
   127 TVerdict CCommDbTest035_03::doTestStepPreambleL()
       
   128 	{
       
   129 	iTheDb=CCommsDatabase::NewL();
       
   130 
       
   131 	return EPass;
       
   132 	}
       
   133 
       
   134 TInt CCommDbTest035_03::executeStepL()
       
   135 	{
       
   136 	CCommsDbTemplateRecord* templateRecord=NULL;
       
   137 	//CCommsDbTemplateRecord::NewL should leave with KErrArgument for invalid name
       
   138 	TRAPD(err, templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, _L("Hi there")));
       
   139 	delete templateRecord;
       
   140 	return err;
       
   141 	}
       
   142 	
       
   143 TVerdict CCommDbTest035_03::doTestStepPostambleL()
       
   144 	{
       
   145 	delete iTheDb;
       
   146 	iTheDb=NULL;
       
   147 	return EPass;
       
   148 	}
       
   149 
       
   150 //
       
   151 
       
   152 CCommDbTest035_04::CCommDbTest035_04()
       
   153 	{
       
   154 	// store the name of this test case
       
   155 	iTestStepName = _L("step_035_04");
       
   156 	}
       
   157 
       
   158 CCommDbTest035_04::~CCommDbTest035_04()
       
   159 	{}
       
   160 
       
   161 TVerdict CCommDbTest035_04::doTestStepL( void )
       
   162 	{
       
   163 	Log(_L("Step 035.04 called "));
       
   164 
       
   165 	iTestStepResult = EPass;
       
   166 
       
   167 	CCommDbTest035_01* step035_01 = new(ELeave) CCommDbTest035_01;
       
   168 	CleanupStack::PushL(step035_01);
       
   169 	step035_01->iSuite = iSuite;
       
   170 	doTestStepWithHeapFailureL( *step035_01, KErrNone);
       
   171 	CleanupStack::PopAndDestroy(step035_01);
       
   172 
       
   173 	CCommDbTest035_02* step035_02 = new(ELeave) CCommDbTest035_02;
       
   174 	CleanupStack::PushL(step035_02);
       
   175 	step035_02->iSuite = iSuite;
       
   176 	doTestStepWithHeapFailureL( *step035_02, KErrNotSupported);
       
   177 	CleanupStack::PopAndDestroy(step035_02);
       
   178 
       
   179 	CCommDbTest035_03* step035_03 = new(ELeave) CCommDbTest035_03;
       
   180 	CleanupStack::PushL(step035_03);
       
   181 	step035_03->iSuite = iSuite;
       
   182 	doTestStepWithHeapFailureL( *step035_03, KErrArgument);
       
   183 	CleanupStack::PopAndDestroy(step035_03);
       
   184 	
       
   185 	return iTestStepResult;
       
   186 	}