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