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