|
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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-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 // |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalComponent - Internal Symbian test code |
|
24 */ |
|
25 |
|
26 #include "T_Capability2.h" |
|
27 #include "tstapp.h" |
|
28 #include "testableapalssession.h" |
|
29 #include <appfwk_test.h> |
|
30 |
|
31 /** |
|
32 @SYMTestCaseID APPFWK-APPARC-0030 |
|
33 |
|
34 @SYMPREQ Policing server apis |
|
35 |
|
36 @SYMTestCaseDesc Testing whether apparctestserver has the capability to access writable apis |
|
37 |
|
38 @SYMTestPriority High |
|
39 |
|
40 @SYMTestStatus Implemented |
|
41 |
|
42 @SYMTestActions |
|
43 To connect to RApaLsSession and to check whether uiktestserver process |
|
44 has the permission to access the mentioned apis |
|
45 API Calls:\n |
|
46 RApaLsSession::Connect(); |
|
47 RApaLsSession::SetAcceptedConfidence(TInt aConfidence); |
|
48 RApaLsSession::InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid); |
|
49 RApaLsSession::InsertDataMappingIfHigher(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TBool& aInserted); |
|
50 RApaLsSession::DeleteDataMapping(const TDataType& aDataType); |
|
51 |
|
52 @SYMTestExpectedResults Test should complete without any panic. |
|
53 |
|
54 */ |
|
55 void CT_Capability2::ExecuteL(RApaLsSession& aLs) |
|
56 { |
|
57 TInt ret; |
|
58 TInt temp=1234; |
|
59 TBool added=EFalse; |
|
60 _LIT8(KLitPlainText,"text/plain"); |
|
61 const TDataTypePriority KPriLow = 1; |
|
62 const TDataTypePriority KPriHigh = 2; |
|
63 |
|
64 TSecurityInfo info; |
|
65 info.Set(RProcess()); |
|
66 |
|
67 ret=aLs.SetAcceptedConfidence(temp); |
|
68 INFO_PRINTF1(_L("Capability check of SetAcceptedConfidence")); |
|
69 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
70 TEST(ret==KErrNone); |
|
71 |
|
72 ret=aLs.InsertDataMapping(TDataType(KLitPlainText), KPriLow, KUidTestApp); |
|
73 INFO_PRINTF1(_L("Capability check of InsertDataMapping")); |
|
74 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
75 TEST(ret==KErrNone); |
|
76 |
|
77 ret=aLs.InsertDataMappingIfHigher(TDataType(KLitPlainText), KPriHigh, KUidTestApp, added); |
|
78 INFO_PRINTF1(_L("Capability check of InsertDataMappingIfHigher")); |
|
79 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
80 TEST(ret==KErrNone); |
|
81 |
|
82 ret=aLs.DeleteDataMapping(TDataType(KLitPlainText)); |
|
83 INFO_PRINTF1(_L("Capability check of DeleteDataMapping")); |
|
84 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
85 TEST(ret==KErrNone); |
|
86 |
|
87 } |
|
88 |
|
89 CT_Capability2::CT_Capability2() |
|
90 /** |
|
91 Constructor |
|
92 */ |
|
93 { |
|
94 // Call base class method to set up the human readable name for logging |
|
95 SetTestStepName(KT_Capability2); |
|
96 } |
|
97 |
|
98 CT_Capability2::~CT_Capability2() |
|
99 { |
|
100 } |
|
101 |
|
102 TVerdict CT_Capability2::doTestStepL() |
|
103 { |
|
104 INFO_PRINTF1(_L("APPFWK-APPARC-0031: Capability2 - Started")); |
|
105 |
|
106 RTestableApaLsSession apaLsSession; |
|
107 TEST(apaLsSession.Connect()==KErrNone); |
|
108 CleanupClosePushL(apaLsSession); |
|
109 |
|
110 //DONT_CHECK since array in type store is uncompressed |
|
111 HEAP_TEST_LS_SESSION(apaLsSession, 0, DONT_CHECK, ExecuteL(apaLsSession), NO_CLEANUP); |
|
112 |
|
113 CleanupStack::PopAndDestroy(&apaLsSession); |
|
114 |
|
115 |
|
116 INFO_PRINTF1(_L("APPFWK-APPARC-0031: Capability2 - Finished")); |
|
117 |
|
118 return TestStepResult(); |
|
119 } |