commsconfig/commsdatabaseshim/ts_commdb/Step_032_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 032.XX
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 #include <d32comm.h>
       
    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_032_xx.h"
       
    29 
       
    30 
       
    31 CCommDbTest032_01::CCommDbTest032_01()
       
    32 	{
       
    33 	// store the name of this test case
       
    34 	iTestStepName = _L("step_032_01");
       
    35 	}
       
    36 
       
    37 CCommDbTest032_01::~CCommDbTest032_01()
       
    38 	{}
       
    39 
       
    40 TVerdict CCommDbTest032_01::doTestStepL( void )
       
    41 	{
       
    42 	executeStepL();
       
    43 	return EPass;	//If we've got this far we've passed
       
    44 	}
       
    45 
       
    46 TVerdict CCommDbTest032_01::doTestStepPreambleL()
       
    47 	{
       
    48 	iTheDb=CCommsDatabase::NewL();
       
    49 
       
    50 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
    51 	CleanupStack::Pop();
       
    52 
       
    53 	return EPass;
       
    54 	}
       
    55 
       
    56 TInt CCommDbTest032_01::executeStepL()
       
    57 	{
       
    58 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
    59 	pref1.iRanking = 1;
       
    60 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
    61 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
    62 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
    63 	pref1.iBearer.iIapId = 1;
       
    64 
       
    65 	iPrefView->InsertConnectionPreferenceL(pref1, EFalse);
       
    66 
       
    67 	User::LeaveIfError(iPrefView->GotoFirstRecord());
       
    68 
       
    69 	iPrefView->UpdateDialogPrefL(ECommDbDialogPrefDoNotPrompt);
       
    70 
       
    71 	return KErrNone;
       
    72 	}
       
    73 
       
    74 TVerdict CCommDbTest032_01::doTestStepPostambleL()
       
    75 	{
       
    76 	delete iPrefView;
       
    77 	iPrefView = NULL;
       
    78 	delete iTheDb;
       
    79 	iTheDb=NULL;
       
    80 	return EPass;
       
    81 	}
       
    82 
       
    83 //
       
    84 
       
    85 CCommDbTest032_02::CCommDbTest032_02()
       
    86 	{
       
    87 	// store the name of this test case
       
    88 	iTestStepName = _L("step_032_02");
       
    89 	}
       
    90 
       
    91 CCommDbTest032_02::~CCommDbTest032_02()
       
    92 	{}
       
    93 
       
    94 TVerdict CCommDbTest032_02::doTestStepL( void )
       
    95 	{
       
    96 	if(executeStepL()!=KErrNotFound)
       
    97 		return EFail;
       
    98 	return EPass;
       
    99 	}
       
   100 
       
   101 TVerdict CCommDbTest032_02::doTestStepPreambleL()
       
   102 	{
       
   103 	iTheDb=CCommsDatabase::NewL();
       
   104 
       
   105 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   106 	CleanupStack::Pop();
       
   107 
       
   108 	return EPass;
       
   109 	}
       
   110 
       
   111 TInt CCommDbTest032_02::executeStepL()
       
   112 	{
       
   113 	TRAPD(err, iPrefView->UpdateDialogPrefL(ECommDbDialogPrefDoNotPrompt));
       
   114 
       
   115 	return err;
       
   116 	}
       
   117 
       
   118 TVerdict CCommDbTest032_02::doTestStepPostambleL()
       
   119 	{
       
   120 	delete iPrefView;
       
   121 	iPrefView = NULL;
       
   122 	delete iTheDb;
       
   123 	iTheDb=NULL;
       
   124 	return EPass;
       
   125 	}
       
   126 
       
   127 //
       
   128 
       
   129 CCommDbTest032_03::CCommDbTest032_03()
       
   130 	{
       
   131 	// store the name of this test case
       
   132 	iTestStepName = _L("step_032_03");
       
   133 	}
       
   134 
       
   135 CCommDbTest032_03::~CCommDbTest032_03()
       
   136 	{}
       
   137 
       
   138 TVerdict CCommDbTest032_03::doTestStepL( void )
       
   139 	{
       
   140 	if(executeStepL()!=KErrAccessDenied)
       
   141 		return EFail;
       
   142 	return EPass;
       
   143 	}
       
   144 
       
   145 TVerdict CCommDbTest032_03::doTestStepPreambleL()
       
   146 	{
       
   147 	iTheDb=CCommsDatabase::NewL();
       
   148 
       
   149 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   150 	CleanupStack::Pop();
       
   151 
       
   152 	return EPass;
       
   153 	}
       
   154 
       
   155 TInt CCommDbTest032_03::executeStepL()
       
   156 	{
       
   157 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
   158 	pref1.iRanking = 1;
       
   159 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
   160 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
   161 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
   162 	pref1.iBearer.iIapId = 1;
       
   163 
       
   164 	iPrefView->InsertConnectionPreferenceL(pref1, ETrue);
       
   165 
       
   166 	User::LeaveIfError(iPrefView->GotoFirstRecord());
       
   167 
       
   168 	TRAPD(err, iPrefView->UpdateDialogPrefL(ECommDbDialogPrefDoNotPrompt));
       
   169 
       
   170 	return err;
       
   171 	}
       
   172 
       
   173 TVerdict CCommDbTest032_03::doTestStepPostambleL()
       
   174 	{
       
   175 	delete iPrefView;
       
   176 	iPrefView = NULL;
       
   177 	delete iTheDb;
       
   178 	iTheDb=NULL;
       
   179 	return EPass;
       
   180 	}
       
   181 
       
   182 //
       
   183 
       
   184 CCommDbTest032_04::CCommDbTest032_04()
       
   185 	{
       
   186 	// store the name of this test case
       
   187 	iTestStepName = _L("step_032_04");
       
   188 	}
       
   189 
       
   190 CCommDbTest032_04::~CCommDbTest032_04()
       
   191 	{}
       
   192 
       
   193 TVerdict CCommDbTest032_04::doTestStepL( void )
       
   194 	{
       
   195 	Log(_L("Step 032.04 called "));
       
   196 
       
   197 	iTestStepResult = EPass;
       
   198 
       
   199 	CCommDbTest032_01* step032_01 = new(ELeave) CCommDbTest032_01;
       
   200 	CleanupStack::PushL(step032_01);
       
   201 	step032_01->iSuite = iSuite;
       
   202 	doTestStepWithHeapFailureL( *step032_01, KErrNone);
       
   203 	CleanupStack::PopAndDestroy(step032_01);
       
   204 
       
   205 
       
   206 	return iTestStepResult;
       
   207 	}
       
   208 
       
   209 
       
   210 //
       
   211 
       
   212 CCommDbTest032_05::CCommDbTest032_05()
       
   213 	{
       
   214 	// store the name of this test case
       
   215 	iTestStepName = _L("step_032_05");
       
   216 	}
       
   217 
       
   218 CCommDbTest032_05::~CCommDbTest032_05()
       
   219 	{}
       
   220 
       
   221 TVerdict CCommDbTest032_05::doTestStepL( void )
       
   222 	{
       
   223 	Log(_L("Step 032.04 called "));
       
   224 
       
   225 	iTestStepResult = EPass;
       
   226 
       
   227 	CCommDbTest032_02* step032_02 = new(ELeave) CCommDbTest032_02;
       
   228 	CleanupStack::PushL(step032_02);
       
   229 	step032_02->iSuite = iSuite;
       
   230 	doTestStepWithHeapFailureL( *step032_02, KErrNotFound);
       
   231 	CleanupStack::PopAndDestroy(step032_02);
       
   232 
       
   233 	CCommDbTest032_03* step032_03 = new(ELeave) CCommDbTest032_03;
       
   234 	CleanupStack::PushL(step032_03);
       
   235 	step032_03->iSuite = iSuite;
       
   236 	doTestStepWithHeapFailureL( *step032_03, KErrAccessDenied);
       
   237 	CleanupStack::PopAndDestroy(step032_03);
       
   238 
       
   239 	return iTestStepResult;
       
   240 	}
       
   241