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