omxil/omxilunittest/contentpipe/src/tsu_omxil_dummycontentpipe.cpp
changeset 56 b6488ac24ddc
parent 47 481b3bce574a
child 57 1cbb0d5bf7f2
equal deleted inserted replaced
47:481b3bce574a 56:b6488ac24ddc
     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 <e32base.h>
       
    17 
       
    18 #include <openmax/il/core/omxilcontentpipeif.h>
       
    19 
       
    20 #include "../../test_plugins/dummy_cp/src/omxildummycontentpipe.hrh"
       
    21 #include "../../test_plugins/dummy_cp_2/src/omxildummycontentpipe2.hrh"
       
    22 #include "tsu_omxil_dummycontentpipe.h"
       
    23 
       
    24 char* const KTestUri = "http://www.symbian.com";
       
    25 const TInt KTestOffset = 5;
       
    26 
       
    27 /**
       
    28  *
       
    29  * CTestStep_OMXIL_DummyContentPipe constructor
       
    30  *
       
    31  * @xxxx
       
    32  * 
       
    33  */
       
    34 CTestStep_OMXIL_DummyContentPipe::CTestStep_OMXIL_DummyContentPipe() 
       
    35 	{
       
    36 	}
       
    37 
       
    38 /**
       
    39  *
       
    40  * CTestStep_OMXIL_DummyContentPipe destructor
       
    41  *
       
    42  * @xxxx
       
    43  * 
       
    44  */
       
    45 CTestStep_OMXIL_DummyContentPipe::~CTestStep_OMXIL_DummyContentPipe()
       
    46 	{
       
    47 	}
       
    48 
       
    49 TVerdict CTestStep_OMXIL_DummyContentPipe::DoTestStepPreambleL()
       
    50 	{
       
    51 	TVerdict verdict = EPass;
       
    52 
       
    53 	return verdict;
       
    54 	}
       
    55 
       
    56 TVerdict CTestStep_OMXIL_DummyContentPipe::DoTestStepPostambleL()
       
    57 	{
       
    58 	TVerdict verdict = EPass;
       
    59 
       
    60 	return verdict;
       
    61 	}
       
    62 
       
    63 
       
    64 CTestStep_OMXIL_DummyContentPipe_U_0001::CTestStep_OMXIL_DummyContentPipe_U_0001()
       
    65 	/** Constructor
       
    66 	*/
       
    67 	{
       
    68 	// store the name of this test case
       
    69 	// this is the name that is used by the script file
       
    70 	// Each test step initialises it's own name
       
    71 	iTestStepName = _L("MM-OMXIL-DummyContentPipe-U-0001");
       
    72 	}
       
    73 
       
    74 
       
    75 TVerdict CTestStep_OMXIL_DummyContentPipe_U_0001::DoTestStepL( void )
       
    76 /** 
       
    77  * Call the COmxILContentPipeIf::CreateImplementationL(..) with the Dummy Content Pipe UID.
       
    78  * Call COmxILContentPipeIf::GetHandle(..), verify the return value is 0. 
       
    79  * Destroy the COmxILContentPipeIf object and verify there isn't any memory leak.
       
    80 
       
    81  * Use case: N/A
       
    82  * @test Req. under test REQ8336
       
    83  */
       
    84 	{
       
    85 	INFO_PRINTF1(_L("Setting UHEAP_MARK"));
       
    86 	__MM_HEAP_MARK;
       
    87 
       
    88 	TVerdict verdict = EPass;
       
    89 	TInt err;
       
    90 	COmxILContentPipeIf* dummyContentPipeIf = NULL;
       
    91 	OMX_HANDLETYPE contentPipeHandle;
       
    92 
       
    93 	INFO_PRINTF1(_L("Attempting to Create Content Pipe Interface"));
       
    94 	TRAP(err, dummyContentPipeIf = COmxILContentPipeIf::CreateImplementationL(TUid::Uid(KUidOmxILDummyContentPipe)));
       
    95 	INFO_PRINTF2(_L("Content Pipe Interface Created: %d"), err);
       
    96 	if(err != KErrNone)
       
    97 		{
       
    98 		verdict = EFail;
       
    99 		}
       
   100 
       
   101 	INFO_PRINTF1(_L("Attempting to Init Content Pipe"));
       
   102 	err = dummyContentPipeIf->GetHandle(&contentPipeHandle);
       
   103 	INFO_PRINTF2(_L("Content Pipe initialised: %d"), err);
       
   104 	if(err != KErrNone)
       
   105 		{
       
   106 		verdict = EFail;
       
   107 		}
       
   108 	
       
   109 	delete dummyContentPipeIf;
       
   110 	REComSession::FinalClose();
       
   111 
       
   112 	INFO_PRINTF1(_L("Setting UHEAP_MARKEND"));
       
   113 	__MM_HEAP_MARKEND;
       
   114  
       
   115 	return verdict;
       
   116 	}
       
   117 
       
   118 
       
   119 //------------------------------------------------------------------
       
   120 
       
   121 CTestStep_OMXIL_DummyContentPipe_U_0002::CTestStep_OMXIL_DummyContentPipe_U_0002()
       
   122 /** Constructor
       
   123 */
       
   124 	{
       
   125 	// store the name of this test case
       
   126 	// this is the name that is used by the script file
       
   127 	// Each test step initialises it's own name
       
   128 	iTestStepName = _L("MM-OMXIL-DummyContentPipe-U-0002");
       
   129 	}
       
   130 
       
   131 
       
   132 TVerdict CTestStep_OMXIL_DummyContentPipe_U_0002::DoTestStepL( void )
       
   133 /** 
       
   134 * Call the COmxILContentPipeIf::CreateImplementationL(..) with the Dummy Content Pipe UID.
       
   135 * Call COmxILContentPipeIf::GetHandle(..), verify the return value is 0. 
       
   136 * Call CP_PIPETYPE::Create(..), verify the return value is 0.
       
   137 * Call the CP_PIPETYPE::Close(), verify the return value is 0.
       
   138 * Destroy the COmxILContentPipeIf object and verify there isn't any memory leak.
       
   139 
       
   140 * Use case: N/A
       
   141 * @test Req. under test REQ8336
       
   142 */
       
   143 	{
       
   144 	INFO_PRINTF1(_L("Setting UHEAP_MARK"));
       
   145 	__MM_HEAP_MARK;
       
   146 	
       
   147 	TVerdict verdict = EPass;
       
   148 	TInt err;
       
   149 	COmxILContentPipeIf* dummyContentPipeIf = NULL;
       
   150 	OMX_HANDLETYPE contentPipeHandle;
       
   151 	CPhandle contentSourceHandle;
       
   152 	
       
   153 	INFO_PRINTF1(_L("Attempting to Create Content Pipe Interface"));
       
   154 	TRAP(err, dummyContentPipeIf = COmxILContentPipeIf::CreateImplementationL(TUid::Uid(KUidOmxILDummyContentPipe)));
       
   155 	INFO_PRINTF2(_L("Content Pipe Interface Created: %d"), err);
       
   156 	if(err != KErrNone)
       
   157 		{
       
   158 		verdict = EFail;
       
   159 		}
       
   160 	
       
   161 	INFO_PRINTF1(_L("Attempting to Init Content Pipe"));
       
   162 	err = dummyContentPipeIf->GetHandle(&contentPipeHandle);
       
   163 	INFO_PRINTF2(_L("Content Pipe initialised: %d"), err);
       
   164 	if(err != KErrNone)
       
   165 		{
       
   166 		verdict = EFail;
       
   167 		}
       
   168 	
       
   169 	INFO_PRINTF1(_L("Attempting to Create Content Source"));
       
   170 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Create(&contentSourceHandle, KTestUri);
       
   171 	INFO_PRINTF2(_L("Content Source created: %d"), err);
       
   172 	if(err != KErrNone)
       
   173 		{
       
   174 		verdict = EFail;
       
   175 		}
       
   176 	
       
   177 	INFO_PRINTF1(_L("Attempting to Close Content Source"));
       
   178 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Close(contentSourceHandle);
       
   179 	INFO_PRINTF2(_L("Content Source closed: %d"), err);
       
   180 	if(err != KErrNone)
       
   181 		{
       
   182 		verdict = EFail;
       
   183 		}
       
   184 	
       
   185 	delete dummyContentPipeIf;
       
   186 	REComSession::FinalClose();
       
   187 	
       
   188 	INFO_PRINTF1(_L("Setting UHEAP_MARKEND"));
       
   189 	__MM_HEAP_MARKEND;
       
   190 	
       
   191 	return verdict;
       
   192 	}
       
   193 
       
   194 
       
   195 //------------------------------------------------------------------
       
   196 
       
   197 CTestStep_OMXIL_DummyContentPipe_U_0003::CTestStep_OMXIL_DummyContentPipe_U_0003()
       
   198 /** Constructor
       
   199 */
       
   200 	{
       
   201 	// store the name of this test case
       
   202 	// this is the name that is used by the script file
       
   203 	// Each test step initialises it's own name
       
   204 	iTestStepName = _L("MM-OMXIL-DummyContentPipe-U-0003");
       
   205 	}
       
   206 
       
   207 
       
   208 TVerdict CTestStep_OMXIL_DummyContentPipe_U_0003::DoTestStepL( void )
       
   209 /** 
       
   210 * Call the COmxILContentPipeIf::CreateImplementationL(..) with the Dummy Content Pipe UID.
       
   211 * Call COmxILContentPipeIf::GetHandle(..), verify the return value is 0. 
       
   212 * Call CP_PIPETYPE::Create(..), verify the return value is 0.
       
   213 * Call CP_PIPETYPE::SetPosition(), verify the return value is 0.
       
   214 * Call CP_PIPETYPE::GetPosition(), verify the return value is 0. Verify the position has been set correctly
       
   215 * Call the CP_PIPETYPE::Close(), verify the return value is 0.
       
   216 * Destroy the COmxILContentPipeIf object and verify there isn't any memory leak.
       
   217 
       
   218 * Use case: N/A
       
   219 * @test Req. under test REQ8336
       
   220 */
       
   221 	{
       
   222 	INFO_PRINTF1(_L("Setting UHEAP_MARK"));
       
   223 	__MM_HEAP_MARK;
       
   224 	
       
   225 	TVerdict verdict = EPass;
       
   226 	TInt err;
       
   227 	COmxILContentPipeIf* dummyContentPipeIf = NULL;
       
   228 	OMX_HANDLETYPE contentPipeHandle;
       
   229 	CPhandle contentSourceHandle;
       
   230 	
       
   231 	INFO_PRINTF1(_L("Attempting to Create Content Pipe Interface"));
       
   232 	TRAP(err, dummyContentPipeIf = COmxILContentPipeIf::CreateImplementationL(TUid::Uid(KUidOmxILDummyContentPipe)));
       
   233 	INFO_PRINTF2(_L("Content Pipe Interface Created: %d"), err);
       
   234 	if(err != KErrNone)
       
   235 		{
       
   236 		verdict = EFail;
       
   237 		}
       
   238 	
       
   239 	INFO_PRINTF1(_L("Attempting to Init Content Pipe"));
       
   240 	err = dummyContentPipeIf->GetHandle(&contentPipeHandle);
       
   241 	INFO_PRINTF2(_L("Content Pipe initialised: %d"), err);
       
   242 	if(err != KErrNone)
       
   243 		{
       
   244 		verdict = EFail;
       
   245 		}
       
   246 	
       
   247 	INFO_PRINTF1(_L("Attempting to Create Content Source"));
       
   248 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Create(&contentSourceHandle, KTestUri);
       
   249 	INFO_PRINTF2(_L("Content Source created: %d"), err);
       
   250 	if(err != KErrNone)
       
   251 		{
       
   252 		verdict = EFail;
       
   253 		}
       
   254 	
       
   255 	INFO_PRINTF1(_L("Calling SetPosition()"));
       
   256 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->SetPosition(contentSourceHandle, KTestOffset, CP_OriginBegin);
       
   257 	INFO_PRINTF2(_L("SetPosition() called: %d"), err);
       
   258 	if(err != KErrNone)
       
   259 		{
       
   260 		verdict = EFail;
       
   261 		}
       
   262 	
       
   263 	INFO_PRINTF1(_L("Calling GetPosition()..."));
       
   264 	TUint32 pos;
       
   265 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->GetPosition(contentSourceHandle, &pos);
       
   266 	INFO_PRINTF2(_L("GetPosition() called: %d"), err);
       
   267 	if(err != KErrNone || pos != KTestOffset)
       
   268 		{
       
   269 		verdict = EFail;
       
   270 		}
       
   271 	
       
   272 	INFO_PRINTF1(_L("Attempting to Close Content Source"));
       
   273 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Close(contentSourceHandle);
       
   274 	INFO_PRINTF2(_L("Content Source closed: %d"), err);
       
   275 	if(err != KErrNone)
       
   276 		{
       
   277 		verdict = EFail;
       
   278 		}
       
   279 	
       
   280 	delete dummyContentPipeIf;
       
   281 	REComSession::FinalClose();
       
   282 	
       
   283 	INFO_PRINTF1(_L("Setting UHEAP_MARKEND"));
       
   284 	__MM_HEAP_MARKEND;
       
   285 	
       
   286 	return verdict;
       
   287 	}
       
   288 
       
   289 
       
   290 //------------------------------------------------------------------
       
   291 
       
   292 CTestStep_OMXIL_DummyContentPipe_U_0004::CTestStep_OMXIL_DummyContentPipe_U_0004()
       
   293 /** Constructor
       
   294 */
       
   295 	{
       
   296 	// store the name of this test case
       
   297 	// this is the name that is used by the script file
       
   298 	// Each test step initialises it's own name
       
   299 	iTestStepName = _L("MM-OMXIL-DummyContentPipe-U-0004");
       
   300 	}
       
   301 
       
   302 
       
   303 TVerdict CTestStep_OMXIL_DummyContentPipe_U_0004::DoTestStepL( void )
       
   304 /** 
       
   305 * Call the COmxILContentPipeIf::CreateImplementationL(..) with the Dummy Content Pipe 2 UID.
       
   306 * Call COmxILContentPipeIf::GetHandle(..), verify the return value is 0. 
       
   307 * Call CP_PIPETYPE::Create(..), verify the return value is 0.
       
   308 * Call CP_PIPETYPE::SetPosition(), verify the return value is 0.
       
   309 * Call CP_PIPETYPE::GetPosition(), verify the return value is 0. Verify the position has been set correctly
       
   310 * Call the CP_PIPETYPE::Close(), verify the return value is 0.
       
   311 * Destroy the COmxILContentPipeIf object and verify there isn't any memory leak.
       
   312 
       
   313 * Use case: N/A
       
   314 * @test Req. under test REQ8336
       
   315 */
       
   316 	{
       
   317 	INFO_PRINTF1(_L("Setting UHEAP_MARK"));
       
   318 	__MM_HEAP_MARK;
       
   319 	
       
   320 	TVerdict verdict = EPass;
       
   321 	TInt err;
       
   322 	COmxILContentPipeIf* dummyContentPipeIf = NULL;
       
   323 	OMX_HANDLETYPE contentPipeHandle;
       
   324 	CPhandle contentSourceHandle;
       
   325 	
       
   326 	INFO_PRINTF1(_L("Attempting to Create Content Pipe Interface"));
       
   327 	TRAP(err, dummyContentPipeIf = COmxILContentPipeIf::CreateImplementationL(TUid::Uid(KUidOmxILDummyContentPipe2)));
       
   328 	INFO_PRINTF2(_L("Content Pipe Interface Created: %d"), err);
       
   329 	if(err != KErrNone)
       
   330 		{
       
   331 		verdict = EFail;
       
   332 		}
       
   333 	
       
   334 	INFO_PRINTF1(_L("Attempting to Init Content Pipe"));
       
   335 	err = dummyContentPipeIf->GetHandle(&contentPipeHandle);
       
   336 	INFO_PRINTF2(_L("Content Pipe initialised: %d"), err);
       
   337 	if(err != KErrNone)
       
   338 		{
       
   339 		verdict = EFail;
       
   340 		}
       
   341 	
       
   342 	INFO_PRINTF1(_L("Attempting to Create Content Source"));
       
   343 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Create(&contentSourceHandle, KTestUri);
       
   344 	INFO_PRINTF2(_L("Content Source created: %d"), err);
       
   345 	if(err != KErrNone)
       
   346 		{
       
   347 		verdict = EFail;
       
   348 		}
       
   349 	
       
   350 	INFO_PRINTF1(_L("Calling SetPosition()"));
       
   351 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->SetPosition(contentSourceHandle, KTestOffset, CP_OriginBegin);
       
   352 	INFO_PRINTF2(_L("SetPosition() called: %d"), err);
       
   353 	if(err != KErrNone)
       
   354 		{
       
   355 		verdict = EFail;
       
   356 		}
       
   357 	
       
   358 	INFO_PRINTF1(_L("Calling GetPosition()..."));
       
   359 	TUint32 pos;
       
   360 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->GetPosition(contentSourceHandle, &pos);
       
   361 	INFO_PRINTF2(_L("GetPosition() called: %d"), err);
       
   362 	if(err != KErrNone || pos != KTestOffset)
       
   363 		{
       
   364 		verdict = EFail;
       
   365 		}
       
   366 	
       
   367 	INFO_PRINTF1(_L("Attempting to Close Content Source"));
       
   368 	err = (reinterpret_cast<CP_PIPETYPE*>(contentPipeHandle))->Close(contentSourceHandle);
       
   369 	INFO_PRINTF2(_L("Content Source closed: %d"), err);
       
   370 	if(err != KErrNone)
       
   371 		{
       
   372 		verdict = EFail;
       
   373 		}
       
   374 	
       
   375 	delete dummyContentPipeIf;
       
   376 	REComSession::FinalClose();
       
   377 	
       
   378 	INFO_PRINTF1(_L("Setting UHEAP_MARKEND"));
       
   379 	__MM_HEAP_MARKEND;
       
   380 	
       
   381 	return verdict;
       
   382 	}
       
   383 
       
   384 
       
   385 //------------------------------------------------------------------