commsconfig/commsdatabaseshim/ts_commdb/step_052_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_052_xx.h"
       
    40 
       
    41 
       
    42 //
       
    43 //	Test step 052.01
       
    44 //
       
    45 
       
    46 
       
    47 CCommDbTest052_01::CCommDbTest052_01()
       
    48 {
       
    49 	// store the name of this test case
       
    50 	iTestStepName = _L("step_052_01");
       
    51 }
       
    52 
       
    53 CCommDbTest052_01::~CCommDbTest052_01()
       
    54 {
       
    55 	delete iTheDb;
       
    56 }
       
    57 
       
    58 TVerdict CCommDbTest052_01::doTestStepPreambleL()
       
    59 	{	
       
    60 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    61 	return EPass;
       
    62 	}
       
    63 
       
    64 //Protect normal Record
       
    65 enum TVerdict CCommDbTest052_01::doTestStepL( void )
       
    66 	{
       
    67 
       
    68 	Log(_L("Normal Record : Protection .."));
       
    69 	iTestStepResult = EPass;
       
    70 
       
    71 	// Test using dial out isp table as running t_createdb places several records
       
    72 	// in the table as opposed to just one as in some tables
       
    73 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
    74 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
    75 	
       
    76 	if(table->GotoFirstRecord()==KErrNone)
       
    77 		{
       
    78 		// Protect the first record
       
    79 		ProtectRecordL(table,KErrNone);
       
    80 		iTestStepResult = EPass;
       
    81 		Log(_L("\t\tSUCCESS"));
       
    82 		}
       
    83 	else
       
    84 		{
       
    85 		iTestStepResult = EFail;
       
    86 		Log(_L("\t\tFAIL"));
       
    87 		}
       
    88 
       
    89 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
    90 	CleanupStack::PopAndDestroy(); 
       
    91 	return iTestStepResult;
       
    92 	}
       
    93 
       
    94 
       
    95 //
       
    96 //	Test step 052.02
       
    97 //
       
    98 
       
    99 CCommDbTest052_02::CCommDbTest052_02()
       
   100 {
       
   101 	// store the name of this test case
       
   102 	iTestStepName = _L("step_052_02");
       
   103 }
       
   104 
       
   105 CCommDbTest052_02::~CCommDbTest052_02()
       
   106 {
       
   107 	delete iTheDb;
       
   108 }
       
   109 
       
   110 TVerdict CCommDbTest052_02::doTestStepPreambleL()
       
   111 	{	
       
   112 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   113 	return EPass;
       
   114 	}
       
   115 
       
   116 
       
   117 //UnProtect normal Record
       
   118 enum TVerdict CCommDbTest052_02::doTestStepL( void )
       
   119 	{
       
   120 
       
   121 	Log(_L("Normal Record : Unprotection .."));
       
   122 	iTestStepResult = EPass;
       
   123 
       
   124 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
   125 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
   126 
       
   127 	if(table->GotoFirstRecord()==KErrNone)
       
   128 		{
       
   129 		// UnProtect the first record
       
   130 		UnprotectRecordL(table,KErrNone);
       
   131 		iTestStepResult = EPass;
       
   132 		Log(_L("\t\tSUCCESS"));
       
   133 		}
       
   134 	else
       
   135 		{
       
   136 		iTestStepResult = EFail;
       
   137 		Log(_L("\t\tFAIL"));
       
   138 		}
       
   139 
       
   140 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
   141 	CleanupStack::PopAndDestroy(); //table
       
   142 	return iTestStepResult;
       
   143 
       
   144 	}