natplugins/natpnatfwsdpprovider/tsrc/testconsole/src/nspreleasetest.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  NAT FW SDP Provider test console release tests impl.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <e32cons.h>
       
    20 #include <centralrepository.h>
       
    21 #include "nspplugin.h"
       
    22 #include "nspreleasetest.h"
       
    23 #include "nsptestconsolesession.h"
       
    24 #include "nsptestconsolestream.h"
       
    25 #include "nsptestasyncservice.h"
       
    26 #include "nsptestconsolemacros.h"
       
    27 
       
    28 _LIT( KRelease, "Release test" );
       
    29 _LIT( KNewSession, "NewSession test" );
       
    30 _LIT( KCreateOffer, "CreateOffer test" );
       
    31 _LIT( KDecodeAnswer, "DecodeAnswer test" );
       
    32 _LIT( KResolve, "Resolve test" );
       
    33 _LIT( KUpdate, "Update test" );
       
    34 
       
    35 #define PTR_DEL( aPtr ) delete aPtr; aPtr = NULL
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CNSPReleaseTest::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 // 
       
    41 CNSPReleaseTest* CNSPReleaseTest::NewL( CNSPPlugin& aApi, CRepository& aRep )
       
    42     {
       
    43     CNSPReleaseTest* self = CNSPReleaseTest::NewLC( aApi, aRep );
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CNSPReleaseTest::NewLC
       
    50 // -----------------------------------------------------------------------------
       
    51 // 
       
    52 CNSPReleaseTest* CNSPReleaseTest::NewLC( CNSPPlugin& aApi, CRepository& aRep )
       
    53     {
       
    54     CNSPReleaseTest* self = new ( ELeave ) CNSPReleaseTest;
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL( aApi, aRep );
       
    57     return self;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CNSPReleaseTest::~CNSPReleaseTest
       
    62 // -----------------------------------------------------------------------------
       
    63 // 
       
    64 CNSPReleaseTest::~CNSPReleaseTest()
       
    65     {
       
    66     iTestArray.ResetAndDestroy();
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CNSPReleaseTest::CNSPReleaseTest
       
    71 // -----------------------------------------------------------------------------
       
    72 // 
       
    73 CNSPReleaseTest::CNSPReleaseTest()
       
    74 	{
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CNSPReleaseTest::ConstructL
       
    79 // -----------------------------------------------------------------------------
       
    80 // 
       
    81 void CNSPReleaseTest::ConstructL( CNSPPlugin& aApi, CRepository& aRep )
       
    82     {
       
    83     CNSPTest* test = NULL;
       
    84     
       
    85     test = CNSPTestNewSession::NewLC( aApi, aRep );
       
    86     iTestArray.AppendL( test );
       
    87     CleanupStack::Pop( test );
       
    88     
       
    89     test = CNSPTestCreateOffer::NewLC( aApi, aRep );
       
    90     iTestArray.AppendL( test );
       
    91     CleanupStack::Pop( test );
       
    92     
       
    93     test = CNSPTestDecodeAnswer::NewLC( aApi, aRep );
       
    94     iTestArray.AppendL( test );
       
    95     CleanupStack::Pop( test );
       
    96     
       
    97     /*
       
    98     test = CNSPTestResolve::NewLC( aApi, aRep );
       
    99     iTestArray.AppendL( test );
       
   100     CleanupStack::Pop( test );
       
   101     
       
   102 	test = CNSPTestUpdate::NewLC( aApi, aRep );
       
   103     iTestArray.AppendL( test );
       
   104     CleanupStack::Pop( test );
       
   105     */
       
   106 	}
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CNSPReleaseTest::SetupL
       
   110 // -----------------------------------------------------------------------------
       
   111 // 
       
   112 void CNSPReleaseTest::SetupL()
       
   113 	{
       
   114     iResult.iDescription.Copy( KRelease() );
       
   115 	}
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CNSPReleaseTest::Teardown
       
   119 // -----------------------------------------------------------------------------
       
   120 // 
       
   121 void CNSPReleaseTest::Teardown()
       
   122 	{
       
   123 	TResult::TState result;
       
   124 	iResult.iState = TResult::EPass;
       
   125 	
       
   126 	for ( TInt i = 0; i < iTestArray.Count(); i++ )
       
   127 		{
       
   128 		result = iTestArray[i]->State();
       
   129 		iResult.iState = ( TResult::EPass != result ?
       
   130 				 TResult::EFail : iResult.iState );
       
   131 		}
       
   132 	}
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CNSPReleaseTest::ExecuteL
       
   136 // -----------------------------------------------------------------------------
       
   137 // 
       
   138 void CNSPReleaseTest::ExecuteL( CConsoleBase& aConsole )
       
   139 	{
       
   140 	for ( TInt i = 0; i < iTestArray.Count(); i++ )
       
   141 		{
       
   142 		iTestArray[i]->StartL( aConsole );
       
   143 		}
       
   144 	}
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CNSPReleaseTest::Cancel
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 void CNSPReleaseTest::Cancel()
       
   151 	{
       
   152 	for ( TInt i = 0; i < iTestArray.Count(); i++ )
       
   153 		{
       
   154 		iTestArray[i]->Cancel();
       
   155 		}
       
   156 	}
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CNSPReleaseTest::CNSPTestNewSession::AcceptL
       
   160 // -----------------------------------------------------------------------------
       
   161 // 
       
   162 void CNSPReleaseTest::AcceptL( MNSPTestVisitor& aVisitor )
       
   163 	{
       
   164 	aVisitor.VisitL( *this );
       
   165 	
       
   166 	for ( TInt i = 0; i < iTestArray.Count(); i++ )
       
   167 		{
       
   168 		iTestArray[i]->AcceptL( aVisitor );
       
   169 		}
       
   170 	}
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CNSPReleaseTest::CNSPTestNewSession::NewLC
       
   174 // -----------------------------------------------------------------------------
       
   175 // 
       
   176 CNSPReleaseTest::CNSPTestNewSession* CNSPReleaseTest::CNSPTestNewSession::NewLC(
       
   177 		CNSPPlugin& aApi, CRepository& aRep )
       
   178 	{
       
   179 	CNSPReleaseTest::CNSPTestNewSession* self =
       
   180 			new ( ELeave ) CNSPReleaseTest::CNSPTestNewSession( aApi, aRep );
       
   181 	CleanupStack::PushL( self );
       
   182 	self->ConstructL();
       
   183 	return self;
       
   184 	}
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CNSPReleaseTest::CNSPTestNewSession::ConstructL
       
   188 // -----------------------------------------------------------------------------
       
   189 // 
       
   190 CNSPReleaseTest::CNSPTestNewSession::CNSPTestNewSession( CNSPPlugin& aApi, CRepository& aRep )
       
   191 	: iApi( aApi ),
       
   192 	  iRep( aRep )
       
   193 	{
       
   194 	}
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CNSPReleaseTest::CNSPTestNewSession::ConstructL
       
   198 // -----------------------------------------------------------------------------
       
   199 // 
       
   200 void CNSPReleaseTest::CNSPTestNewSession::ConstructL()
       
   201 	{
       
   202 	iAsyncService = CNSPTestAsyncService::NewL( iTimerStatus );
       
   203 	}
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CNSPReleaseTest::CNSPTestNewSession::CNSPTestNewSession
       
   207 // -----------------------------------------------------------------------------
       
   208 // 
       
   209 CNSPReleaseTest::CNSPTestNewSession::~CNSPTestNewSession()
       
   210 	{
       
   211 	PTR_DEL( iAsyncService );
       
   212 	}
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CNSPReleaseTest::CNSPTestNewSession::SetupL
       
   216 // -----------------------------------------------------------------------------
       
   217 // 
       
   218 void CNSPReleaseTest::CNSPTestNewSession::SetupL()
       
   219 	{
       
   220 	iResult.iDescription.Copy( KNewSession() );
       
   221 	}
       
   222 
       
   223 // -----------------------------------------------------------------------------
       
   224 // CNSPReleaseTest::CNSPTestNewSession::Teardown
       
   225 // -----------------------------------------------------------------------------
       
   226 // 
       
   227 void CNSPReleaseTest::CNSPTestNewSession::Teardown()
       
   228 	{
       
   229 	PTR_DEL( iSession );
       
   230 	}
       
   231 
       
   232 // -----------------------------------------------------------------------------
       
   233 // CNSPReleaseTest::CNSPTestNewSession::ExecuteL
       
   234 // -----------------------------------------------------------------------------
       
   235 // 
       
   236 void CNSPReleaseTest::CNSPTestNewSession::ExecuteL( CConsoleBase& aConsole )
       
   237 	{
       
   238 	PTR_DEL( iSession );
       
   239 	iSession = CNSPTestConsoleSession::NewL( iApi, iRep, *iAsyncService );
       
   240 	WAIT( aConsole, "INITIALIZED" );
       
   241 	iAsyncService->StartScheduler(); // BLOCKING until callback(Initialized)
       
   242 	COMPLETED_L( aConsole, "INITIALIZED",  iTimerStatus );
       
   243 	__ASSERT( CNSPTestConsoleSession::EIdle == iSession->State() );
       
   244 	}
       
   245 
       
   246 // -----------------------------------------------------------------------------
       
   247 // CNSPReleaseTest::CNSPTestNewSession::Cancel
       
   248 // -----------------------------------------------------------------------------
       
   249 // 
       
   250 void CNSPReleaseTest::CNSPTestNewSession::Cancel()
       
   251 	{
       
   252 	iAsyncService->Cancel();
       
   253 	}
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CNSPReleaseTest::CNSPTestCreateOffer::NewLC
       
   257 // -----------------------------------------------------------------------------
       
   258 // 
       
   259 CNSPReleaseTest::CNSPTestCreateOffer* CNSPReleaseTest::CNSPTestCreateOffer::NewLC(
       
   260 		CNSPPlugin& aApi, CRepository& aRep )
       
   261 	{
       
   262 	CNSPReleaseTest::CNSPTestCreateOffer* self =
       
   263 			new ( ELeave ) CNSPReleaseTest::CNSPTestCreateOffer( aApi, aRep );
       
   264 	CleanupStack::PushL( self );
       
   265 	self->ConstructL();
       
   266 	return self;
       
   267 	}
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CNSPReleaseTest::CNSPTestCreateOffer::ConstructL
       
   271 // -----------------------------------------------------------------------------
       
   272 // 
       
   273 CNSPReleaseTest::CNSPTestCreateOffer::CNSPTestCreateOffer( CNSPPlugin& aApi, CRepository& aRep )
       
   274 	: CNSPTestNewSession( aApi, aRep )
       
   275 	{
       
   276 	}
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 // CNSPReleaseTest::CNSPTestCreateOffer::ConstructL
       
   280 // -----------------------------------------------------------------------------
       
   281 // 
       
   282 void CNSPReleaseTest::CNSPTestCreateOffer::ConstructL()
       
   283 	{
       
   284 	CNSPTestNewSession::ConstructL();
       
   285 	}
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // CNSPReleaseTest::CNSPTestNewSession::CNSPTestCreateOffer
       
   289 // -----------------------------------------------------------------------------
       
   290 // 
       
   291 CNSPReleaseTest::CNSPTestCreateOffer::~CNSPTestCreateOffer()
       
   292 	{
       
   293 	}
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CNSPReleaseTest::CNSPTestCreateOffer::SetupL
       
   297 // -----------------------------------------------------------------------------
       
   298 // 
       
   299 void CNSPReleaseTest::CNSPTestCreateOffer::SetupL()
       
   300 	{
       
   301 	iResult.iDescription.Copy( KCreateOffer() );
       
   302 	}
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CNSPReleaseTest::CNSPTestCreateOffer::Teardown
       
   306 // -----------------------------------------------------------------------------
       
   307 // 
       
   308 void CNSPReleaseTest::CNSPTestCreateOffer::Teardown()
       
   309 	{
       
   310 	PTR_DEL( iSession );
       
   311 	}
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 // CNSPReleaseTest::CNSPTestCreateOffer::ExecuteL
       
   315 // -----------------------------------------------------------------------------
       
   316 // 
       
   317 void CNSPReleaseTest::CNSPTestCreateOffer::ExecuteL( CConsoleBase& aConsole )
       
   318 	{
       
   319 	CNSPTestNewSession::ExecuteL( aConsole ); // BLOCKING until callback.(Initialized)
       
   320 	
       
   321 	CTestConsoleStream* outStream = CTestConsoleStream::NewL();
       
   322 	iSession->StoreOutStream( outStream ); // ownership changed.
       
   323 	TNatReturnStatus status = iSession->CreateOfferL( *outStream );
       
   324 	
       
   325 	if ( KNatAsync == status )
       
   326 		{
       
   327 		__ASSERT( CNSPTestConsoleSession::ECreateOffer == iSession->State() );
       
   328 		WAIT( aConsole, "OFFER READY" );
       
   329 		iAsyncService->StartScheduler(); // BLOCKING until callback(OfferReady)
       
   330 		COMPLETED_L( aConsole, "OFFER READY",  iTimerStatus );
       
   331 		}
       
   332 	
       
   333 	__ASSERT( CNSPTestConsoleSession::EIdle == iSession->State() );
       
   334 	}
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CNSPReleaseTest::CNSPTestCreateOffer::NewLC
       
   338 // -----------------------------------------------------------------------------
       
   339 // 
       
   340 CNSPReleaseTest::CNSPTestDecodeAnswer* CNSPReleaseTest::CNSPTestDecodeAnswer::NewLC(
       
   341 		CNSPPlugin& aApi, CRepository& aRep )
       
   342 	{
       
   343 	CNSPReleaseTest::CNSPTestDecodeAnswer* self =
       
   344 			new ( ELeave ) CNSPReleaseTest::CNSPTestDecodeAnswer( aApi, aRep );
       
   345 	CleanupStack::PushL( self );
       
   346 	self->ConstructL();
       
   347 	return self;
       
   348 	}
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // CNSPReleaseTest::CNSPTestDecodeAnswer::CNSPTestDecodeAnswer
       
   352 // -----------------------------------------------------------------------------
       
   353 // 
       
   354 CNSPReleaseTest::CNSPTestDecodeAnswer::CNSPTestDecodeAnswer( CNSPPlugin& aApi, CRepository& aRep )
       
   355 	: CNSPTestCreateOffer( aApi, aRep )
       
   356 	{
       
   357 	}
       
   358 
       
   359 // -----------------------------------------------------------------------------
       
   360 // CNSPReleaseTest::CNSPTestDecodeAnswer::ConstructL
       
   361 // -----------------------------------------------------------------------------
       
   362 // 
       
   363 void CNSPReleaseTest::CNSPTestDecodeAnswer::ConstructL()
       
   364 	{
       
   365 	CNSPTestCreateOffer::ConstructL();
       
   366 	}
       
   367 
       
   368 // -----------------------------------------------------------------------------
       
   369 // CNSPReleaseTest::CNSPTestDecodeAnswer::CNSPTestDecodeAnswer
       
   370 // -----------------------------------------------------------------------------
       
   371 // 
       
   372 CNSPReleaseTest::CNSPTestDecodeAnswer::~CNSPTestDecodeAnswer()
       
   373 	{
       
   374 	}
       
   375 
       
   376 // -----------------------------------------------------------------------------
       
   377 // CNSPReleaseTest::CNSPTestDecodeAnswer::SetupL
       
   378 // -----------------------------------------------------------------------------
       
   379 // 
       
   380 void CNSPReleaseTest::CNSPTestDecodeAnswer::SetupL()
       
   381 	{
       
   382 	iResult.iDescription.Copy( KDecodeAnswer() );
       
   383 	}
       
   384 
       
   385 // -----------------------------------------------------------------------------
       
   386 // CNSPReleaseTest::CNSPTestDecodeAnswer::Teardown
       
   387 // -----------------------------------------------------------------------------
       
   388 // 
       
   389 void CNSPReleaseTest::CNSPTestDecodeAnswer::Teardown()
       
   390 	{
       
   391 	PTR_DEL( iSession );
       
   392 	}
       
   393 
       
   394 // -----------------------------------------------------------------------------
       
   395 // CNSPReleaseTest::CNSPTestDecodeAnswer::ExecuteL
       
   396 // -----------------------------------------------------------------------------
       
   397 // 
       
   398 void CNSPReleaseTest::CNSPTestDecodeAnswer::ExecuteL( CConsoleBase& aConsole )
       
   399 	{
       
   400 	CNSPTestCreateOffer::ExecuteL( aConsole ); // BLOCKING until callback.(OfferReady)
       
   401 	
       
   402 	CTestConsoleStream* inStream = CTestConsoleStream::NewL();
       
   403 	iSession->StoreInStream( inStream ); // ownership changed.
       
   404 	TNatReturnStatus status = iSession->DecodeAnswerL( *inStream );
       
   405 	
       
   406 	if ( KNatAsync == status )
       
   407 		{
       
   408 		__ASSERT( CNSPTestConsoleSession::EDecodeAnswer == iSession->State() );
       
   409 		WAIT( aConsole, "ANSWER READY" );
       
   410 		iAsyncService->StartScheduler(); // BLOCKING until callback(AnswerReady)
       
   411 		COMPLETED_L( aConsole, "ANSWER READY",  iTimerStatus );
       
   412 		}
       
   413 	
       
   414 	__ASSERT( CNSPTestConsoleSession::EIdle == iSession->State() );
       
   415 	}
       
   416 
       
   417 // -----------------------------------------------------------------------------
       
   418 // CNSPReleaseTest::CNSPTestResolve::NewLC
       
   419 // -----------------------------------------------------------------------------
       
   420 // 
       
   421 CNSPReleaseTest::CNSPTestResolve* CNSPReleaseTest::CNSPTestResolve::NewLC(
       
   422 		CNSPPlugin& aApi, CRepository& aRep )
       
   423 	{
       
   424 	CNSPReleaseTest::CNSPTestResolve* self =
       
   425 	new ( ELeave ) CNSPReleaseTest::CNSPTestResolve( aApi, aRep );
       
   426 	CleanupStack::PushL( self );
       
   427 	self->ConstructL();
       
   428 	return self;
       
   429 	}
       
   430 
       
   431 // -----------------------------------------------------------------------------
       
   432 // CNSPReleaseTest::CNSPTestResolve::CNSPTestResolve
       
   433 // -----------------------------------------------------------------------------
       
   434 // 
       
   435 CNSPReleaseTest::CNSPTestResolve::CNSPTestResolve( CNSPPlugin& aApi, CRepository& aRep )
       
   436 	: CNSPTestNewSession( aApi, aRep )
       
   437 	{
       
   438 	}
       
   439 
       
   440 // -----------------------------------------------------------------------------
       
   441 // CNSPReleaseTest::CNSPTestResolve::ConstructL
       
   442 // -----------------------------------------------------------------------------
       
   443 // 
       
   444 void CNSPReleaseTest::CNSPTestResolve::ConstructL()
       
   445 	{
       
   446 	CNSPTestNewSession::ConstructL();
       
   447 	}
       
   448 
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // CNSPReleaseTest::CNSPTestResolve::~CNSPTestResolve
       
   452 // -----------------------------------------------------------------------------
       
   453 // 
       
   454 CNSPReleaseTest::CNSPTestResolve::~CNSPTestResolve()
       
   455 	{
       
   456 	}
       
   457 
       
   458 // -----------------------------------------------------------------------------
       
   459 // CNSPReleaseTest::CNSPTestResolve::SetupL
       
   460 // -----------------------------------------------------------------------------
       
   461 // 
       
   462 void CNSPReleaseTest::CNSPTestResolve::SetupL()
       
   463 	{
       
   464 	iResult.iDescription.Copy( KResolve() );
       
   465 	}
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 // CNSPReleaseTest::CNSPTestResolve::Teardown
       
   469 // -----------------------------------------------------------------------------
       
   470 // 
       
   471 void CNSPReleaseTest::CNSPTestResolve::Teardown()
       
   472 	{
       
   473 	PTR_DEL( iSession );
       
   474 	}
       
   475 
       
   476 // -----------------------------------------------------------------------------
       
   477 // CNSPReleaseTest::CNSPTestResolve::ExecuteL
       
   478 // -----------------------------------------------------------------------------
       
   479 // 
       
   480 void CNSPReleaseTest::CNSPTestResolve::ExecuteL( CConsoleBase& aConsole )
       
   481 	{
       
   482 	CNSPTestNewSession::ExecuteL( aConsole ); // BLOCKING until callback.(Initialized)
       
   483 	
       
   484 	CTestConsoleStream* inStream = CTestConsoleStream::NewL();
       
   485 	iSession->StoreInStream( inStream ); // ownership changed.
       
   486 	CTestConsoleStream* outStream = CTestConsoleStream::NewL();
       
   487 	iSession->StoreInStream( outStream ); // ownership changed.
       
   488 	
       
   489 	TNatReturnStatus status = iSession->ResolveL( *inStream, *outStream );
       
   490 	
       
   491 	if ( KNatAsync == status )
       
   492 		{
       
   493 		__ASSERT( CNSPTestConsoleSession::ECreateAnswer == iSession->State() );
       
   494 		WAIT( aConsole, "ANSWER READY" );
       
   495 		iAsyncService->StartScheduler(); // BLOCKING until callback(AnswerReady)
       
   496 		COMPLETED_L( aConsole, "ANSWER READY",  iTimerStatus );
       
   497 		
       
   498 		__ASSERT( CNSPTestConsoleSession::EDecodeOffer == iSession->State() );
       
   499 		WAIT( aConsole, "OFFER READY" );
       
   500 		iAsyncService->StartScheduler(); // BLOCKING until callback(OfferReady)
       
   501 		COMPLETED_L( aConsole, "OFFER READY",  iTimerStatus );
       
   502 		}
       
   503 	
       
   504 	__ASSERT( CNSPTestConsoleSession::EIdle == iSession->State() );
       
   505 	}
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CNSPReleaseTest::CNSPTestUpdate::NewLC
       
   509 // -----------------------------------------------------------------------------
       
   510 // 
       
   511 CNSPReleaseTest::CNSPTestUpdate* CNSPReleaseTest::CNSPTestUpdate::NewLC(
       
   512 		CNSPPlugin& aApi, CRepository& aRep )
       
   513 	{
       
   514 	CNSPReleaseTest::CNSPTestUpdate* self =
       
   515 	new ( ELeave ) CNSPReleaseTest::CNSPTestUpdate( aApi, aRep );
       
   516 	CleanupStack::PushL( self );
       
   517 	self->ConstructL();
       
   518 	return self;
       
   519 	}
       
   520 
       
   521 // -----------------------------------------------------------------------------
       
   522 // CNSPReleaseTest::CNSPTestUpdate::CNSPTestUpdate
       
   523 // -----------------------------------------------------------------------------
       
   524 // 
       
   525 CNSPReleaseTest::CNSPTestUpdate::CNSPTestUpdate( CNSPPlugin& aApi, CRepository& aRep )
       
   526 	: CNSPTestNewSession( aApi, aRep )
       
   527 	{
       
   528 	}
       
   529 
       
   530 // -----------------------------------------------------------------------------
       
   531 // CNSPReleaseTest::CNSPTestUpdate::ConstructL
       
   532 // -----------------------------------------------------------------------------
       
   533 // 
       
   534 void CNSPReleaseTest::CNSPTestUpdate::ConstructL()
       
   535 	{
       
   536 	CNSPTestNewSession::ConstructL();
       
   537 	}
       
   538 
       
   539 
       
   540 // -----------------------------------------------------------------------------
       
   541 // CNSPReleaseTest::CNSPTestUpdate::~CNSPTestUpdate
       
   542 // -----------------------------------------------------------------------------
       
   543 // 
       
   544 CNSPReleaseTest::CNSPTestUpdate::~CNSPTestUpdate()
       
   545 	{
       
   546 	}
       
   547 
       
   548 // -----------------------------------------------------------------------------
       
   549 // CNSPReleaseTest::CNSPTestUpdate::SetupL
       
   550 // -----------------------------------------------------------------------------
       
   551 // 
       
   552 void CNSPReleaseTest::CNSPTestUpdate::SetupL()
       
   553 	{
       
   554 	iResult.iDescription.Copy( KResolve() );
       
   555 	}
       
   556 
       
   557 // -----------------------------------------------------------------------------
       
   558 // CNSPReleaseTest::CNSPTestUpdate::Teardown
       
   559 // -----------------------------------------------------------------------------
       
   560 // 
       
   561 void CNSPReleaseTest::CNSPTestUpdate::Teardown()
       
   562 	{
       
   563 	PTR_DEL( iSession );
       
   564 	}
       
   565 
       
   566 // -----------------------------------------------------------------------------
       
   567 // CNSPReleaseTest::CNSPTestUpdate::ExecuteL
       
   568 // -----------------------------------------------------------------------------
       
   569 // 
       
   570 void CNSPReleaseTest::CNSPTestUpdate::ExecuteL( CConsoleBase& aConsole )
       
   571 	{
       
   572 	CNSPTestNewSession::ExecuteL( aConsole ); // BLOCKING until callback.(Initialized)
       
   573 	
       
   574 	CTestConsoleStream* inStream = CTestConsoleStream::NewL();
       
   575 	iSession->StoreInStream( inStream ); // ownership changed.
       
   576 	CTestConsoleStream* outStream = CTestConsoleStream::NewL();
       
   577 	iSession->StoreInStream( outStream ); // ownership changed.
       
   578 	
       
   579 	TNatReturnStatus status = iSession->ResolveL( *inStream, *outStream );
       
   580 	
       
   581 	if ( KNatAsync == status )
       
   582 		{
       
   583 		__ASSERT( CNSPTestConsoleSession::ECreateAnswer == iSession->State() );
       
   584 		WAIT( aConsole, "ANSWER READY" );
       
   585 		iAsyncService->StartScheduler(); // BLOCKING until callback(AnswerReady)
       
   586 		COMPLETED_L( aConsole, "ANSWER READY",  iTimerStatus );
       
   587 		
       
   588 		inStream = CTestConsoleStream::NewL();
       
   589 		iSession->StoreInStream( inStream ); // ownership changed.
       
   590 		iSession->UpdateL( *inStream ); // TBD: ASSERT NO LEAVE
       
   591 		
       
   592 		__ASSERT( CNSPTestConsoleSession::EDecodeOffer == iSession->State() );
       
   593 		WAIT( aConsole, "OFFER READY" );
       
   594 		iAsyncService->StartScheduler(); // BLOCKING until callback(OfferReady)
       
   595 		COMPLETED_L( aConsole, "OFFER READY",  iTimerStatus );
       
   596 		}
       
   597 	
       
   598 	__ASSERT( CNSPTestConsoleSession::EIdle == iSession->State() );
       
   599 	}
       
   600