commsconfig/commsdatabaseshim/ts_commdb/step_055_xx.cpp
changeset 75 a365cb779476
parent 71 c5f26e3de961
child 79 cf589eb1e31e
equal deleted inserted replaced
71:c5f26e3de961 75:a365cb779476
     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_055_xx.h"
       
    40 
       
    41 //
       
    42 //	Test step 055.01
       
    43 //
       
    44 
       
    45 //TestProtectTables
       
    46 CCommDbTest055_01::CCommDbTest055_01()
       
    47 {
       
    48 	// store the name of this test case
       
    49 	iTestStepName = _L("step_055_01");
       
    50 }
       
    51 
       
    52 CCommDbTest055_01::~CCommDbTest055_01()
       
    53 {
       
    54 	delete iTheDb;
       
    55 }
       
    56 
       
    57 TVerdict CCommDbTest055_01::doTestStepPreambleL()
       
    58 	{	
       
    59 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    60 	return EPass;
       
    61 	}
       
    62 
       
    63 enum TVerdict CCommDbTest055_01::doTestStepL( void )
       
    64 	{
       
    65 
       
    66 	Log(_L("Test Normal Table : Protection .."));
       
    67 	iTestStepResult = EPass;
       
    68 
       
    69 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
    70 	CheckTableIsNotProtectedL(table);
       
    71 
       
    72 	TUint32 recordId;
       
    73 	table->ReadUintL(TPtrC(COMMDB_ID),recordId);
       
    74 	
       
    75 	TESTL(table->ProtectTable()==KErrNone);
       
    76 	TUint32 postProtectRecordId;
       
    77 	table->ReadUintL(TPtrC(COMMDB_ID),postProtectRecordId);
       
    78 	TESTL(postProtectRecordId==recordId);
       
    79 	
       
    80 	CheckTableIsProtectedL(table);
       
    81 	iTestStepResult = EPass;
       
    82 	Log(_L("\t\tSUCCESS"));
       
    83 
       
    84 	CleanupStack::PopAndDestroy(); 
       
    85 	return iTestStepResult;
       
    86 	}
       
    87 
       
    88 
       
    89 //
       
    90 //	Test step 055.02
       
    91 //
       
    92 
       
    93 
       
    94 //TestUnprotectTables
       
    95 CCommDbTest055_02::CCommDbTest055_02()
       
    96 {
       
    97 	// store the name of this test case
       
    98 	iTestStepName = _L("step_055_02");
       
    99 }
       
   100 
       
   101 CCommDbTest055_02::~CCommDbTest055_02()
       
   102 {
       
   103 	delete iTheDb;
       
   104 }
       
   105 
       
   106 TVerdict CCommDbTest055_02::doTestStepPreambleL()
       
   107 	{	
       
   108 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   109 	return EPass;
       
   110 	}
       
   111 
       
   112 //Protect Connection Preference Record
       
   113 enum TVerdict CCommDbTest055_02::doTestStepL( void )
       
   114 	{
       
   115 
       
   116 	Log(_L("Test Normal Table : unprotection .."));
       
   117 	iTestStepResult = EPass;
       
   118 
       
   119 	CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP));
       
   120 	CheckTableIsProtectedL(table);
       
   121 
       
   122 	TUint32 recordId;
       
   123 	table->ReadUintL(TPtrC(COMMDB_ID),recordId);
       
   124 	
       
   125 	TESTL(table->UnprotectTable()==KErrNone);
       
   126 	TUint32 postProtectRecordId;
       
   127 	table->ReadUintL(TPtrC(COMMDB_ID),postProtectRecordId);
       
   128 	TESTL(postProtectRecordId==recordId);
       
   129 	
       
   130 	CheckTableIsNotProtectedL(table);
       
   131 	
       
   132 	iTestStepResult = EPass;
       
   133 	Log(_L("\t\tSUCCESS"));
       
   134 
       
   135 	CleanupStack::PopAndDestroy(); 
       
   136 	return iTestStepResult;
       
   137 	}
       
   138