commsconfig/commsdatabaseshim/TE_commdb/src/step_054_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_054_xx.h"
       
    33 
       
    34 /////////////////////
       
    35 //	Test step 054.01
       
    36 /////////////////////
       
    37 
       
    38 CCommDbTest054_01::CCommDbTest054_01()
       
    39 {
       
    40 	// store the name of this test case
       
    41 	SetTestStepName(_L("step_054_01"));
       
    42 }
       
    43 
       
    44 CCommDbTest054_01::~CCommDbTest054_01()
       
    45 {
       
    46 	delete iTheDb;
       
    47 }
       
    48 
       
    49 TVerdict CCommDbTest054_01::doTestStepPreambleL()
       
    50 	{	
       
    51 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    52         SetTestStepResult(EPass);	return TestStepResult();
       
    53 	}
       
    54 
       
    55 //Protect Connection Preference Record
       
    56 enum TVerdict CCommDbTest054_01::doTestStepL( void )
       
    57 	{
       
    58 
       
    59 	INFO_PRINTF1(_L("Connection Preference Record : Protection .."));
       
    60 	SetTestStepResult(EPass);
       
    61 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
    62 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
    63 	
       
    64 	if(table->GotoFirstRecord()==KErrNone)
       
    65 		{
       
    66 		// Protect the first record
       
    67 		ProtectRecordL(table,KErrNone);
       
    68 		SetTestStepResult(EPass);		INFO_PRINTF1(_L("\t\tSUCCESS"));
       
    69 		}
       
    70 	else
       
    71 		{
       
    72 		SetTestStepResult(EFail);		INFO_PRINTF1(_L("\t\tFAIL"));
       
    73 		}
       
    74 
       
    75 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
    76 
       
    77 	CleanupStack::PopAndDestroy(); 
       
    78 	return TestStepResult();
       
    79 	}
       
    80 
       
    81 /////////////////////
       
    82 //	Test step 054.02
       
    83 /////////////////////
       
    84 
       
    85 CCommDbTest054_02::CCommDbTest054_02()
       
    86 {
       
    87 	// store the name of this test case
       
    88 	SetTestStepName(_L("step_054_02"));
       
    89 }
       
    90 
       
    91 CCommDbTest054_02::~CCommDbTest054_02()
       
    92 {
       
    93 	delete iTheDb;
       
    94 }
       
    95 
       
    96 TVerdict CCommDbTest054_02::doTestStepPreambleL()
       
    97 	{	
       
    98 	iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
       
    99         SetTestStepResult(EPass);	return TestStepResult();
       
   100 	}
       
   101 
       
   102 //Protect Connection Preference Record
       
   103 enum TVerdict CCommDbTest054_02::doTestStepL( void )
       
   104 	{
       
   105 
       
   106 	INFO_PRINTF1(_L("Connection Preference Record : Unprotection .."));
       
   107 	SetTestStepResult(EPass);
       
   108 	CCommsDbProtectConnectPrefTableView* table = (CCommsDbProtectConnectPrefTableView *)iTheDb->OpenConnectionPrefTableLC();
       
   109 	TESTL(iTheDb->BeginTransaction()==KErrNone);
       
   110 
       
   111 	if(table->GotoFirstRecord()==KErrNone)
       
   112 		{
       
   113 		// UnProtect the first record
       
   114 		UnprotectRecordL(table,KErrNone);
       
   115 		SetTestStepResult(EPass);		INFO_PRINTF1(_L("\t\tSUCCESS"));
       
   116 		}
       
   117 	else
       
   118 		{
       
   119 		SetTestStepResult(EFail);		INFO_PRINTF1(_L("\t\tFAIL"));
       
   120 		}
       
   121 
       
   122 	TESTL(iTheDb->CommitTransaction()==KErrNone);
       
   123 
       
   124 	CleanupStack::PopAndDestroy(); 
       
   125 	return TestStepResult();
       
   126 	}
       
   127