|
1 /* |
|
2 * Copyright (c) 2008-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 the License "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 /** |
|
20 @file |
|
21 @test |
|
22 */ |
|
23 |
|
24 #include "scrwritedevicedata.h" |
|
25 |
|
26 #include <usif/scr/scr.h> |
|
27 #include <e32def.h> |
|
28 |
|
29 _LIT(KScrWriteDeviceDataSecName, "SCR WriteDeviceData APIs test"); |
|
30 |
|
31 using namespace Usif; |
|
32 |
|
33 CScrWriteDeviceDataSecTest* CScrWriteDeviceDataSecTest::NewL() |
|
34 { |
|
35 CScrWriteDeviceDataSecTest* self=new(ELeave) CScrWriteDeviceDataSecTest(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 CScrWriteDeviceDataSecTest::CScrWriteDeviceDataSecTest() |
|
43 { |
|
44 SetCapabilityRequired(ECapabilityWriteDeviceData); |
|
45 } |
|
46 |
|
47 void CScrWriteDeviceDataSecTest::ConstructL() |
|
48 { |
|
49 SetNameL(KScrWriteDeviceDataSecName); |
|
50 } |
|
51 |
|
52 void CScrWriteDeviceDataSecTest::RunTestL() |
|
53 { |
|
54 RSoftwareComponentRegistry scrSession; |
|
55 User::LeaveIfError(scrSession.Connect()); |
|
56 CleanupClosePushL(scrSession); |
|
57 |
|
58 TInt err(0); |
|
59 // SetIsComponentDrmProtectedL API |
|
60 TRAP(err, scrSession.SetIsComponentDrmProtectedL(1, ETrue)); |
|
61 CheckFailL(err, _L("SetIsComponentDrmProtectedL - set as DRM protected")); |
|
62 |
|
63 TRAP(err, scrSession.SetIsComponentDrmProtectedL(1, EFalse)); |
|
64 CheckFailL(err, _L("SetIsComponentDrmProtectedL - set as non-DRM protected")); |
|
65 |
|
66 // SetIsComponentHiddenL API |
|
67 TRAP(err, scrSession.SetIsComponentHiddenL(1, ETrue)); |
|
68 CheckFailL(err, _L("SetIsComponentHiddenL - set as hidden")); |
|
69 |
|
70 TRAP(err, scrSession.SetIsComponentHiddenL(1, EFalse)); |
|
71 CheckFailL(err, _L("SetIsComponentHiddenL - set as visible")); |
|
72 |
|
73 // SetIsComponentKnownRevokedL API |
|
74 TRAP(err, scrSession.SetIsComponentKnownRevokedL(1, ETrue)); |
|
75 CheckFailL(err, _L("SetIsComponentKnownRevokedL - set as known-revoked")); |
|
76 |
|
77 TRAP(err, scrSession.SetIsComponentKnownRevokedL(1, EFalse)); |
|
78 CheckFailL(err, _L("SetIsComponentKnownRevokedL - set as non-known-revoked")); |
|
79 |
|
80 // SetIsComponentOriginVerifiedL API |
|
81 TRAP(err, scrSession.SetIsComponentOriginVerifiedL(1, ETrue)); |
|
82 CheckFailL(err, _L("SetIsComponentOriginVerifiedL - set as origin-verified")); |
|
83 |
|
84 TRAP(err, scrSession.SetIsComponentOriginVerifiedL(1, EFalse)); |
|
85 CheckFailL(err, _L("SetIsComponentOriginVerifiedL - set as non-origin-verified")); |
|
86 |
|
87 CleanupStack::PopAndDestroy(&scrSession); |
|
88 } |