commsconfig/commsdatabaseshim/TE_commdb/src/step_057_xx.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 //
       
    16 //
       
    17 // 
       
    18  
       
    19 // EPOC includes
       
    20 #include <e32base.h>
       
    21 #include <commdb.h>
       
    22 #include <d32comm.h>
       
    23 #include <cdbstore.h>
       
    24 
       
    25 // Test system includes
       
    26 #include "Teststepcommdb.h"
       
    27 #include "comms-infras/commdb/protection/protectdb.h"
       
    28 #include "comms-infras/commdb/protection/protectcpdb.h"
       
    29 
       
    30 #include <cdbpreftable.h>
       
    31 
       
    32 #include "step_057_xx.h"
       
    33 
       
    34 /////////////////////
       
    35 //	Test step 057.01
       
    36 /////////////////////
       
    37 
       
    38 //TestProtectRecords
       
    39 CCommDbTest057_01::CCommDbTest057_01()
       
    40 {
       
    41 	// store the name of this test case
       
    42 	SetTestStepName(_L("step_057_01"));
       
    43 }
       
    44 
       
    45 CCommDbTest057_01::~CCommDbTest057_01()
       
    46 {
       
    47 	delete iTheDb;
       
    48 }
       
    49 
       
    50 TVerdict CCommDbTest057_01::doTestStepPreambleL()
       
    51 	{	
       
    52 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    53         SetTestStepResult(EPass);	return TestStepResult();
       
    54 	}
       
    55 
       
    56 enum TVerdict CCommDbTest057_01::doTestStepL( void )
       
    57 	{
       
    58 
       
    59 	INFO_PRINTF1(_L("Test Protect Connection Prefs Table "));
       
    60 	SetTestStepResult(EPass);
       
    61     CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref  RecordData1, RecordData2;
       
    62 
       
    63 	// protect the table and do some checking
       
    64 	// database is modified
       
    65 	//
       
    66 
       
    67 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
    68 	CheckTableIsNotProtectedL(table);
       
    69 
       
    70 	table->ReadConnectionPreferenceL(RecordData1);
       
    71 
       
    72 	TESTL(table->ProtectTable()==KErrNone);
       
    73 	
       
    74 	CheckTableIsProtectedL(table);
       
    75 	table->ReadConnectionPreferenceL(RecordData2);
       
    76 	TESTL(RecordData1 == RecordData2);
       
    77 
       
    78 	SetTestStepResult(EPass);	INFO_PRINTF1(_L("\t\tSUCCESS"));
       
    79 
       
    80 	CleanupStack::PopAndDestroy(); 
       
    81 	return TestStepResult();
       
    82 	}
       
    83 
       
    84 
       
    85 
       
    86 /////////////////////
       
    87 //	Test step 057.02
       
    88 /////////////////////
       
    89 
       
    90 //TestUnprotectRecords
       
    91 CCommDbTest057_02::CCommDbTest057_02()
       
    92 {
       
    93 	// store the name of this test case
       
    94 	SetTestStepName(_L("step_057_02"));
       
    95 }
       
    96 
       
    97 CCommDbTest057_02::~CCommDbTest057_02()
       
    98 {
       
    99 	delete iTheDb;
       
   100 }
       
   101 
       
   102 TVerdict CCommDbTest057_02::doTestStepPreambleL()
       
   103 	{	
       
   104 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   105         SetTestStepResult(EPass);	return TestStepResult();
       
   106 	}
       
   107 
       
   108 enum TVerdict CCommDbTest057_02::doTestStepL( void )
       
   109 	{
       
   110 
       
   111 	INFO_PRINTF1(_L("Test UnProtect Connection Prefs Table .."));
       
   112 	SetTestStepResult(EPass);
       
   113 	// unprotect the table and do some checking
       
   114 	// database is modified
       
   115 	//
       
   116 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
   117 	CheckTableIsProtectedL(table);
       
   118 
       
   119 	TESTL(table->UnprotectTable()==KErrNone);
       
   120 	
       
   121 	CheckTableIsNotProtectedL(table);
       
   122 	
       
   123 	SetTestStepResult(EPass);	INFO_PRINTF1(_L("\t\tSUCCESS"));
       
   124 	CleanupStack::PopAndDestroy(); 
       
   125 	return TestStepResult();
       
   126 	}
       
   127