|
1 // Copyright (c) 2007-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 "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 // tkeystreamdecoderconstruct.h |
|
15 // Implements the Key Stream Decoder Construction Test Case |
|
16 // |
|
17 // |
|
18 |
|
19 #include "tkeystreamdecoderconstruct.h" |
|
20 |
|
21 #include "testprotstrdesc.h" |
|
22 #include <caf/streaming/keystreamdecoder.h> |
|
23 |
|
24 using namespace StreamAccess; |
|
25 |
|
26 CScafKeyStreamDecoderConstruct::CScafKeyStreamDecoderConstruct(CScafServer& aParent): CScafStep(aParent) |
|
27 /** |
|
28 * Constructor |
|
29 */ |
|
30 { |
|
31 SetTestStepName(KScafKeyStreamDecoderConstruct); |
|
32 } |
|
33 |
|
34 CScafKeyStreamDecoderConstruct::~CScafKeyStreamDecoderConstruct() |
|
35 /** |
|
36 * Destructor |
|
37 */ |
|
38 { |
|
39 } |
|
40 |
|
41 TVerdict CScafKeyStreamDecoderConstruct::doTestL() |
|
42 { |
|
43 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
|
44 // Assume the test has failed if the test step result hasn't been otherwise set to EPass |
|
45 SetTestStepResult(EFail); |
|
46 |
|
47 //Create an SDP document object and set the created key stream field object |
|
48 CSdpDocument* sdpDoc = CreateSdpDocumentLC(); |
|
49 |
|
50 // Create an SDP media field object from the attributes with the INI configuration section |
|
51 CSdpMediaField* sdp = CreateSdpLC(0); |
|
52 AddMediaFieldL(*sdpDoc, sdp); |
|
53 CleanupStack::Pop(sdp); |
|
54 |
|
55 // Generate a protected key stream description. |
|
56 HBufC* filePath; |
|
57 |
|
58 if(iDecoderConfigurationArray[0]->iPrivateFolderPath.Length()) |
|
59 { |
|
60 filePath = GetFullPathLC(iDecoderConfigurationArray[0]->iPrivateFolderPath, KNullDesC); |
|
61 } |
|
62 else |
|
63 { |
|
64 filePath = GetFullPathLC(KStaPrivateFolder, KNullDesC); |
|
65 } |
|
66 |
|
67 CTestProtectedStreamDesc* protectStreamDesc = CTestProtectedStreamDesc::NewL(*filePath); |
|
68 CleanupStack::PopAndDestroy(filePath); |
|
69 CleanupStack::PushL(protectStreamDesc); |
|
70 |
|
71 // Create a key stream decoder |
|
72 CKeyStreamDecoder* decoder = NULL; |
|
73 |
|
74 TRAPD(err,decoder = CKeyStreamDecoder::NewL(*protectStreamDesc, *sdp, *sdpDoc)); |
|
75 |
|
76 if(decoder && (err == KErrNone)) |
|
77 { |
|
78 delete decoder; |
|
79 INFO_PRINTF1(_L("*** SUCCESS: Key Stream Decoder Successfully Constructed ***")); |
|
80 SetTestStepResult(EPass); |
|
81 } |
|
82 else |
|
83 { |
|
84 ERR_PRINTF1(_L("*** FAIL: Unsuccessful Construction of Key Stream Decoder ***")); |
|
85 User::Leave(err); |
|
86 } |
|
87 |
|
88 // Delete the protected stream descriptor |
|
89 CleanupStack::PopAndDestroy(2, sdpDoc); //< protectStreamDesc, sdpDoc |
|
90 #endif |
|
91 return TestStepResult(); |
|
92 } |