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