baseintegtests/baseintegrationtest/testsuites/sd/src/sdserver.cpp
branchanywhere
changeset 20 d63d727ee0a6
parent 19 f6d3d9676ee4
parent 16 6d8ad5bee44b
child 21 af091391d962
equal deleted inserted replaced
19:f6d3d9676ee4 20:d63d727ee0a6
     1 // Copyright (c) 2007-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 the License "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 #include "sdserver.h"
       
    17 #include "sdbase.h"
       
    18 #include "sdbigfileread.h"
       
    19 #include "sdbigfilewrite.h"
       
    20 #include "sdcheckdisk.h"
       
    21 #include "sdcopyfile.h"
       
    22 #include "sddialogbox.h"
       
    23 #include "sddisplayinfo.h"
       
    24 #include "sdfieldcheck.h"
       
    25 #include "sdfileoperations1.h"
       
    26 #include "sdfileoperations2.h"
       
    27 #include "sdfillsectors.h"
       
    28 #include "sdformat.h"
       
    29 #include "sdreadfiles1.h"
       
    30 #include "sdreadfiles2.h"
       
    31 #include "sdusb.h"
       
    32 
       
    33 /*
       
    34 Constructor. Initialise shareable data.
       
    35 
       
    36 @param None
       
    37 @return None
       
    38 */
       
    39 TBaseTestSDSharedData::TBaseTestSDSharedData()
       
    40 	{
       
    41 	iPartitionBootSector = iTotalSector = iFsType = iNumberOfClusters = iSectorsPerFat = iReservedSectorCount = 0;
       
    42 	}
       
    43 
       
    44 /*
       
    45 Create a new instance of a Test Server
       
    46 
       
    47 @param None
       
    48 @return A pointer to the new Test Server
       
    49 */
       
    50 CBaseTestSDServer* CBaseTestSDServer::NewL()
       
    51 	{
       
    52 	CBaseTestSDServer* server = new (ELeave) CBaseTestSDServer();
       
    53 	CleanupStack::PushL(server);
       
    54 	RProcess handle = RProcess();
       
    55 	TParsePtrC serverName(handle.FileName());
       
    56 	server->ConstructL(serverName.Name());
       
    57 	CleanupStack::Pop(server);
       
    58 	return server;
       
    59 	}
       
    60 
       
    61 /*
       
    62 Constructor. Initialise shareable data.
       
    63 
       
    64 @param None
       
    65 @return None
       
    66 */
       
    67 LOCAL_C void MainL()
       
    68 	{
       
    69 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    70 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    71 
       
    72 	CActiveScheduler* sched=NULL;
       
    73 	sched=new(ELeave) CActiveScheduler;
       
    74 	CActiveScheduler::Install(sched);
       
    75 	CBaseTestSDServer* server = NULL;
       
    76 	TRAPD(err,server = CBaseTestSDServer::NewL());
       
    77 	if(!err)
       
    78 		{
       
    79 		RProcess::Rendezvous(KErrNone);
       
    80 		sched->Start();
       
    81 		}
       
    82 	delete server;
       
    83 	delete sched;
       
    84 	}
       
    85 
       
    86 /*
       
    87 Server Entry Point
       
    88 
       
    89 @param None
       
    90 @return KErrNone if successful or KErrNoMemory if there is not enough memory.
       
    91 */
       
    92 GLDEF_C TInt E32Main()
       
    93 	{
       
    94 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    95 	if(cleanup == NULL)
       
    96 		{
       
    97 		return KErrNoMemory;
       
    98 		}
       
    99 	TRAP_IGNORE(MainL());
       
   100 	delete cleanup;
       
   101 	return KErrNone;
       
   102     }
       
   103 
       
   104 /*
       
   105 Create a new Test Step object.
       
   106 
       
   107 @param aStepName The name of the Test Step to be created
       
   108 @return A pointer to the new Test Step, or NULL if unsuccesful.
       
   109 */
       
   110 CTestStep* CBaseTestSDServer::CreateTestStep(const TDesC& aStepName)
       
   111 	{
       
   112 	CTestStep* testStep = NULL;
       
   113 	
       
   114 	if (aStepName == KTestStepBigFileRead)
       
   115 		{
       
   116 		testStep = new CBaseTestSDBigFileRead();
       
   117 		}
       
   118 	else if (aStepName == KTestStepBigFileWrite)
       
   119 		{
       
   120 		testStep = new CBaseTestSDBigFileWrite();
       
   121 		}
       
   122 	else if (aStepName == KTestStepCheckDisk)
       
   123 		{
       
   124 		testStep = new CBaseTestSDCheckDisk();
       
   125 		}
       
   126 	else if (aStepName == KTestStepCopyFile)
       
   127 		{
       
   128 		testStep = new CBaseTestSDCopyFile();
       
   129 		}
       
   130 	else if (aStepName == KTestStepDialogBox)
       
   131 		{
       
   132 		testStep = new CBaseTestSDDialogBox();
       
   133 		}
       
   134 	else if (aStepName == KTestStepDisplayInfo)
       
   135 		{
       
   136 		testStep = new CBaseTestSDDisplayInfo();
       
   137 		}
       
   138 	else if (aStepName == KTestStepFieldCheck)
       
   139 		{
       
   140 		testStep = new CBaseTestSDFieldCheck(*this);
       
   141 		}
       
   142 	else if (aStepName == KTestStepFileOperations1)
       
   143 		{
       
   144 		testStep = new CBaseTestSDFileOperations1();
       
   145 		}
       
   146 	else if (aStepName == KTestStepFileOperations2)
       
   147 		{
       
   148 		testStep = new CBaseTestSDFileOperations2();
       
   149 		}
       
   150 	else if (aStepName == KTestStepFillSectors)
       
   151 		{
       
   152 		testStep = new CBaseTestSDFillSectors();
       
   153 		}
       
   154 	else if (aStepName == KTestStepFormat)
       
   155 		{
       
   156 		testStep = new CBaseTestSDFormat();
       
   157 		}
       
   158 	else if (aStepName == KTestStepReadFiles1)
       
   159 		{
       
   160 		testStep = new CBaseTestSDReadFiles1();
       
   161 		}
       
   162 	else if (aStepName == KTestStepReadFiles2)
       
   163 		{
       
   164 		testStep = new CBaseTestSDReadFiles2();
       
   165 		}
       
   166 	else if (aStepName == KTestStepUsb)
       
   167 		{
       
   168 		testStep = new CBaseTestSDUsb();
       
   169 		}
       
   170 	return testStep;
       
   171 	}