|
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_capability2.cpp |
|
18 // |
|
19 |
|
20 /** |
|
21 @file t_capability2.cpp |
|
22 @internalComponent - Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include "T_Capability2.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_Capability2::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 TSecurityInfo info; |
|
64 info.Set(RProcess()); |
|
65 |
|
66 ret=aLs.SetAcceptedConfidence(temp); |
|
67 INFO_PRINTF1(_L("Capability check of SetAcceptedConfidence")); |
|
68 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
69 TEST(ret==KErrNone); |
|
70 |
|
71 ret=aLs.InsertDataMapping(TDataType(KLitPlainText), KPriLow, KUidTestApp); |
|
72 INFO_PRINTF1(_L("Capability check of InsertDataMapping")); |
|
73 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
74 TEST(ret==KErrNone); |
|
75 |
|
76 ret=aLs.InsertDataMappingIfHigher(TDataType(KLitPlainText), KPriHigh, KUidTestApp, added); |
|
77 INFO_PRINTF1(_L("Capability check of InsertDataMappingIfHigher")); |
|
78 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
79 TEST(ret==KErrNone); |
|
80 |
|
81 ret=aLs.DeleteDataMapping(TDataType(KLitPlainText)); |
|
82 INFO_PRINTF1(_L("Capability check of DeleteDataMapping")); |
|
83 INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrNone, ret); |
|
84 TEST(ret==KErrNone); |
|
85 |
|
86 } |
|
87 |
|
88 CT_Capability2::CT_Capability2() |
|
89 /** |
|
90 Constructor |
|
91 */ |
|
92 { |
|
93 // Call base class method to set up the human readable name for logging |
|
94 SetTestStepName(KT_Capability2); |
|
95 } |
|
96 |
|
97 CT_Capability2::~CT_Capability2() |
|
98 { |
|
99 } |
|
100 |
|
101 TVerdict CT_Capability2::doTestStepL() |
|
102 { |
|
103 INFO_PRINTF1(_L("APPFWK-APPARC-0031: Capability2 - Started")); |
|
104 |
|
105 RTestableApaLsSession apaLsSession; |
|
106 TEST(apaLsSession.Connect()==KErrNone); |
|
107 CleanupClosePushL(apaLsSession); |
|
108 |
|
109 //DONT_CHECK since array in type store is uncompressed |
|
110 HEAP_TEST_LS_SESSION(apaLsSession, 0, DONT_CHECK, ExecuteL(apaLsSession), NO_CLEANUP); |
|
111 |
|
112 CleanupStack::PopAndDestroy(&apaLsSession); |
|
113 |
|
114 |
|
115 INFO_PRINTF1(_L("APPFWK-APPARC-0031: Capability2 - Finished")); |
|
116 |
|
117 return TestStepResult(); |
|
118 } |