|
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 #include <stdio.h> |
|
19 #include <string> |
|
20 |
|
21 #include "TestHarness.h" |
|
22 |
|
23 #include <msecuritypolicyv2.h> |
|
24 |
|
25 using namespace MIDP; |
|
26 |
|
27 IMPORT_C MSecurityPolicyV2* GetSecurityPolicyL(TUint32 aFlags, const TDesC& aPolicyName); |
|
28 |
|
29 TEST_GROUP(TestSecurityPolicy) |
|
30 { |
|
31 |
|
32 MSecurityPolicyV2* iSecurityPolicy; |
|
33 |
|
34 TEST_SETUP() |
|
35 { |
|
36 } |
|
37 |
|
38 TEST_TEARDOWN() |
|
39 { |
|
40 if (iSecurityPolicy) |
|
41 { |
|
42 delete iSecurityPolicy; |
|
43 iSecurityPolicy = NULL; |
|
44 } |
|
45 } |
|
46 }; |
|
47 |
|
48 /** |
|
49 */ |
|
50 TEST(TestSecurityPolicy, TestGetSecurityPolicyL) |
|
51 { |
|
52 _LIT(KDummy, "dummy"); |
|
53 iSecurityPolicy = GetSecurityPolicyL(0 /* security policy flags */, KNullDesC()); |
|
54 CHECK(iSecurityPolicy != NULL); |
|
55 iSecurityPolicy = GetSecurityPolicyL(0 /* security policy flags */, KDummy); |
|
56 CHECK(iSecurityPolicy != NULL); |
|
57 int error; |
|
58 TRAP(error, iSecurityPolicy->InterfaceVersion()); |
|
59 CHECK(error == KErrNotSupported); |
|
60 TRAP(error, iSecurityPolicy->UntrustedPermissionsL()); |
|
61 CHECK(error == KErrNotSupported); |
|
62 TRAP(error, iSecurityPolicy->PermissionsL(KNullDesC())); |
|
63 CHECK(error == KErrNotSupported); |
|
64 TRAP(error, iSecurityPolicy->ProtectionDomainL(KNullDesC())); |
|
65 CHECK(error == KErrNotSupported); |
|
66 TRAP(error, iSecurityPolicy->UntrustedProtectionDomainL()); |
|
67 CHECK(error == KErrNotSupported); |
|
68 } |