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