commsconfig/commsdatabaseshim/ts_commdb/step_057_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_057_xx.h"
       
    40 
       
    41 //
       
    42 //	Test step 057.01
       
    43 //
       
    44 
       
    45 //TestProtectRecords
       
    46 CCommDbTest057_01::CCommDbTest057_01()
       
    47 {
       
    48 	// store the name of this test case
       
    49 	iTestStepName = _L("step_057_01");
       
    50 }
       
    51 
       
    52 CCommDbTest057_01::~CCommDbTest057_01()
       
    53 {
       
    54 	delete iTheDb;
       
    55 }
       
    56 
       
    57 TVerdict CCommDbTest057_01::doTestStepPreambleL()
       
    58 	{	
       
    59 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    60 	return EPass;
       
    61 	}
       
    62 
       
    63 enum TVerdict CCommDbTest057_01::doTestStepL( void )
       
    64 	{
       
    65 
       
    66 	Log(_L("Test Protect Connection Prefs Table "));
       
    67 	iTestStepResult = EPass;
       
    68 
       
    69     CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref  RecordData1, RecordData2;
       
    70 
       
    71 	// protect the table and do some checking
       
    72 	// database is modified
       
    73 	//
       
    74 
       
    75 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
    76 	CheckTableIsNotProtectedL(table);
       
    77 
       
    78 	table->ReadConnectionPreferenceL(RecordData1);
       
    79 
       
    80 	TESTL(table->ProtectTable()==KErrNone);
       
    81 	
       
    82 	CheckTableIsProtectedL(table);
       
    83 	table->ReadConnectionPreferenceL(RecordData2);
       
    84 	TESTL(RecordData1 == RecordData2);
       
    85 
       
    86 	iTestStepResult = EPass;
       
    87 	Log(_L("\t\tSUCCESS"));
       
    88 
       
    89 	CleanupStack::PopAndDestroy(); 
       
    90 	return iTestStepResult;
       
    91 	}
       
    92 
       
    93 
       
    94 
       
    95 //
       
    96 //	Test step 057.02
       
    97 //
       
    98 
       
    99 //TestUnprotectRecords
       
   100 CCommDbTest057_02::CCommDbTest057_02()
       
   101 {
       
   102 	// store the name of this test case
       
   103 	iTestStepName = _L("step_057_02");
       
   104 }
       
   105 
       
   106 CCommDbTest057_02::~CCommDbTest057_02()
       
   107 {
       
   108 	delete iTheDb;
       
   109 }
       
   110 
       
   111 TVerdict CCommDbTest057_02::doTestStepPreambleL()
       
   112 	{	
       
   113 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   114 	return EPass;
       
   115 	}
       
   116 
       
   117 enum TVerdict CCommDbTest057_02::doTestStepL( void )
       
   118 	{
       
   119 
       
   120 	Log(_L("Test UnProtect Connection Prefs Table .."));
       
   121 	iTestStepResult = EPass;
       
   122 
       
   123 	// unprotect the table and do some checking
       
   124 	// database is modified
       
   125 	//
       
   126 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
   127 	CheckTableIsProtectedL(table);
       
   128 
       
   129 	TESTL(table->UnprotectTable()==KErrNone);
       
   130 	
       
   131 	CheckTableIsNotProtectedL(table);
       
   132 	
       
   133 	iTestStepResult = EPass;
       
   134 	Log(_L("\t\tSUCCESS"));
       
   135 	CleanupStack::PopAndDestroy(); 
       
   136 	return iTestStepResult;
       
   137 	}
       
   138