os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestManagerTest/TestManagerStateAccessor.inl
Update contrib.
1 // Copyright (c) 1997-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // The implementation of the accessor class upon the CTestManager
18 // ______________________________________________________________________________
20 _LIT(KTTestManager_DumpName,"C:\\System\\Data\\Logs\\TTestManager_StateDump.bin");
22 inline TInt TTestManager_StateAccessor::InvariantTest(TAny* aTestObject)
26 CTestManager* theTestManager = REINTERPRET_CAST(CTestManager*, aTestObject);
27 if(theTestManager->iTestList == NULL)
33 inline TInt TTestManager_StateAccessor::Internalize(TAny* aTestObject)
35 TInt error = KErrNone;
36 if(aTestObject != NULL)
38 CTestManager* theTestManager = REINTERPRET_CAST(CTestManager*, aTestObject);
39 TRAP(error,InternalizeL(theTestManager));
44 inline TInt TTestManager_StateAccessor::Externalize(TAny* aTestObject)
46 TInt error = KErrNone;
47 if(aTestObject != NULL)
49 CTestManager* theTestManager = REINTERPRET_CAST(CTestManager*, aTestObject);
50 TRAP(error,ExternalizeL(theTestManager));
55 inline void TTestManager_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CTestManager* /* aLoadManager */)
60 inline void TTestManager_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CTestManager* /* aLoadManager */)
65 inline void TTestManager_StateAccessor::RunL(CTestManager& aTestMan)
70 inline void TTestManager_StateAccessor::TestComponentL(CTestManager& aTestMan, TInt& aComponentIndex)
72 aTestMan.TestComponentL(aComponentIndex);
75 inline void TTestManager_StateAccessor::ActivateManager(CTestManager& aTestMan)
78 aTestMan.iStatus = KRequestPending;
82 inline void TTestManager_StateAccessor::InternalizeL(CTestManager* aTestManager)
84 // Read in the dumped data
86 User::LeaveIfError(fs.Connect());
87 CleanupClosePushL(fs);
88 // Read the object dump
90 filename.Set(KTTestManager_DumpName(),NULL,NULL);
91 RFileReadStream stream;
92 User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead));
93 CleanupClosePushL(stream);
94 InternalizeL(stream, aTestManager);
95 CleanupStack::PopAndDestroy(2); // stream & fs
98 inline void TTestManager_StateAccessor::ExternalizeL(CTestManager* aTestManager)
101 User::LeaveIfError(fs.Connect());
102 CleanupClosePushL(fs);
103 // Write out the object dump
105 filename.Set(KTTestManager_DumpName(),NULL,NULL);
106 RFileWriteStream stream;
107 User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite));
108 CleanupClosePushL(stream);
109 ExternalizeL(stream, aTestManager);
110 CleanupStack::PopAndDestroy(2); // stream & fs