os/security/crypto/weakcryptospi/test/tcryptospi/src/symmetriccipherpositiveobjectloadstep.cpp
Update contrib.
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Example CTestStep derived implementation
24 #include "symmetriccipherpositiveobjectloadstep.h"
26 #include <cryptospi/cryptosymmetriccipherapi.h>
27 #include <cryptospi/keys.h>
28 #include "filereader.h"
30 using namespace CryptoSpi;
32 CSymmetricCipherPositiveObjectLoadStep::~CSymmetricCipherPositiveObjectLoadStep()
37 CSymmetricCipherPositiveObjectLoadStep::CSymmetricCipherPositiveObjectLoadStep()
39 SetTestStepName(KSymmetricCipherPositiveObjectLoadStep);
43 TVerdict CSymmetricCipherPositiveObjectLoadStep::doTestStepPreambleL()
45 SetTestStepResult(EPass);
46 return TestStepResult();
50 TVerdict CSymmetricCipherPositiveObjectLoadStep::doTestStepL()
53 INFO_PRINTF1(_L("*** Symmetric Cipher - Positive Object Load ***"));
54 INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
56 if (TestStepResult()==EPass)
59 //Assume failure, unless all is successful
60 SetTestStepResult(EFail);
62 TVariantPtrC operationMode;
64 TBool shouldLoad(EFalse);
66 // Create a Symmetric Cipher with the values from the ini file
67 CryptoSpi::CSymmetricCipher * impl = NULL;
70 TRAPD(err, SetupCipherL(ETrue, EFalse, operationMode, impl, key));
73 if(impl && err==KErrNone)
75 INFO_PRINTF1(_L("*** Symmetric Cipher - Positive Object Load: PASS ***"));
78 SetTestStepResult(EPass);
80 else if (!impl && err==KErrNotSupported &&
81 GetBoolFromConfig(ConfigSection(),_L("ShouldLoad"), shouldLoad) &&
84 INFO_PRINTF1(_L("*** Symmetric Cipher - The object was not loaded which was expected ***"));
85 INFO_PRINTF1(_L("*** Symmetric Cipher - Positive Object Load: PASS ***"));
86 SetTestStepResult(EPass);
90 ERR_PRINTF2(_L("*** FAIL: Failed to Create Symmetric Cipher Object - %d ***"), err);
91 SetTestStepResult(EFail);
95 INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
97 return TestStepResult();
101 TVerdict CSymmetricCipherPositiveObjectLoadStep::doTestStepPostambleL()
103 return TestStepResult();