messagingfw/msgtestfw/TestActions/Performance/Src/CMtfTestActionSetHeapFailure.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
child 58 6c34d0baa0b1
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2005-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 "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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 
       
    21 #include "CMtfTestActionSetHeapFailure.h"
       
    22 #include "CMtfTestActionManager.h"
       
    23 #include "CMtfTestServer.h"
       
    24 #include "CMtfTestCase.h"
       
    25 #include <msvapi.h>
       
    26 //#include <msvstd.h>
       
    27 #include "CMtfTestParameterStore.h"
       
    28 #include "CMtfTestActionParameters.h"
       
    29 
       
    30 #include <msvapi.h>
       
    31 
       
    32 
       
    33 class CSessionObserver : public MMsvSessionObserver, public CBase
       
    34 	{
       
    35 public: 
       
    36 	void HandleSessionEventL(TMsvSessionEvent,TAny*,TAny*,TAny*) {};
       
    37 	};
       
    38 
       
    39 
       
    40 CMtfTestAction* CMtfTestActionSetHeapFailure::NewL(CMtfTestCase& aTestCase,
       
    41 		CMtfTestActionParameters* aActionParameters)
       
    42 	{
       
    43 	CMtfTestActionSetHeapFailure* self = new (ELeave) CMtfTestActionSetHeapFailure(aTestCase);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL(aActionParameters);
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 	
       
    50 CMtfTestActionSetHeapFailure::CMtfTestActionSetHeapFailure(CMtfTestCase& aTestCase)
       
    51 : CMtfSynchronousTestAction(aTestCase)
       
    52 	{
       
    53 	}
       
    54 
       
    55 void CMtfTestActionSetHeapFailure::ExecuteActionL()
       
    56 	{
       
    57 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetHeapFailure);
       
    58 	RFs fs; 
       
    59 	RMsvServerSession server;
       
    60 	
       
    61 	fs.Connect();
       
    62 	server.Connect(fs);
       
    63 
       
    64 	server.SetFailure(EHeapFailure, RHeap::ETrueRandom);
       
    65 
       
    66 	CSessionObserver* sessionObserver = new (ELeave) CSessionObserver;
       
    67 
       
    68 	TRAPD(err, CMsvSession* paramSession = CMsvSession::OpenSyncL(*sessionObserver));
       
    69 	ASSERT(err==KErrNoMemory);
       
    70 	delete sessionObserver;
       
    71 	server.SetFailure(EHeapFailure, RHeap::ENone);
       
    72 	server.Close();
       
    73 	fs.Close();
       
    74 
       
    75 	User::After(100000); // wait
       
    76 	
       
    77 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetHeapFailure);
       
    78 	TestCase().ActionCompletedL(*this);
       
    79 	}
       
    80 
       
    81 CMtfTestActionSetHeapFailure::~CMtfTestActionSetHeapFailure()
       
    82 	{
       
    83 	}