|
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 |
|
28 #include "comms-infras/commdb/protection/protectdb.h" |
|
29 #include "comms-infras/commdb/protection/protectcpdb.h" |
|
30 #include <cdbpreftable.h> |
|
31 |
|
32 #include "step_052_xx.h" |
|
33 |
|
34 |
|
35 ///////////////////// |
|
36 // Test step 052.01 |
|
37 ///////////////////// |
|
38 |
|
39 |
|
40 CCommDbTest052_01::CCommDbTest052_01() |
|
41 { |
|
42 // store the name of this test case |
|
43 SetTestStepName(_L("step_052_01")); |
|
44 } |
|
45 |
|
46 CCommDbTest052_01::~CCommDbTest052_01() |
|
47 { |
|
48 delete iTheDb; |
|
49 } |
|
50 |
|
51 TVerdict CCommDbTest052_01::doTestStepPreambleL() |
|
52 { |
|
53 iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP); |
|
54 SetTestStepResult(EPass); return TestStepResult(); |
|
55 } |
|
56 |
|
57 //Protect normal Record |
|
58 enum TVerdict CCommDbTest052_01::doTestStepL( void ) |
|
59 { |
|
60 |
|
61 INFO_PRINTF1(_L("Normal Record : Protection ..")); |
|
62 SetTestStepResult(EPass); |
|
63 // Test using dial out isp table as running t_createdb places several records |
|
64 // in the table as opposed to just one as in some tables |
|
65 CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP)); |
|
66 TESTL(iTheDb->BeginTransaction()==KErrNone); |
|
67 |
|
68 if(table->GotoFirstRecord()==KErrNone) |
|
69 { |
|
70 // Protect the first record |
|
71 ProtectRecordL(table,KErrNone); |
|
72 SetTestStepResult(EPass); INFO_PRINTF1(_L("\t\tSUCCESS")); |
|
73 } |
|
74 else |
|
75 { |
|
76 SetTestStepResult(EFail); INFO_PRINTF1(_L("\t\tFAIL")); |
|
77 } |
|
78 |
|
79 TESTL(iTheDb->CommitTransaction()==KErrNone); |
|
80 CleanupStack::PopAndDestroy(); |
|
81 return TestStepResult(); |
|
82 } |
|
83 |
|
84 |
|
85 ///////////////////// |
|
86 // Test step 052.02 |
|
87 ///////////////////// |
|
88 |
|
89 CCommDbTest052_02::CCommDbTest052_02() |
|
90 { |
|
91 // store the name of this test case |
|
92 SetTestStepName(_L("step_052_02")); |
|
93 } |
|
94 |
|
95 CCommDbTest052_02::~CCommDbTest052_02() |
|
96 { |
|
97 delete iTheDb; |
|
98 } |
|
99 |
|
100 TVerdict CCommDbTest052_02::doTestStepPreambleL() |
|
101 { |
|
102 iTheDb = CCommsDatabase::NewL(EDatabaseTypeIAP); |
|
103 SetTestStepResult(EPass); return TestStepResult(); |
|
104 } |
|
105 |
|
106 |
|
107 //UnProtect normal Record |
|
108 enum TVerdict CCommDbTest052_02::doTestStepL( void ) |
|
109 { |
|
110 |
|
111 INFO_PRINTF1(_L("Normal Record : Unprotection ..")); |
|
112 SetTestStepResult(EPass); |
|
113 CCommsDbProtectTableView* table = (CCommsDbProtectTableView *)iTheDb->OpenTableLC(TPtrC(DIAL_OUT_ISP)); |
|
114 TESTL(iTheDb->BeginTransaction()==KErrNone); |
|
115 |
|
116 if(table->GotoFirstRecord()==KErrNone) |
|
117 { |
|
118 // UnProtect the first record |
|
119 UnprotectRecordL(table,KErrNone); |
|
120 SetTestStepResult(EPass); INFO_PRINTF1(_L("\t\tSUCCESS")); |
|
121 } |
|
122 else |
|
123 { |
|
124 SetTestStepResult(EFail); INFO_PRINTF1(_L("\t\tFAIL")); |
|
125 } |
|
126 |
|
127 TESTL(iTheDb->CommitTransaction()==KErrNone); |
|
128 CleanupStack::PopAndDestroy(); //table |
|
129 return TestStepResult(); |
|
130 |
|
131 } |