commsconfig/commsdatabaseshim/ts_commdb/step_051_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_051_xx.h"
       
    40 
       
    41 
       
    42 //
       
    43 //	Test step 051.01
       
    44 //
       
    45 
       
    46 CCommDbTest051_01::CCommDbTest051_01()
       
    47 {
       
    48 	// store the name of this test case
       
    49 	iTestStepName = _L("step_051_01");
       
    50 
       
    51 }
       
    52 
       
    53 CCommDbTest051_01::~CCommDbTest051_01()
       
    54 {
       
    55 	delete iTheDb;
       
    56 }
       
    57 
       
    58 
       
    59 TVerdict CCommDbTest051_01::doTestStepPreambleL()
       
    60 	{	
       
    61 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    62 	return EPass;
       
    63 	}
       
    64 
       
    65 //protect normal table
       
    66 enum TVerdict CCommDbTest051_01::doTestStepL( void )
       
    67 	{
       
    68 
       
    69 	Log(_L("Normal Table : Protection.. "));
       
    70 	iTestStepResult = EPass;
       
    71 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
    72 
       
    73 	if(table->GotoFirstRecord()==KErrNone)
       
    74 		{
       
    75 		TESTL(table->ProtectTable()==KErrNone);
       
    76 		iTestStepResult = EPass;
       
    77 		Log(_L("\t\tSUCCESS"));
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		iTestStepResult = EFail;
       
    82 		Log(_L("FAIL"));
       
    83 		}
       
    84 	CleanupStack::PopAndDestroy(); 
       
    85 	return iTestStepResult;
       
    86 	}
       
    87 
       
    88 //
       
    89 //	Test step 051.02
       
    90 //
       
    91 
       
    92 CCommDbTest051_02::CCommDbTest051_02()
       
    93 {
       
    94 	// store the name of this test case
       
    95 	iTestStepName = _L("step_051_02");
       
    96 
       
    97 }
       
    98 
       
    99 CCommDbTest051_02::~CCommDbTest051_02()
       
   100 {
       
   101 	delete iTheDb;
       
   102 }
       
   103 
       
   104 TVerdict CCommDbTest051_02::doTestStepPreambleL()
       
   105 	{	
       
   106 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   107 	return EPass;
       
   108 	}
       
   109 
       
   110 //Unprotect Normal Table
       
   111 enum TVerdict CCommDbTest051_02::doTestStepL( void )
       
   112 	{
       
   113 	Log(_L("Normal Table : Unprotection .."));
       
   114 	iTestStepResult = EPass;
       
   115 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
   116 	if(table->GotoFirstRecord()==KErrNone)
       
   117 		{
       
   118 		TESTL(table->UnprotectTable()==KErrNone);
       
   119 		iTestStepResult = EPass;
       
   120 		Log(_L("\t\tSUCCESS"));
       
   121 		}
       
   122 	else
       
   123 		{
       
   124 		iTestStepResult = EFail;
       
   125 		Log(_L("FAIL"));
       
   126 		}
       
   127 	CleanupStack::PopAndDestroy(); 
       
   128 	return iTestStepResult;
       
   129 	}