|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // The following test case is used to test whether apparctestserver has the capability |
|
15 // to access writable apis |
|
16 // |
|
17 // t_capability1.cpp |
|
18 // |
|
19 |
|
20 /** |
|
21 @file t_capability1.cpp |
|
22 @internalComponent - Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include "T_Capability1.h" |
|
26 #include "tstapp.h" |
|
27 #include "testableapalssession.h" |
|
28 #include "appfwk_test.h" |
|
29 |
|
30 /** |
|
31 @SYMTestCaseID APPFWK-APPARC-0030 |
|
32 |
|
33 @SYMPREQ Policing server apis |
|
34 |
|
35 @SYMTestCaseDesc Testing whether apparctestserver has the capability to access writable apis |
|
36 |
|
37 @SYMTestPriority High |
|
38 |
|
39 @SYMTestStatus Implemented |
|
40 |
|
41 @SYMTestActions |
|
42 To connect to RApaLsSession and to check whether uiktestserver process |
|
43 has the permission to access the mentioned apis |
|
44 API Calls:\n |
|
45 RApaLsSession::Connect(); |
|
46 RApaLsSession::SetAcceptedConfidence(TInt aConfidence); |
|
47 RApaLsSession::InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid); |
|
48 RApaLsSession::InsertDataMappingIfHigher(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TBool& aInserted); |
|
49 RApaLsSession::DeleteDataMapping(const TDataType& aDataType); |
|
50 |
|
51 @SYMTestExpectedResults Test should complete without any panic. |
|
52 |
|
53 */ |
|
54 void CT_Capability1::ExecuteL(RApaLsSession& aLs) |
|
55 { |
|
56 TInt ret; |
|
57 TInt temp=1234; |
|
58 TBool added=EFalse; |
|
59 _LIT8(KLitPlainText,"text/plain"); |
|
60 const TDataTypePriority KPriLow = 1; |
|
61 const TDataTypePriority KPriHigh = 2; |
|
62 |
|
63 |
|
64 TSecurityInfo info; |
|
65 info.Set(RProcess()); |
|
66 |
|
67 APPFWK_NEGATIVE_PLATSEC_START; |
|
68 ret=aLs.SetAcceptedConfidence(temp); |
|
69 APPFWK_NEGATIVE_PLATSEC_FINISH; |
|
70 INFO_PRINTF1(_L("Capability check of SetAcceptedConfidence")); |
|
71 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret); |
|
72 TEST(ret==KErrPermissionDenied); |
|
73 |
|
74 APPFWK_NEGATIVE_PLATSEC_START; |
|
75 ret=aLs.InsertDataMapping(TDataType(KLitPlainText), KPriLow, KUidTestApp); |
|
76 APPFWK_NEGATIVE_PLATSEC_FINISH; |
|
77 INFO_PRINTF1(_L("Capability check of InsertDataMapping")); |
|
78 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret); |
|
79 TEST(ret==KErrPermissionDenied); |
|
80 |
|
81 APPFWK_NEGATIVE_PLATSEC_START; |
|
82 ret=aLs.InsertDataMappingIfHigher(TDataType(KLitPlainText), KPriHigh, KUidTestApp, added); |
|
83 APPFWK_NEGATIVE_PLATSEC_FINISH; |
|
84 INFO_PRINTF1(_L("Capability check of InsertDataMappingIfHigher")); |
|
85 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret); |
|
86 TEST(ret==KErrPermissionDenied); |
|
87 |
|
88 APPFWK_NEGATIVE_PLATSEC_START; |
|
89 ret=aLs.DeleteDataMapping(TDataType(KLitPlainText)); |
|
90 APPFWK_NEGATIVE_PLATSEC_FINISH; |
|
91 INFO_PRINTF1(_L("Capability check of DeleteDataMapping")); |
|
92 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret); |
|
93 TEST(ret==KErrPermissionDenied); |
|
94 |
|
95 |
|
96 } |
|
97 |
|
98 CT_Capability1::CT_Capability1() |
|
99 /** |
|
100 Constructor |
|
101 */ |
|
102 { |
|
103 // Call base class method to set up the human readable name for logging |
|
104 SetTestStepName(KT_Capability1); |
|
105 } |
|
106 |
|
107 CT_Capability1::~CT_Capability1() |
|
108 { |
|
109 } |
|
110 |
|
111 TVerdict CT_Capability1::doTestStepL() |
|
112 { |
|
113 INFO_PRINTF1(_L("APPFWK-APPARC-0030: Capability1 - Started")); |
|
114 |
|
115 RTestableApaLsSession apaLsSession; |
|
116 TEST(apaLsSession.Connect()==KErrNone); |
|
117 CleanupClosePushL(apaLsSession); |
|
118 |
|
119 HEAP_TEST_LS_SESSION(apaLsSession, 0, 0, ExecuteL(apaLsSession), NO_CLEANUP); |
|
120 |
|
121 |
|
122 CleanupStack::PopAndDestroy(&apaLsSession); |
|
123 |
|
124 INFO_PRINTF1(_L("APPFWK-APPARC-0030: Capability1 - Finished")); |
|
125 |
|
126 return TestStepResult(); |
|
127 } |