|
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 // Implements the Key Stream Decoder Query Attribute Test Case |
|
15 // |
|
16 // |
|
17 |
|
18 #include "tkeystreamdecoderattributes.h" |
|
19 |
|
20 #include "testprotstrdesc.h" |
|
21 #include <caf/streaming/keystreamdecoder.h> |
|
22 |
|
23 using namespace StreamAccess; |
|
24 |
|
25 CScafKeyStreamDecoderAttributes::CScafKeyStreamDecoderAttributes(CScafServer& aParent) : CScafStep(aParent) |
|
26 /** |
|
27 * Constructor |
|
28 */ |
|
29 { |
|
30 SetTestStepName(KScafKeyStreamDecoderAttributes); |
|
31 } |
|
32 |
|
33 CScafKeyStreamDecoderAttributes::~CScafKeyStreamDecoderAttributes() |
|
34 /** |
|
35 * Destructor |
|
36 */ |
|
37 { |
|
38 } |
|
39 |
|
40 TVerdict CScafKeyStreamDecoderAttributes::doTestStepPreambleL() |
|
41 { |
|
42 __UHEAP_MARK; |
|
43 |
|
44 // Reads the Thread ID |
|
45 RThread thread; |
|
46 iThreadId = thread.Id(); |
|
47 thread.Close(); |
|
48 |
|
49 INFO_PRINTF3(_L("Thread %d - HEAP CELLS: %d"),iThreadId,User::CountAllocCells()); |
|
50 |
|
51 ReadTestConfigurationL(); |
|
52 |
|
53 return TestStepResult(); |
|
54 } |
|
55 |
|
56 TVerdict CScafKeyStreamDecoderAttributes::doTestL() |
|
57 { |
|
58 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
|
59 // Assume faliure, unless all is successful |
|
60 SetTestStepResult(EFail); |
|
61 |
|
62 // Retrieve the expected values from the array constructed using ini configuration data |
|
63 TExpectedKeyStreamDecoderAttributes expectedAttributes = iExpectedKeyStreamDecoderData[0]; |
|
64 |
|
65 //Create an SDP document object and set the created key stream field object |
|
66 CSdpDocument* sdpDoc = CreateSdpDocumentLC(); |
|
67 |
|
68 // Create an SDP media field object from the attributes with the INI configuration section |
|
69 CSdpMediaField* sdp = CreateSdpLC(0); |
|
70 AddMediaFieldL(*sdpDoc, sdp); |
|
71 CleanupStack::Pop(sdp); |
|
72 |
|
73 // Generate a protected key stream description. |
|
74 HBufC* filePath; |
|
75 |
|
76 if(iDecoderConfigurationArray[0]->iPrivateFolderPath.Length()) |
|
77 { |
|
78 filePath = GetFullPathLC(iDecoderConfigurationArray[0]->iPrivateFolderPath, KNullDesC); |
|
79 } |
|
80 else |
|
81 { |
|
82 filePath = GetFullPathLC(KStaPrivateFolder, KNullDesC); |
|
83 } |
|
84 |
|
85 CTestProtectedStreamDesc* protectStreamDesc = CTestProtectedStreamDesc::NewL(*filePath); |
|
86 CleanupStack::PopAndDestroy(filePath); |
|
87 CleanupStack::PushL(protectStreamDesc); |
|
88 |
|
89 // Create a key stream decoder |
|
90 CKeyStreamDecoder* decoder = NULL; |
|
91 |
|
92 TRAPD(err,decoder = CKeyStreamDecoder::NewL(*protectStreamDesc, *sdp, *sdpDoc)); |
|
93 |
|
94 if(!decoder || err != KErrNone) |
|
95 { |
|
96 ERR_PRINTF3(_L("*** Thread %d: FAIL - Unsuccessful Construction of Key Stream Decoder - %d ***"),iThreadId,err); |
|
97 User::Leave(err); |
|
98 } |
|
99 |
|
100 CleanupStack::PushL(decoder); |
|
101 |
|
102 if(CheckKeyStreamDecoderAttributesL(*decoder, expectedAttributes)) |
|
103 { |
|
104 INFO_PRINTF2(_L("*** Thread %d: SUCCESS - Key Stream Decoder Attributes Match Expected Values ***"),iThreadId); |
|
105 SetTestStepResult(EPass); |
|
106 } |
|
107 |
|
108 CleanupStack::PopAndDestroy(3, sdpDoc); //< decoder, protectStreamDesc, sdpDoc |
|
109 #endif |
|
110 return TestStepResult(); |
|
111 } |
|
112 |
|
113 TVerdict CScafKeyStreamDecoderAttributes::doTestStepPostambleL() |
|
114 { |
|
115 iDecoderConfigurationArray.ResetAndDestroy(); |
|
116 iExpectedKeyStreamDecoderData.Close(); |
|
117 |
|
118 INFO_PRINTF3(_L("Thread %d - HEAP CELLS: %d"),iThreadId,User::CountAllocCells()); |
|
119 __UHEAP_MARKEND; |
|
120 |
|
121 return TestStepResult(); |
|
122 } |