commsconfig/commsdatabaseshim/ts_commdb/step_054_xx.cpp
changeset 72 ae47d0499bee
parent 68 5da8188e392b
child 77 c9776eadbffd
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
     1 // Copyright (c) 2003-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 //
       
    15  
       
    16 // EPOC includes
       
    17 #include <e32base.h>
       
    18 #include <commdb.h>
       
    19 #include <d32comm.h>
       
    20 #include <cdbstore.h>
       
    21 
       
    22 // Test system includes
       
    23 #include <networking/log.h>
       
    24 #include <networking/teststep.h>
       
    25 #include "Teststepcommdb.h"
       
    26 #include "TestSuiteCommdb.h"
       
    27 
       
    28 #ifdef SYMBIAN_OLD_EXPORT_LOCATION
       
    29 #include <comms-infras/commdb/protection/protectdb.h>
       
    30 #include <comms-infras/commdb/protection/protectcpdb.h>
       
    31 #else
       
    32 //these headers are user includes in the new env.
       
    33 #include "protectdb.h"
       
    34 #include "protectcpdb.h"
       
    35 #endif
       
    36 
       
    37 #include <cdbpreftable.h>
       
    38 
       
    39 #include "step_054_xx.h"
       
    40 
       
    41 //
       
    42 //	Test step 054.01
       
    43 //
       
    44 
       
    45 CCommDbTest054_01::CCommDbTest054_01()
       
    46 {
       
    47 	// store the name of this test case
       
    48 	iTestStepName = _L("step_054_01");
       
    49 }
       
    50 
       
    51 CCommDbTest054_01::~CCommDbTest054_01()
       
    52 {
       
    53 	delete iTheDb;
       
    54 }
       
    55 
       
    56 TVerdict CCommDbTest054_01::doTestStepPreambleL()
       
    57 	{	
       
    58 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    59 	return EPass;
       
    60 	}
       
    61 
       
    62 //Protect Connection Preference Record
       
    63 enum TVerdict CCommDbTest054_01::doTestStepL( void )
       
    64 	{
       
    65 
       
    66 	Log(_L("Connection Preference Record : Protection .."));
       
    67 	iTestStepResult = EPass;
       
    68 
       
    69 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
    70 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
    71 	
       
    72 	if(table->GotoFirstRecord()==KErrNone)
       
    73 		{
       
    74 		// Protect the first record
       
    75 		ProtectRecordL(table,KErrNone);
       
    76 		iTestStepResult = EPass;
       
    77 		Log(_L("\t\tSUCCESS"));
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		iTestStepResult = EFail;
       
    82 		Log(_L("\t\tFAIL"));
       
    83 		}
       
    84 
       
    85 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
    86 
       
    87 	CleanupStack::PopAndDestroy(); 
       
    88 	return iTestStepResult;
       
    89 	}
       
    90 
       
    91 //
       
    92 //	Test step 054.02
       
    93 //
       
    94 
       
    95 CCommDbTest054_02::CCommDbTest054_02()
       
    96 {
       
    97 	// store the name of this test case
       
    98 	iTestStepName = _L("step_054_02");
       
    99 }
       
   100 
       
   101 CCommDbTest054_02::~CCommDbTest054_02()
       
   102 {
       
   103 	delete iTheDb;
       
   104 }
       
   105 
       
   106 TVerdict CCommDbTest054_02::doTestStepPreambleL()
       
   107 	{	
       
   108 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   109 	return EPass;
       
   110 	}
       
   111 
       
   112 //Protect Connection Preference Record
       
   113 enum TVerdict CCommDbTest054_02::doTestStepL( void )
       
   114 	{
       
   115 
       
   116 	Log(_L("Connection Preference Record : Unprotection .."));
       
   117 	iTestStepResult = EPass;
       
   118 
       
   119 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
   120 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
   121 
       
   122 	if(table->GotoFirstRecord()==KErrNone)
       
   123 		{
       
   124 		// UnProtect the first record
       
   125 		UnprotectRecordL(table,KErrNone);
       
   126 		iTestStepResult = EPass;
       
   127 		Log(_L("\t\tSUCCESS"));
       
   128 		}
       
   129 	else
       
   130 		{
       
   131 		iTestStepResult = EFail;
       
   132 		Log(_L("\t\tFAIL"));
       
   133 		}
       
   134 
       
   135 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
   136 
       
   137 	CleanupStack::PopAndDestroy(); 
       
   138 	return iTestStepResult;
       
   139 	}
       
   140