mmplugins/lib3gpunittest/src/tsu_3gplibrary.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2008-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 #include "tsu_3gplibrary.h"
       
    17 #include "tsu3gplibraryapi.h"
       
    18 #include "tsu3gplibraryapinegative.h"
       
    19 #include "tsu_3gplibrary_composer_api.h"
       
    20 #include "tsu_3gplibrary_parse_compose.h"
       
    21 #include "tsu_3gplibrary_parse_and_check.h"
       
    22 
       
    23 _LIT(KServerName, "tsu_3gplibrary");
       
    24 
       
    25 C3GPLibraryServer* C3GPLibraryServer::NewL()
       
    26 	{
       
    27 	C3GPLibraryServer* server = new (ELeave) C3GPLibraryServer();
       
    28 	CleanupStack::PushL(server);	
       
    29 	server-> ConstructL(KServerName);
       
    30 	CleanupStack::Pop(server);
       
    31 	return server;
       
    32 	}
       
    33 
       
    34 LOCAL_C void MainL()
       
    35 	{
       
    36 	// Leave the hooks in for platform security
       
    37 #if (defined __DATA_CAGING__)
       
    38 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    39 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    40 #endif
       
    41 	CActiveScheduler* sched = NULL;
       
    42 	sched = new(ELeave)CActiveScheduler;
       
    43 	CActiveScheduler::Install(sched);
       
    44 	C3GPLibraryServer* server = NULL;
       
    45 	// Create the C3GPLibraryServer derived server
       
    46 	TRAPD(err,server = C3GPLibraryServer::NewL());
       
    47 	if(!err)
       
    48 		{
       
    49 		RProcess::Rendezvous(KErrNone);
       
    50 		sched->Start();
       
    51 		}
       
    52 	delete server;
       
    53 	delete sched;
       
    54 	}
       
    55 	
       
    56 GLDEF_C TInt E32Main()
       
    57 /**
       
    58  * @return - Standard Epoc error code on exit
       
    59  */
       
    60 	{
       
    61 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    62 	if(cleanup == NULL)
       
    63 		{
       
    64 		return KErrNoMemory;
       
    65 		}
       
    66 	TRAP_IGNORE(MainL());
       
    67 	delete cleanup;
       
    68 	return KErrNone;
       
    69     }
       
    70    
       
    71 CTestStep* C3GPLibraryServer::CreateTestStep(const TDesC& aStepName)
       
    72 /**
       
    73  * @return - A CTestStep derived instance
       
    74  * Implementation of CTestServer pure virtual
       
    75  */
       
    76 	{
       
    77 	CTestStep* testStep = NULL;
       
    78 
       
    79 	// C++ wrapper parser API tests
       
    80 	if(aStepName == KTestCase_0001)
       
    81 		{
       
    82 		testStep = new C3GPLibParser_0001();
       
    83 		}
       
    84 	else if(aStepName == KTestCase_0002)
       
    85 		{
       
    86 		testStep = new C3GPLibParser_0002();
       
    87 		}
       
    88 	else if(aStepName == KTestCase_0003)
       
    89 		{
       
    90 		testStep = new C3GPLibParser_0003();
       
    91 		}
       
    92 	else if(aStepName == KTestCase_0004)
       
    93 		{
       
    94 		testStep = new C3GPLibParser_0004();
       
    95 		}
       
    96 	else if(aStepName == KTestCase_0005)
       
    97 		{
       
    98 		testStep = new C3GPLibParser_0005();
       
    99 		}
       
   100 	else if(aStepName == KTestCase_0006)
       
   101 		{
       
   102 		testStep = new C3GPLibParser_0006();
       
   103 		}
       
   104 	else if(aStepName == KTestCase_0007)
       
   105 		{
       
   106 		testStep = new C3GPLibParser_0007();
       
   107 		}
       
   108 	else if(aStepName == KTestCase_0008)
       
   109 		{
       
   110 		testStep = new C3GPLibParser_0008();
       
   111 		}
       
   112 	else if(aStepName == KTestCase_0011)
       
   113 		{
       
   114 		testStep = new C3GPLibParser_0011();
       
   115 		}
       
   116 	else if(aStepName == KTestCase_0014)
       
   117 		{
       
   118 		testStep = new C3GPLibParser_0014();
       
   119 		}
       
   120 	else if(aStepName == KTestCase_0015)
       
   121 		{
       
   122 		testStep = new C3GPLibParser_0015();
       
   123 		}
       
   124 	else if(aStepName == KTestCase_0016)
       
   125 		{
       
   126 		testStep = new C3GPLibParser_0016();
       
   127 		}
       
   128 	else if(aStepName == KTestCase_0017)
       
   129 		{
       
   130 		testStep = new C3GPLibParser_0017();
       
   131 		}
       
   132 	else if(aStepName == KTestCase_0021)
       
   133 		{
       
   134 		testStep = new C3GPLibParser_0021();
       
   135 		}
       
   136 	else if(aStepName == KTestCase_0023)
       
   137 		{
       
   138 		testStep = new C3GPLibParser_0023();
       
   139 		}
       
   140 	else if(aStepName == KTestCase_0027)
       
   141 		{
       
   142 		testStep = new C3GPLibParser_0027();
       
   143 		}
       
   144 	else if(aStepName == KTestCase_0031)
       
   145 		{
       
   146 		testStep = new C3GPLibParser_0031();
       
   147 		}
       
   148 	else if(aStepName == KTestCase_0032)
       
   149 		{
       
   150 		testStep = new C3GPLibParser_0032();
       
   151 		}
       
   152 	else if(aStepName == KTestCase_0033)
       
   153 		{
       
   154 		testStep = new C3GPLibParser_0033();
       
   155 		}
       
   156 	else if(aStepName == KTestCase_0034)
       
   157 		{
       
   158 		testStep = new C3GPLibParser_0034();
       
   159 		}
       
   160 	else if(aStepName == KTestCase_0035)
       
   161 		{
       
   162 		testStep = new C3GPLibParser_0035();
       
   163 		}
       
   164 	else if(aStepName == KTestCase_0036)
       
   165 		{
       
   166 		testStep = new C3GPLibParser_0036();
       
   167 		}
       
   168 	else if(aStepName == KTestCase_0037)
       
   169 		{
       
   170 		testStep = new C3GPLibParser_0037();
       
   171 		}
       
   172 	else if(aStepName == KTestCase_0038)
       
   173 		{
       
   174 		testStep = new C3GPLibParser_0038();
       
   175 		}
       
   176 	else if(aStepName == KTestCase_0039)
       
   177 		{
       
   178 		testStep = new C3GPLibParser_0039();
       
   179 		}
       
   180 	else if(aStepName == KTestCase_0041)
       
   181 		{
       
   182 		testStep = new C3GPLibParser_0041();
       
   183 		}
       
   184 	else if(aStepName == KTestCase_0043)
       
   185 		{
       
   186 		testStep = new C3GPLibParser_0043();
       
   187 		}
       
   188 	else if(aStepName == KTestCase_0045)
       
   189 		{
       
   190 		testStep = new C3GPLibParser_0045();
       
   191 		}
       
   192 	else if(aStepName == KTestCase_0047)
       
   193 		{
       
   194 		testStep = new C3GPLibParser_0047();
       
   195 		}
       
   196 	else if(aStepName == KTestCase_0101)
       
   197 		{
       
   198 		testStep = new C3GPLibParser_0101();
       
   199 		}
       
   200 	else if(aStepName == KTestCase_0102)
       
   201 		{
       
   202 		testStep = new C3GPLibParser_0102();
       
   203 		}
       
   204 	else if(aStepName == KTestCase_0104)
       
   205 		{
       
   206 		testStep = new C3GPLibParser_0104();
       
   207 		}
       
   208 	else if(aStepName == KTestCase_0106)
       
   209 		{
       
   210 		testStep = new C3GPLibParser_0106();
       
   211 		}
       
   212 	else if(aStepName == KTestCase_0107)
       
   213 		{
       
   214 		testStep = new C3GPLibParser_0107();
       
   215 		}
       
   216 	else if(aStepName == KTestCase_0108)
       
   217 		{
       
   218 		testStep = new C3GPLibParser_0108();
       
   219 		}
       
   220 	else if(aStepName == KTestCase_0109)
       
   221 		{
       
   222 		testStep = new C3GPLibParser_0109();
       
   223 		}
       
   224 	else if(aStepName == KTestCase_0110)
       
   225 		{
       
   226 		testStep = new C3GPLibParser_0110();
       
   227 		}
       
   228 	else if(aStepName == KTestCase_0111)
       
   229 		{
       
   230 		testStep = new C3GPLibParser_0111();
       
   231 		}
       
   232 	else if(aStepName == KTestCase_0119)
       
   233 		{
       
   234 		testStep = new C3GPLibParser_0119();
       
   235 		}
       
   236 	else if(aStepName == KTestCase_0120)
       
   237 		{
       
   238 		testStep = new C3GPLibParser_0120();
       
   239 		}
       
   240 	else if(aStepName == KTestCase_0126)
       
   241 		{
       
   242 		testStep = new C3GPLibParser_0126();
       
   243 		}
       
   244 	else if(aStepName == KTestCase_0127)
       
   245 		{
       
   246 		testStep = new C3GPLibParser_0127();
       
   247 		}
       
   248 	else if(aStepName == KTestCase_0130)
       
   249 		{
       
   250 		testStep = new C3GPLibParser_0130();
       
   251 		}
       
   252 	else if(aStepName == KTestCase_0131)
       
   253 		{
       
   254 		testStep = new C3GPLibParser_0131();
       
   255 		}
       
   256 	else if(aStepName == KTestCase_0135)
       
   257 		{
       
   258 		testStep = new C3GPLibParser_0135();
       
   259 		}
       
   260 	else if(aStepName == KTestCase_0136)
       
   261 		{
       
   262 		testStep = new C3GPLibParser_0136();
       
   263 		}
       
   264 	else if(aStepName == KTestCase_0137)
       
   265 		{
       
   266 		testStep = new C3GPLibParser_0137();
       
   267 		}
       
   268 	else if(aStepName == KTestCase_0138)
       
   269 		{
       
   270 		testStep = new C3GPLibParser_0138();
       
   271 		}
       
   272 	else if(aStepName == KTestCase_0139)
       
   273 		{
       
   274 		testStep = new C3GPLibParser_0139();
       
   275 		}
       
   276 	else if (aStepName == K3GPSingleDataSourceTest)
       
   277 		{		
       
   278 		testStep = new C3GPSingleDataSourceTest();
       
   279 		}
       
   280 	else if (aStepName == KTestUserDataAtomRetrieval)	
       
   281 		{		
       
   282 		testStep = new C3GPUserDataAtomRetrieval();
       
   283 		}
       
   284 
       
   285 	// Composer: API Tests
       
   286 	else if (aStepName == K3GPComposeFilename)
       
   287 		{
       
   288 		testStep = new C3GPLibComposeFilename();
       
   289 		}
       
   290 	else if(aStepName == K3GPComposeWithoutOpen)
       
   291 		{
       
   292 		testStep = new C3GPLibComposeWithoutOpen();
       
   293 		}	
       
   294 	else if(aStepName == K3GPComposeFileWithFileFormatCheck)
       
   295 		{
       
   296 		testStep = new C3GPLibComposeFileWithFileFormatCheck();
       
   297 		}
       
   298 	else if (aStepName == K3GPComposeFrameDependency)
       
   299 		{
       
   300 		testStep = new C3GPLibComposeFrameDependency();
       
   301 		}
       
   302 	else if (aStepName == K3GPComposeVideoProperties)
       
   303 		{
       
   304 		testStep = new C3GPLibComposeVideoProperties();
       
   305 		}
       
   306 	else if (aStepName == K3GPComposeWithSpecificBufferSize)
       
   307 		{
       
   308 		testStep = new C3GPLibComposeWithSpecificBufferSize();
       
   309 		}
       
   310 	else if (aStepName == K3GPComposeUserData)
       
   311 		{
       
   312 		testStep = new C3GPLibComposeUserData();
       
   313 		}
       
   314 	else if (aStepName == K3GPComposeWithFlag)
       
   315 		{
       
   316 		testStep = new C3GPLibComposeWithFlag();
       
   317 		}
       
   318 	else if (aStepName == K3GPComposeAudioProperties)
       
   319 		{
       
   320 		testStep = new C3GPLibComposeAudioProperties();
       
   321 		}
       
   322 	else if (aStepName == K3GPComposeWithNoAudioVideo)
       
   323 		{
       
   324 		testStep = new C3GPLibComposeWithNoAudioVideo();
       
   325 		}
       
   326 	else if (aStepName == K3GPComposeWithNoAudioVideo)
       
   327 		{
       
   328 		testStep = new C3GPLibComposeWithNoAudioVideo();
       
   329 		}
       
   330 	else if (aStepName == K3GPComposeOpenAgain)
       
   331 		{
       
   332 		testStep = new C3GPLibComposeOpenAgain();
       
   333 		}
       
   334 	else if (aStepName == K3GPComposeAudioFrames)
       
   335 		{
       
   336 		testStep = new C3GPLibComposeAudioFrames();
       
   337 		}
       
   338 	else if (aStepName == K3GPComposeVideoFrame)
       
   339 		{
       
   340 		testStep = new C3GPLibComposeVideoFrame();
       
   341 		}
       
   342 	else if (aStepName == K3GPComposeOpenReadOnlyFile)
       
   343 		{
       
   344 		testStep = new C3GPLibComposeOpenReadOnlyFile();
       
   345 		}
       
   346 	else if (aStepName == K3GPComposeOpenedFile)
       
   347 		{
       
   348 		testStep = new C3GPLibComposeOpenedFile();
       
   349 		}
       
   350 	else if (aStepName == K3GPComposeMultiComposeOnSameFile)
       
   351 		{
       
   352 		testStep = new C3GPLibComposeMultiComposeOnSameFile();
       
   353 		}
       
   354 	else if (aStepName == K3GPComposeMultiComposers)
       
   355 		{
       
   356 		testStep = new C3GPLibComposeMultiComposers();
       
   357 		}
       
   358 	else if (aStepName == K3GPComposeCloseComposerWithoutComplete)
       
   359 		{
       
   360 		testStep = new C3GPLibComposeCloseComposerWithoutComplete();
       
   361 		}
       
   362 	else if (aStepName == K3GPComposePanic)
       
   363 		{
       
   364 		testStep = new C3GPLibComposePanic();
       
   365 		}		
       
   366 	else if (aStepName == K3GPComposeLargeFile)
       
   367 		{
       
   368 		testStep = new C3GPLibComposeLargeFile();
       
   369 		}
       
   370 	else if (aStepName == K3GPComposeLargeFileUserData)
       
   371 		{
       
   372 		testStep = new C3GPLibComposeLargeFileUserData();
       
   373 		}
       
   374 	else if (aStepName == K3GPComposeLargeFile32bitAPI)
       
   375 		{
       
   376 		testStep = new C3GPLibComposeLargeFile32bitAPI();
       
   377 		}
       
   378 	else if (aStepName == K3GPComposeLargeFileDiskFull)
       
   379 		{
       
   380 		testStep = new C3GPLibComposeLargeFileDiskFull();
       
   381 		}
       
   382 	// Composer: file format test
       
   383 	else if (aStepName == K3GPParseComposeFile)
       
   384 		{
       
   385 		testStep = new C3GPLibParseComposeFile();
       
   386 		}
       
   387 	// AVC profile test
       
   388 	else if (aStepName == K3GPComposeFileWithAvcProfileCheck)
       
   389 	    {
       
   390 	    testStep = new C3GPLibComposeFileWithAvcProfileCheck();
       
   391 	    }
       
   392 	// Main & High profile parse
       
   393 	else if (aStepName == K3GPLibParseAndCheckTypes)
       
   394 	    {
       
   395 	    testStep = new C3GPLibParseAndCheckTypes();
       
   396 	    }
       
   397 
       
   398 	return testStep;
       
   399 	}