videoutils_plat/videoconnutility_api/tsrc/src/VCXConnUtilTestBlocks.cpp
branchRCL_3
changeset 23 13a33d82ad98
parent 0 822a42b6c3f1
equal deleted inserted replaced
22:826cea16efd9 23:13a33d82ad98
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:   ?Description*
       
    15 */
       
    16 
       
    17 
       
    18 // [INCLUDE FILES] - do not remove
       
    19 #include <e32svr.h>
       
    20 #include <commdbconnpref.h>
       
    21 #include <centralrepository.h>
       
    22 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
       
    23 
       
    24 #include <StifParser.h>
       
    25 #include <Stiftestinterface.h>
       
    26 
       
    27 #include "VCXConnUtilTest.h"
       
    28 #include "VCXConnUtilTestCommon.h"
       
    29 #include "VCXTestCommon.h"
       
    30 #include "IptvTestUtilALR.h"
       
    31 #include "VCXConnUtilTestSubscriber.h"
       
    32 #include "CIptvTestTimer.h"
       
    33 #include "CIptvTestActiveWait.h"
       
    34 #include "VCXTestTimerWait.h"
       
    35 
       
    36 #include "vcxconnectionutility.h"
       
    37 #include "VCXTestLog.h"
       
    38 
       
    39 // ============================ MEMBER FUNCTIONS ===============================
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CVCXConnUtilTest::Delete
       
    43 // Delete here all resources allocated and opened from test methods.
       
    44 // Called from destructor.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void CVCXConnUtilTest::Delete()
       
    48     {
       
    49     VCXLOGLO2(">>>CVCXConnUtilTest::Delete (%S)", &iName);
       
    50 
       
    51     delete iTestCommon;
       
    52     iTestCommon = NULL;
       
    53 
       
    54     if( iConnectionStatusSubscriber )
       
    55         {
       
    56         iConnectionStatusSubscriber->EndWait();
       
    57         }
       
    58     delete iConnectionStatusSubscriber;
       
    59     iConnectionStatusSubscriber = NULL;
       
    60 
       
    61     if( iIapIdSubscriber )
       
    62         {
       
    63         iIapIdSubscriber->EndWait();
       
    64         }
       
    65     delete iIapIdSubscriber;
       
    66     iIapIdSubscriber = NULL;
       
    67 
       
    68     if( iSnapIdSubscriber )
       
    69         {
       
    70         iSnapIdSubscriber->EndWait();
       
    71         }
       
    72     delete iSnapIdSubscriber;
       
    73     iSnapIdSubscriber = NULL;
       
    74 
       
    75     if( iMasterExistsSubscriber )
       
    76         {
       
    77         iMasterExistsSubscriber->EndWait();
       
    78         }
       
    79     delete iMasterExistsSubscriber;
       
    80     iMasterExistsSubscriber = NULL;
       
    81 
       
    82     if( iNbrConnInstancesSubscriber )
       
    83         {
       
    84         iNbrConnInstancesSubscriber->EndWait();
       
    85         }
       
    86     delete iNbrConnInstancesSubscriber;
       
    87     iNbrConnInstancesSubscriber = NULL;
       
    88 
       
    89     if( iRoamingRequestStatusSubscriber )
       
    90         {
       
    91         iRoamingRequestStatusSubscriber->EndWait();
       
    92         }
       
    93     delete iRoamingRequestStatusSubscriber;
       
    94     iRoamingRequestStatusSubscriber = NULL;
       
    95 
       
    96     if( iNbrRoamRespSubscriber )
       
    97         {
       
    98         iNbrRoamRespSubscriber->EndWait();
       
    99         }
       
   100     delete iNbrRoamRespSubscriber;
       
   101     iNbrRoamRespSubscriber = NULL;
       
   102 
       
   103     if( iNbRoamAcceptedSubscriber )
       
   104         {
       
   105         iNbRoamAcceptedSubscriber->EndWait();
       
   106         }
       
   107     delete iNbRoamAcceptedSubscriber;
       
   108     iNbRoamAcceptedSubscriber = NULL;
       
   109 
       
   110     delete iTesterCountSubscriber;
       
   111     iTesterCountSubscriber = NULL;
       
   112 
       
   113     iWaitedPSChanges.Reset();
       
   114     iWaitedPSChanges.Close();
       
   115 
       
   116     iNotAllowedPSChanges.Reset();
       
   117     iNotAllowedPSChanges.Close();
       
   118 
       
   119     if( iTimeoutTimer )
       
   120         {
       
   121         iTimeoutTimer->CancelTimer();
       
   122         delete iTimeoutTimer;
       
   123         iTimeoutTimer = NULL;
       
   124         }
       
   125 
       
   126     delete iWait;
       
   127     iWait = NULL;
       
   128 
       
   129     if( !iShutdownCalled )
       
   130         {
       
   131         CStifItemParser* fakeParser = NULL;
       
   132         ShutdownTesterL( *fakeParser );
       
   133         }
       
   134 
       
   135     VCXLOGLO2("<<<CVCXConnUtilTest::Delete (%S)", &iName);
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CVCXConnUtilTest::RunMethodL
       
   140 // Run specified method. Contains also table of test mothods and their names.
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 TInt CVCXConnUtilTest::RunMethodL(
       
   144     CStifItemParser& aItem )
       
   145     {
       
   146     static TStifFunctionInfo const KFunctions[] =
       
   147         {
       
   148         // Copy this line for every implemented function.
       
   149         // First string is the function name used in TestScripter script file.
       
   150         // Second is the actual implementation member function.
       
   151         ENTRY( "PrepareCase", CVCXConnUtilTest::PrepareCaseL ),
       
   152         ENTRY( "ShutdownTester", CVCXConnUtilTest::ShutdownTesterL ),
       
   153         ENTRY( "Create", CVCXConnUtilTest::CreateL ),
       
   154         ENTRY( "GetIap", CVCXConnUtilTest::GetIapL ),
       
   155         ENTRY( "WapIdFromIapId", CVCXConnUtilTest::WapIdFromIapIdL ),
       
   156         ENTRY( "Disconnect", CVCXConnUtilTest::DisconnectL ),
       
   157         ENTRY( "CheckProperty", CVCXConnUtilTest::CheckPropertyL ),
       
   158         ENTRY( "SetRoamingAllowed", CVCXConnUtilTest::SetRoamingAllowedL ),
       
   159         ENTRY( "SetLeaveAtRoamingRequest", CVCXConnUtilTest::SetLeaveAtRoamingRequestL ),
       
   160         ENTRY( "SetDelayBeforeRoamingRequest", CVCXConnUtilTest::SetDelayBeforeRoamingRequestL ),
       
   161         ENTRY( "PrintConnUtilDetails", CVCXConnUtilTest::PrintConnUtilDetails ),
       
   162         ENTRY( "AddWaitedProperty", CVCXConnUtilTest::AddWaitedPropertyL ),
       
   163         ENTRY( "AddNotAllowedProperty", CVCXConnUtilTest::AddNotAllowedPropertyL ),
       
   164         ENTRY( "ResetWaitedProperties", CVCXConnUtilTest::ResetWaitedPropertiesL ),
       
   165         ENTRY( "WaitForPropertyQueue", CVCXConnUtilTest::WaitForPropertyQueueL ),
       
   166         };
       
   167 
       
   168     const TInt count = sizeof( KFunctions ) /
       
   169                         sizeof( TStifFunctionInfo );
       
   170 
       
   171     return RunInternalL( KFunctions, count, aItem );
       
   172 
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CVCXMyVideosCollectionPluginTest::PrepareCaseL
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 TInt CVCXConnUtilTest::PrepareCaseL( CStifItemParser& /* aItem */ )
       
   180     {
       
   181     VCXLOGLO1(">>>CVCXConnUtilTest::PrepareCaseL");
       
   182     // Print to UI
       
   183     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   184     _LIT( KWhere, "In PrepareCaseL" );
       
   185     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   186     // Print to log file
       
   187     iLog->Log( KWhere );
       
   188 
       
   189     TInt err = CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory, KVCXConnUtilTestExeGlobalShutdownKey, 1 );
       
   190     if( err != KErrNone )
       
   191         {
       
   192         VCXLOGLO2("CVCXConnUtilTest:: Could not read KVCXConnUtilTestExeGlobalShutdownKey from PS. err: %d", err);
       
   193         }
       
   194 
       
   195     VCXLOGLO1("<<<CVCXConnUtilTest::PrepareCaseL");
       
   196     return KErrNone;
       
   197     }
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 // CVCXMyVideosCollectionPluginTest::ShutdownTesterL
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 TInt CVCXConnUtilTest::ShutdownTesterL( CStifItemParser& /* aItem */ )
       
   204     {
       
   205     VCXLOGLO1(">>>CVCXConnUtilTest::ShutdownTesterL");
       
   206     // Print to UI
       
   207     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   208     _LIT( KWhere, "In ShutdownTesterL" );
       
   209     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   210     // Print to log file
       
   211     iLog->Log( KWhere );
       
   212 
       
   213     iShutdownCalled = ETrue;
       
   214 
       
   215     // Stop listening P&S changes.
       
   216 
       
   217     delete iTesterGetAckResponseSubscriber;
       
   218     iTesterGetAckResponseSubscriber = NULL;
       
   219 
       
   220     delete iTesterResponseSubscriber;
       
   221     iTesterResponseSubscriber = NULL;
       
   222 
       
   223     // Tell tester exe to shutdown.
       
   224 
       
   225     VCXLOGLO1("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandShutdown");
       
   226 
       
   227     CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   228             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandShutdown );
       
   229 
       
   230     User::After( 3000000 );
       
   231 
       
   232     // Check the shutdown.
       
   233 
       
   234     VCXLOGLO2("CVCXConnUtilTest:: Exit type: %d", iProcess.ExitType());
       
   235     VCXLOGLO2("CVCXConnUtilTest:: Exit reason: %d", iProcess.ExitReason());
       
   236     TExitCategoryName exitCatName = iProcess.ExitCategory();
       
   237     VCXLOGLO2("CVCXConnUtilTest:: Exit category: %S", &exitCatName);
       
   238 
       
   239     TInt err = iProcess.ExitReason();
       
   240 
       
   241     if( err == KErrNone && iProcess.ExitType() != EExitKill && exitCatName.Length() == 0 )
       
   242         {
       
   243         VCXLOGLO1("CVCXConnUtilTest:: ERROR: No exit error, no panic but exit type is unusual or exe is stil running.");
       
   244         err = KErrGeneral;
       
   245         }
       
   246 
       
   247     VCXLOGLO1("<<<CVCXConnUtilTest::ShutdownTesterL");
       
   248     return err;
       
   249     }
       
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 // CVCXMyVideosCollectionPluginTest::CreateL
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 TInt CVCXConnUtilTest::CreateL( CStifItemParser& aItem )
       
   256     {
       
   257     // Print to UI
       
   258     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   259     _LIT( KWhere, "In CreateL" );
       
   260     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   261     // Print to log file
       
   262     iLog->Log( KWhere );
       
   263 
       
   264     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   265 
       
   266     TPtrC name;
       
   267     if( aItem.GetNextString( name ) == KErrNone )
       
   268         {
       
   269         iName = name;
       
   270         }
       
   271     else
       
   272         {
       
   273         iName = _L("DEFAULT");
       
   274         }
       
   275 
       
   276     VCXLOGLO2(">>>CVCXConnUtilTest::CreateL (%S) ----->", &iName);
       
   277 
       
   278     if( aItem.GetNextInt( iMode ) != KErrNone )
       
   279         {
       
   280         iMode = KVcxConnUtilTestModeBoth;
       
   281         }
       
   282 
       
   283     iTestCommon = CVCXTestCommon::NewL();
       
   284     iWait = CIptvTestActiveWait::NewL();
       
   285     iTimeoutTimer = CIptvTestTimer::NewL( *this, KTimeoutTimerId );
       
   286     iPSKeyBase = 0;
       
   287 
       
   288     if( iMode == KVcxConnUtilTestModeBoth || iMode == KVcxConnUtilTestModeConnectivity )
       
   289         {
       
   290         CreateTesterProcessL();
       
   291 
       
   292         User::LeaveIfError( CVCXTestCommon::GetPSProperty( KVCXConnUtilTestPScategory, 
       
   293                 KVCXConnUtilTestExeGlobalTesterCount, iPSKeyBase ) );
       
   294         
       
   295         iPSKeyBase = iPSKeyBase * 1000 + iProcess.Id();
       
   296         VCXLOGLO2("CVCXConnUtilTest:: iPSKeyBase: %d", iPSKeyBase);
       
   297         
       
   298         CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   299                 KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandSetName );
       
   300 
       
   301         CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   302                 KVCXConnUtilTestExePsKeyCmdDescParam1 + iPSKeyBase, iName );
       
   303 
       
   304         // Start listening P&S for the tester responses.
       
   305         iTesterGetAckResponseSubscriber = CVCXConnUtilTestSubscriber::NewL( KVCXConnUtilTestPScategory,
       
   306                 KVCXConnUtilTestExePsKeyResponseAck + iPSKeyBase, RProperty::EInt, this );
       
   307         iTesterGetAckResponseSubscriber->Start();
       
   308         VCXLOGLO2("CVCXConnUtilTestExeTester:: Listening P&S key KVCXConnUtilTestExePsKeyResponseAck: %d", KVCXConnUtilTestExePsKeyResponseAck + iPSKeyBase);
       
   309 
       
   310         iTesterResponseSubscriber = CVCXConnUtilTestSubscriber::NewL( KVCXConnUtilTestPScategory,
       
   311                 KVCXConnUtilTestExePsKeyResponseCmd + iPSKeyBase, RProperty::EInt, this );
       
   312         iTesterResponseSubscriber->Start();
       
   313         VCXLOGLO2("CVCXConnUtilTestExeTester:: Listening P&S key KVCXConnUtilTestExePsKeyResponseCmd: %d", KVCXConnUtilTestExePsKeyResponseCmd + iPSKeyBase);
       
   314         }
       
   315 
       
   316     // Start listening P&S for connutil status changes.
       
   317     iConnectionStatusSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   318             EVCxPSConnectionStatus, RProperty::EInt, this );
       
   319 
       
   320     iIapIdSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   321             EVCxPSIapId, RProperty::EInt, this );
       
   322 
       
   323     iSnapIdSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   324             EVCxPSSnapId, RProperty::EInt, this );
       
   325 
       
   326     iMasterExistsSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   327             EVCxPSMasterExists, RProperty::EInt, this );
       
   328 
       
   329     iNbrConnInstancesSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   330             EVCxPSNbrConnInstances, RProperty::EInt, this );
       
   331 
       
   332     iRoamingRequestStatusSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   333             EVCxPSRoamingRequestStatus, RProperty::EInt, this );
       
   334 
       
   335     iNbrRoamRespSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   336             EVCxPSNbrRoamResp, RProperty::EInt, this );
       
   337 
       
   338     iNbRoamAcceptedSubscriber = CVCXConnUtilTestSubscriber::NewL( KVcxConnUtilPScategory,
       
   339             EVCxPSNbRoamAccepted, RProperty::EInt, this );
       
   340 
       
   341     if( iMode == KVcxConnUtilTestModeSubscriber || iMode == KVcxConnUtilTestModeBoth )
       
   342         {
       
   343         iConnectionStatusSubscriber->Start();
       
   344         iIapIdSubscriber->Start();
       
   345         iSnapIdSubscriber->Start();
       
   346         iMasterExistsSubscriber->Start();
       
   347         iNbrConnInstancesSubscriber->Start();
       
   348         iRoamingRequestStatusSubscriber->Start();
       
   349         iNbrRoamRespSubscriber->Start();
       
   350         iNbRoamAcceptedSubscriber->Start();
       
   351         }
       
   352 
       
   353     VCXLOGLO2("<<<CVCXConnUtilTest::CreateL (%S)", &iName);
       
   354     return KErrNone;
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CVCXMyVideosCollectionPluginTest::CreateTesterProcessL
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 void CVCXConnUtilTest::CreateTesterProcessL()
       
   362     {
       
   363     VCXLOGLO2(">>>CVCXConnUtilTest::CreateTesterProcessL (%S)", &iName);
       
   364     // Define tester count P&S key before starting the exe.    
       
   365     TInt err = CVCXTestCommon::GetPSProperty( 
       
   366             KVCXConnUtilTestPScategory, KVCXConnUtilTestExeGlobalTesterCount, iPSKeyBase );
       
   367 
       
   368     if( err == KErrNotFound )
       
   369         {
       
   370         User::LeaveIfError( RProperty::Define( 
       
   371                 KVCXConnUtilTestPScategory, KVCXConnUtilTestExeGlobalTesterCount, RProperty::EInt ) );
       
   372         VCXLOGLO1("CVCXConnUtilTest:: Defined KVCXConnUtilTestExeGlobalTesterCount");
       
   373         User::LeaveIfError( CVCXTestCommon::SetPSProperty( 
       
   374                 KVCXConnUtilTestPScategory, KVCXConnUtilTestExeGlobalTesterCount, 1 ) );
       
   375         }
       
   376     else
       
   377     if( err != KErrNone ) 
       
   378         {
       
   379         VCXLOGLO2("CVCXConnUtilTest:: err getting tester count P&S: %d", err);
       
   380         User::Leave( err );
       
   381         }
       
   382     
       
   383     // Lets subscribe tester count for changes.
       
   384     iTesterCountSubscriber = CVCXConnUtilTestSubscriber::NewL( KVCXConnUtilTestPScategory,
       
   385                 KVCXConnUtilTestExeGlobalTesterCount, RProperty::EInt, this );
       
   386     iTesterCountSubscriber->Start();
       
   387     VCXLOGLO1("CVCXConnUtilTestExeTester:: Listening P&S key KVCXConnUtilTestExeGlobalTesterCount");
       
   388 
       
   389     // Create the process.    
       
   390     User::LeaveIfError( iProcess.Create( _L("VCXConnUtilTestExe.exe"), _L("") ) );
       
   391     iProcess.Resume();       
       
   392 
       
   393     TesterExeAliveL();
       
   394 
       
   395     // Wait until tester count P&S key has been updated.
       
   396     if( !iTesterCountChangedAlready )
       
   397         {
       
   398         iTesterCountSubscriber->WaitChangeL();
       
   399         }
       
   400     
       
   401     // Not interested anymore.
       
   402     delete iTesterCountSubscriber;
       
   403     iTesterCountSubscriber = NULL;
       
   404     
       
   405     VCXLOGLO2("<<<CVCXConnUtilTest::CreateTesterProcessL (%S)", &iName);
       
   406     }
       
   407 
       
   408 // -----------------------------------------------------------------------------
       
   409 // CVCXMyVideosCollectionPluginTest::GetIapL
       
   410 // -----------------------------------------------------------------------------
       
   411 //
       
   412 TInt CVCXConnUtilTest::GetIapL( CStifItemParser& aItem )
       
   413     {
       
   414     VCXLOGLO2(">>>CVCXConnUtilTest::GetIapL (%S)", &iName);
       
   415     // Print to UI
       
   416     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   417     _LIT( KWhere, "In GetIapL" );
       
   418     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   419     // Print to log file
       
   420     iLog->Log( KWhere );
       
   421 
       
   422     if( iMode == KVcxConnUtilTestModeSubscriber )
       
   423         {
       
   424         User::Leave( KErrNotSupported );
       
   425         }
       
   426     TesterExeAliveL();
       
   427 
       
   428     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   429 
       
   430     TPtrC destName;
       
   431     User::LeaveIfError( aItem.GetNextString( destName ) );
       
   432 
       
   433     CIptvTestUtilALR* alrUtil = CIptvTestUtilALR::NewLC();
       
   434     TInt destId = alrUtil->GetDestinationIdL( destName );
       
   435     CleanupStack::PopAndDestroy( alrUtil );
       
   436     
       
   437     VCXLOGLO1("CVCXConnUtilTest:: Create cenrep.");
       
   438     CRepository* cenRep = CRepository::NewLC( VCXTEST_KIptvAlrCenRepUid );
       
   439     VCXLOGLO1("CVCXConnUtilTest:: Set cenrep.");
       
   440     User::LeaveIfError( cenRep->Set( VCXTEST_KIptvCenRepUsedSnapIdKey, destId ) );
       
   441     CleanupStack::PopAndDestroy( cenRep );
       
   442 
       
   443     TInt isTimed(0);
       
   444     if( aItem.GetNextInt( isTimed ) != KErrNone )
       
   445         {
       
   446         isTimed = 0;
       
   447         }
       
   448 
       
   449     VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandGetIap (%S) ----->", &iName);
       
   450 
       
   451     // Silent call.
       
   452     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   453             KVCXConnUtilTestExePsKeyCmdIntParam1 + iPSKeyBase, 1 ) );
       
   454 
       
   455     // Is this timed call.
       
   456     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   457             KVCXConnUtilTestExePsKeyCmdIntParam2 + iPSKeyBase, isTimed ) );
       
   458 
       
   459     // Set the cmd.
       
   460     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   461             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandGetIap ) );
       
   462 
       
   463     iTesterGetAckResponseSubscriber->WaitChangeL();
       
   464 
       
   465     VCXLOGLO2("<<<CVCXConnUtilTest::GetIapL (%S)", &iName);
       
   466     return KErrNone;
       
   467     }
       
   468 
       
   469 // -----------------------------------------------------------------------------
       
   470 // CVCXMyVideosCollectionPluginTest::WapIdFromIapIdL
       
   471 // -----------------------------------------------------------------------------
       
   472 //
       
   473 TInt CVCXConnUtilTest::WapIdFromIapIdL( CStifItemParser& aItem )
       
   474     {
       
   475     VCXLOGLO2(">>>CVCXConnUtilTest::WapIdFromIapIdL (%S)", &iName);
       
   476     // Print to UI
       
   477     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   478     _LIT( KWhere, "In WapIdFromIapIdL" );
       
   479     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   480     // Print to log file
       
   481     iLog->Log( KWhere );
       
   482 
       
   483     TesterExeAliveL();
       
   484 
       
   485     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   486 
       
   487     TPtrC iapName;
       
   488     User::LeaveIfError( aItem.GetNextString( iapName ) );
       
   489 
       
   490     VCXLOGLO3("CVCXConnUtilTest:: Iap name: %S (%S) ----->", &iapName, &iName);
       
   491     
       
   492     TUint32 iapId( 0 );
       
   493     
       
   494     TInt err( KErrNone );
       
   495     if( !iTestCommon->GetIapIdL( iapName, iapId ) )
       
   496         {
       
   497         VCXLOGLO2("CVCXConnUtilTest:: Iap not found, error! (%S) ----->", &iName);
       
   498         err = KErrNotFound;
       
   499         }
       
   500     else
       
   501         {
       
   502         VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandGetWapIdForIap (%S) ----->", &iName);
       
   503     
       
   504         // IAP ID
       
   505         User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   506                 KVCXConnUtilTestExePsKeyCmdIntParam1 + iPSKeyBase, iapId ) );
       
   507     
       
   508         // Set the cmd.
       
   509         User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   510                 KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandGetWapIdForIap ) );
       
   511     
       
   512         iTesterGetAckResponseSubscriber->WaitChangeL();
       
   513         }
       
   514     
       
   515     VCXLOGLO2("<<<CVCXConnUtilTest::WapIdFromIapIdL (%S)", &iName);
       
   516     return err;
       
   517     }
       
   518 
       
   519 // -----------------------------------------------------------------------------
       
   520 // CVCXMyVideosCollectionPluginTest::DisconnectL
       
   521 // -----------------------------------------------------------------------------
       
   522 //
       
   523 TInt CVCXConnUtilTest::DisconnectL( CStifItemParser& aItem )
       
   524     {
       
   525     VCXLOGLO2(">>>CVCXConnUtilTest::DisconnectL (%S)", &iName);
       
   526     // Print to UI
       
   527     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   528     _LIT( KWhere, "In DisconnectL" );
       
   529     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   530     // Print to log file
       
   531     iLog->Log( KWhere );
       
   532 
       
   533     if( iMode == KVcxConnUtilTestModeSubscriber )
       
   534         {
       
   535         User::Leave( KErrNotSupported );
       
   536         }
       
   537     TesterExeAliveL();
       
   538 
       
   539     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   540 
       
   541     VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandDisconnect (%S) ----->", &iName);
       
   542 
       
   543     // Set the cmd.
       
   544     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   545             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandDisconnect ) );
       
   546 
       
   547     iTesterGetAckResponseSubscriber->WaitChangeL();
       
   548 
       
   549     VCXLOGLO2("<<<CVCXConnUtilTest::DisconnectL (%S)", &iName);
       
   550     return KErrNone;
       
   551     }
       
   552 
       
   553 // -----------------------------------------------------------------------------
       
   554 // CVCXMyVideosCollectionPluginTest::CheckPropertyL
       
   555 // -----------------------------------------------------------------------------
       
   556 //
       
   557 TInt CVCXConnUtilTest::CheckPropertyL( CStifItemParser& aItem )
       
   558     {
       
   559     VCXLOGLO2(">>>CVCXConnUtilTest::CheckPropertyL (%S)", &iName);
       
   560     // Print to UI
       
   561     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   562     _LIT( KWhere, "In CheckPropertyL" );
       
   563     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   564     // Print to log file
       
   565     iLog->Log( KWhere );
       
   566 
       
   567     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   568 
       
   569     TInt property;
       
   570     User::LeaveIfError( aItem.GetNextInt( property ) );
       
   571 
       
   572     TInt intValue(0);
       
   573     TBuf<256> stringValue;
       
   574     stringValue.Zero();
       
   575 
       
   576     TBuf<256> propertyName;
       
   577     GetPropertyNameL( property, propertyName );
       
   578 
       
   579     VCXLOGLO2("CVCXConnUtilTest:: check %S", &propertyName);
       
   580 
       
   581     switch( property )
       
   582         {
       
   583         case EVCxPSConnectionStatus:
       
   584             {
       
   585             User::LeaveIfError( iConnectionStatusSubscriber->Get( intValue ) );
       
   586             break;
       
   587             }
       
   588 
       
   589         case EVCxPSIapId:
       
   590             {
       
   591             User::LeaveIfError( iIapIdSubscriber->Get( intValue ) );
       
   592             break;
       
   593             }
       
   594 
       
   595         case EVCxPSSnapId:
       
   596             {
       
   597             User::LeaveIfError( iSnapIdSubscriber->Get( intValue ) );
       
   598             break;
       
   599             }
       
   600 
       
   601         case EVCxPSMasterExists:
       
   602             {
       
   603             User::LeaveIfError( iMasterExistsSubscriber->Get( intValue ) );
       
   604             break;
       
   605             }
       
   606 
       
   607         case EVCxPSNbrConnInstances:
       
   608             {
       
   609             User::LeaveIfError( iNbrConnInstancesSubscriber->Get( intValue ) );
       
   610             break;
       
   611             }
       
   612 
       
   613         case EVCxPSRoamingRequestStatus:
       
   614             {
       
   615             User::LeaveIfError( iRoamingRequestStatusSubscriber->Get( intValue ) );
       
   616             break;
       
   617             }
       
   618 
       
   619         case EVCxPSNbrRoamResp:
       
   620             {
       
   621             User::LeaveIfError( iNbrRoamRespSubscriber->Get( intValue ) );
       
   622             break;
       
   623             }
       
   624 
       
   625         case EVCxPSNbRoamAccepted:
       
   626             {
       
   627             User::LeaveIfError( iNbRoamAcceptedSubscriber->Get( intValue ) );
       
   628             break;
       
   629             }
       
   630 
       
   631         default:
       
   632             {
       
   633             User::Leave( KErrArgument );
       
   634             }
       
   635             break;
       
   636         }
       
   637 
       
   638     TInt err(KErrNone);
       
   639     TInt expectedValue(0);
       
   640     if( aItem.GetNextInt( expectedValue ) != KErrNone )
       
   641         {
       
   642         err = KErrArgument;
       
   643         }
       
   644     else
       
   645     if( err == KErrNone && intValue != expectedValue )
       
   646         {
       
   647         VCXLOGLO3("CVCXConnUtilTest:: mismatch: %d, expected: %d", intValue, expectedValue );
       
   648         err = KErrCorrupt;
       
   649         }
       
   650 
       
   651     VCXLOGLO2("<<<CVCXConnUtilTest::CheckPropertyL (%S)", &iName);
       
   652     return err;
       
   653     }
       
   654 
       
   655 // -----------------------------------------------------------------------------
       
   656 // CVCXMyVideosCollectionPluginTest::PrintConnUtilDetails
       
   657 // -----------------------------------------------------------------------------
       
   658 //
       
   659 TInt CVCXConnUtilTest::PrintConnUtilDetails( CStifItemParser& /* aItem */ )
       
   660     {
       
   661     VCXLOGLO2(">>>CVCXConnUtilTest::PrintConnUtilDetails (%S)", &iName);
       
   662 
       
   663     TInt connectionStatus( 0 );
       
   664     TInt iapId( 0 );
       
   665     TInt snapId( 0 );
       
   666     TInt masterExists( 0 );
       
   667     TInt nbrConnInstances( 0 );
       
   668     TInt roamingRequestStatus( 0 );
       
   669     TInt nbrRoamResp( 0 );
       
   670     TInt nbrRoamAccepted( 0 );
       
   671     TInt err( KErrNone );
       
   672 
       
   673     err = iConnectionStatusSubscriber->Get( connectionStatus );
       
   674     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iConnectionStatusSubscriber", err);
       
   675 
       
   676     err = iIapIdSubscriber->Get( iapId );
       
   677     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iIapIdSubscriber", err);
       
   678 
       
   679     err = iSnapIdSubscriber->Get( snapId );
       
   680     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iSnapIdSubscriber", err);
       
   681 
       
   682     err = iMasterExistsSubscriber->Get( masterExists );
       
   683     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iMasterExistsSubscriber", err);
       
   684 
       
   685     err = iNbrConnInstancesSubscriber->Get( nbrConnInstances );
       
   686     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iNbrConnInstancesSubscriber", err);
       
   687 
       
   688     err = iRoamingRequestStatusSubscriber->Get( roamingRequestStatus );
       
   689     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iRoamingRequestStatusSubscriber", err);
       
   690 
       
   691     err = iNbrRoamRespSubscriber->Get( nbrRoamResp );
       
   692     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iNbrRoamRespSubscriber", err);
       
   693 
       
   694     err = iNbRoamAcceptedSubscriber->Get( nbrRoamAccepted );
       
   695     if( err != KErrNone ) VCXLOGLO2("CVCXConnUtilTest:: err: %d getting PS iNbRoamAcceptedSubscriber", err);
       
   696 
       
   697     TBuf<256> statusStr;
       
   698     TRAP_IGNORE( GetConnectionStatusL( connectionStatus, statusStr ) );
       
   699 
       
   700     VCXLOGLO3("CVCXConnUtilTest:: status: %S (%d)", &statusStr, connectionStatus);
       
   701     VCXLOGLO2("CVCXConnUtilTest:: iapId: %d", iapId);
       
   702     VCXLOGLO2("CVCXConnUtilTest:: snapId: %d", snapId);
       
   703     VCXLOGLO2("CVCXConnUtilTest:: masterExists: %d", masterExists);
       
   704     VCXLOGLO2("CVCXConnUtilTest:: nbrConnInstances: %d", nbrConnInstances);
       
   705     VCXLOGLO2("CVCXConnUtilTest:: roamingRequestStatus: %d", roamingRequestStatus);
       
   706     VCXLOGLO2("CVCXConnUtilTest:: nbrRoamResp: %d", nbrRoamResp);
       
   707     VCXLOGLO2("CVCXConnUtilTest:: nbrRoamAccepted: %d", nbrRoamAccepted);
       
   708 
       
   709     VCXLOGLO2("<<<CVCXConnUtilTest::PrintConnUtilDetails (%S)", &iName);
       
   710     return KErrNone;
       
   711     }
       
   712 
       
   713 // -----------------------------------------------------------------------------
       
   714 // CVCXMyVideosCollectionPluginTest::SetRoamingAllowedL
       
   715 // -----------------------------------------------------------------------------
       
   716 //
       
   717 TInt CVCXConnUtilTest::SetRoamingAllowedL( CStifItemParser& aItem )
       
   718     {
       
   719     VCXLOGLO2(">>>CVCXConnUtilTest::SetRoamingAllowedL (%S)", &iName);
       
   720     // Print to UI
       
   721     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   722     _LIT( KWhere, "In SetRoamingAllowedL" );
       
   723     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   724     // Print to log file
       
   725     iLog->Log( KWhere );
       
   726 
       
   727     if( iMode == KVcxConnUtilTestModeSubscriber )
       
   728         {
       
   729         User::Leave( KErrNotSupported );
       
   730         }
       
   731     TesterExeAliveL();
       
   732 
       
   733     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   734 
       
   735     TInt temp;
       
   736     User::LeaveIfError( aItem.GetNextInt( temp ) );
       
   737 
       
   738     VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandSetRoamingAllowed (%S) ----->", &iName);
       
   739 
       
   740     // Set value.
       
   741     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   742             KVCXConnUtilTestExePsKeyCmdIntParam1 + iPSKeyBase, temp ) );
       
   743 
       
   744     // Set the cmd.
       
   745     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   746             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandSetRoamingAllowed ) );
       
   747 
       
   748     iTesterGetAckResponseSubscriber->WaitChangeL();
       
   749 
       
   750     VCXLOGLO2("<<<CVCXConnUtilTest::SetRoamingAllowedL (%S)", &iName);
       
   751     return KErrNone;
       
   752     }
       
   753 
       
   754 // -----------------------------------------------------------------------------
       
   755 // CVCXMyVideosCollectionPluginTest::SetLeaveAtRoamingRequestL
       
   756 // -----------------------------------------------------------------------------
       
   757 //
       
   758 TInt CVCXConnUtilTest::SetLeaveAtRoamingRequestL( CStifItemParser& aItem )
       
   759     {
       
   760     VCXLOGLO2(">>>CVCXConnUtilTest::SetLeaveAtRoamingRequestL (%S)", &iName);
       
   761     // Print to UI
       
   762     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   763     _LIT( KWhere, "In SetLeaveAtRoamingRequestL" );
       
   764     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   765     // Print to log file
       
   766     iLog->Log( KWhere );
       
   767 
       
   768     if( iMode == KVcxConnUtilTestModeSubscriber )
       
   769         {
       
   770         User::Leave( KErrNotSupported );
       
   771         }
       
   772     TesterExeAliveL();
       
   773 
       
   774     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   775 
       
   776     TInt temp;
       
   777     User::LeaveIfError( aItem.GetNextInt( temp ) );
       
   778 
       
   779     VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandSetRoamingLeaveAtRoamingRequest (%S) ----->", &iName);
       
   780 
       
   781     // Set value.
       
   782     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   783             KVCXConnUtilTestExePsKeyCmdIntParam1 + iPSKeyBase, temp ) );
       
   784 
       
   785     // Set the cmd.
       
   786     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   787             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandSetRoamingLeaveAtRoamingRequest ) );
       
   788 
       
   789     iTesterGetAckResponseSubscriber->WaitChangeL();
       
   790 
       
   791     VCXLOGLO2("<<<CVCXConnUtilTest::SetLeaveAtRoamingRequestL (%S)", &iName);
       
   792     return KErrNone;
       
   793     }
       
   794 
       
   795 // -----------------------------------------------------------------------------
       
   796 // CVCXMyVideosCollectionPluginTest::SetDelayBeforeRoamingRequest
       
   797 // -----------------------------------------------------------------------------
       
   798 //
       
   799 TInt CVCXConnUtilTest::SetDelayBeforeRoamingRequestL( CStifItemParser& aItem )
       
   800     {
       
   801     VCXLOGLO2(">>>CVCXConnUtilTest::SetDelayBeforeRoamingRequestL (%S)", &iName);
       
   802     // Print to UI
       
   803     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   804     _LIT( KWhere, "In SetDelayBeforeRoamingRequestL" );
       
   805     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   806     // Print to log file
       
   807     iLog->Log( KWhere );
       
   808 
       
   809     if( iMode == KVcxConnUtilTestModeSubscriber )
       
   810         {
       
   811         User::Leave( KErrNotSupported );
       
   812         }
       
   813     TesterExeAliveL();
       
   814 
       
   815     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   816 
       
   817     TInt seconds(0);
       
   818     User::LeaveIfError( aItem.GetNextInt( seconds ) );
       
   819 
       
   820     VCXLOGLO2("CVCXConnUtilTest:: Setting cmd EVcxConnUtilCommandSetDelayBeforeRoamingRequest (%S) ----->", &iName);
       
   821 
       
   822     // Set value.
       
   823     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   824             KVCXConnUtilTestExePsKeyCmdIntParam1 + iPSKeyBase, seconds ) );
       
   825 
       
   826     // Set the cmd.
       
   827     User::LeaveIfError( CVCXTestCommon::SetPSProperty( KVCXConnUtilTestPScategory,
       
   828             KVCXConnUtilTestExePsKeyCmd + iPSKeyBase, EVcxConnUtilCommandSetDelayBeforeRoamingRequest ) );
       
   829 
       
   830     iTesterGetAckResponseSubscriber->WaitChangeL();
       
   831 
       
   832     VCXLOGLO2("<<<CVCXConnUtilTest::SetDelayBeforeRoamingRequestL (%S)", &iName);
       
   833     return KErrNone;
       
   834     }
       
   835 
       
   836 // -----------------------------------------------------------------------------
       
   837 // CVCXMyVideosCollectionPluginTest::AddWaitedProperty
       
   838 // -----------------------------------------------------------------------------
       
   839 //
       
   840 TInt CVCXConnUtilTest::AddWaitedPropertyL( CStifItemParser& aItem )
       
   841     {
       
   842     VCXLOGLO2(">>>CVCXConnUtilTest::AddWaitedPropertyL (%S)", &iName);
       
   843     // Print to UI
       
   844     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   845     _LIT( KWhere, "In AddWaitedPropertyL" );
       
   846     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   847     // Print to log file
       
   848     iLog->Log( KWhere );
       
   849 
       
   850     if( iMode == KVcxConnUtilTestModeConnectivity )
       
   851         {
       
   852         User::Leave( KErrNotSupported );
       
   853         }
       
   854 
       
   855     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   856 
       
   857     TInt property( -1 );
       
   858     User::LeaveIfError( aItem.GetNextInt( property ) );
       
   859 
       
   860     TBuf<256> propertyName;
       
   861     GetPropertyNameL( property, propertyName );
       
   862 
       
   863     TInt value(0);
       
   864     User::LeaveIfError( aItem.GetNextInt( value ) );
       
   865 
       
   866     if( property == EVCxPSConnectionStatus )
       
   867         {
       
   868         TBuf<256> connStr;
       
   869         GetConnectionStatusL( value, connStr );
       
   870         VCXLOGLO3("CVCXConnUtilTest:: %S = %S", &propertyName, &connStr);
       
   871         }
       
   872     else
       
   873         {
       
   874         VCXLOGLO3("CVCXConnUtilTest:: %S = %d", &propertyName, value);
       
   875         }
       
   876 
       
   877     TVcxConnTestPSProperty prop( property, value );
       
   878     iWaitedPSChanges.Append( prop );
       
   879 
       
   880     VCXLOGLO2("<<<CVCXConnUtilTest::AddWaitedPropertyL (%S)", &iName);
       
   881     return KErrNone;
       
   882     }
       
   883 
       
   884 // -----------------------------------------------------------------------------
       
   885 // CVCXMyVideosCollectionPluginTest::AddNotAllowedPropertyL
       
   886 // -----------------------------------------------------------------------------
       
   887 //
       
   888 TInt CVCXConnUtilTest::AddNotAllowedPropertyL( CStifItemParser& aItem )
       
   889     {
       
   890     VCXLOGLO2(">>>CVCXConnUtilTest::AddNotAllowedPropertyL (%S)", &iName);
       
   891     // Print to UI
       
   892     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   893     _LIT( KWhere, "In AddNotAllowedPropertyL" );
       
   894     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   895     // Print to log file
       
   896     iLog->Log( KWhere );
       
   897 
       
   898     if( iMode == KVcxConnUtilTestModeConnectivity )
       
   899         {
       
   900         User::Leave( KErrNotSupported );
       
   901         }
       
   902 
       
   903     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   904 
       
   905     TInt property( -1 );
       
   906     User::LeaveIfError( aItem.GetNextInt( property ) );
       
   907 
       
   908     TBuf<256> propertyName;
       
   909     GetPropertyNameL( property, propertyName );
       
   910 
       
   911     TInt value(0);
       
   912     User::LeaveIfError( aItem.GetNextInt( value ) );
       
   913 
       
   914     if( property == EVCxPSConnectionStatus )
       
   915         {
       
   916         TBuf<256> connStr;
       
   917         GetConnectionStatusL( value, connStr );
       
   918         VCXLOGLO3("CVCXConnUtilTest:: %S = %S", &propertyName, &connStr);
       
   919         }
       
   920     else
       
   921         {
       
   922         VCXLOGLO3("CVCXConnUtilTest:: %S = %d", &propertyName, value);
       
   923         }
       
   924 
       
   925     TVcxConnTestPSProperty prop( property, value );
       
   926     iNotAllowedPSChanges.Append( prop );
       
   927 
       
   928     VCXLOGLO2("<<<CVCXConnUtilTest::AddNotAllowedPropertyL (%S)", &iName);
       
   929     return KErrNone;
       
   930     }
       
   931 
       
   932 // -----------------------------------------------------------------------------
       
   933 // CVCXMyVideosCollectionPluginTest::ResetWaitedProperties
       
   934 // -----------------------------------------------------------------------------
       
   935 //
       
   936 TInt CVCXConnUtilTest::ResetWaitedPropertiesL( CStifItemParser& aItem )
       
   937     {
       
   938     VCXLOGLO2(">>>CVCXConnUtilTest::ResetWaitedPropertiesL (%S)", &iName);
       
   939     // Print to UI
       
   940     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   941     _LIT( KWhere, "In ResetWaitedPropertiesL" );
       
   942     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   943     // Print to log file
       
   944     iLog->Log( KWhere );
       
   945 
       
   946     if( iMode == KVcxConnUtilTestModeConnectivity )
       
   947         {
       
   948         User::Leave( KErrNotSupported );
       
   949         }
       
   950 
       
   951     iWaitedPSChanges.Reset();
       
   952     iWaitingForEmptyPropertyQueue = EFalse;
       
   953     iNotAllowedPSChanges.Reset();
       
   954 
       
   955     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   956     VCXLOGLO2("<<<CVCXConnUtilTest::ResetWaitedPropertiesL (%S)", &iName);
       
   957     return KErrNone;
       
   958     }
       
   959 
       
   960 // -----------------------------------------------------------------------------
       
   961 // CVCXMyVideosCollectionPluginTest::WaitForPropertyQueueL
       
   962 // -----------------------------------------------------------------------------
       
   963 //
       
   964 TInt CVCXConnUtilTest::WaitForPropertyQueueL( CStifItemParser& aItem )
       
   965     {
       
   966     VCXLOGLO2(">>>CVCXConnUtilTest::WaitForPropertyQueueL (%S)", &iName);
       
   967     // Print to UI
       
   968     _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
   969     _LIT( KWhere, "In WaitForPropertyQueueL" );
       
   970     TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
   971     // Print to log file
       
   972     iLog->Log( KWhere );
       
   973 
       
   974     if( iMode == KVcxConnUtilTestModeConnectivity )
       
   975         {
       
   976         User::Leave( KErrNotSupported );
       
   977         }
       
   978     TesterExeAliveL();
       
   979 
       
   980     iWaitingForEmptyPropertyQueue = ETrue;
       
   981 
       
   982     // Timer is started always again when we correct property changes.
       
   983     const TInt KTimeoutMinute = 60 * 1000000;
       
   984     iTimeoutTimer->CancelTimer();
       
   985     iTimeoutTimer->After( KTimeoutMinute * 1 );
       
   986 
       
   987     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   988     VCXLOGLO2("<<<CVCXConnUtilTest::WaitForPropertyQueueL (%S)", &iName);
       
   989     return KErrNone;
       
   990     }
       
   991 
       
   992 // -----------------------------------------------------------------------------
       
   993 // CVCXConnUtilTest::ValueChangedL
       
   994 // -----------------------------------------------------------------------------
       
   995 //
       
   996 void CVCXConnUtilTest::ValueChangedL( const TUid& aUid, const TUint32& aKey, const TInt&  aValue )
       
   997     {
       
   998     VCXLOGLO2(">>>CVCXConnUtilTest::ValueChangedL (%S)", &iName);
       
   999 
       
  1000     if( aUid == KVcxConnUtilPScategory )
       
  1001         {
       
  1002         TBuf<256> pName;
       
  1003         GetPropertyNameL( aKey, pName );
       
  1004         if( aKey == EVCxPSConnectionStatus )
       
  1005             {
       
  1006             TBuf<256> connStr;
       
  1007             GetConnectionStatusL( aValue, connStr );
       
  1008             VCXLOGLO4("CVCXConnUtilTest::ValueChanged: %S = %S (%S) ----->", &pName, &connStr, &iName);
       
  1009 
       
  1010             _LIT( KVCXConnUtilTest, "S:" );
       
  1011             TestModuleIf().Printf( 0, KVCXConnUtilTest, connStr );
       
  1012             }
       
  1013         else
       
  1014             {
       
  1015             VCXLOGLO4("CVCXConnUtilTest::ValueChanged: %S = %d (%S) ----->", &pName, aValue, &iName);
       
  1016             }
       
  1017 
       
  1018         TBool found = EFalse;
       
  1019         for( TInt i = iWaitedPSChanges.Count() - 1; i >= 0; i-- )
       
  1020             {
       
  1021             if( iWaitedPSChanges[i].iProperty == aKey && iWaitedPSChanges[i].iIntegerValue == aValue )
       
  1022                 {
       
  1023                 iWaitedPSChanges.Remove( i );
       
  1024                 found = ETrue;
       
  1025                 break;
       
  1026                 }
       
  1027             }
       
  1028 
       
  1029         if( !found )
       
  1030             {
       
  1031             VCXLOGLO1("CVCXConnUtilTest:: The key was not found from wait queue.");
       
  1032 
       
  1033             // Check not allowed property changes.
       
  1034             for( TInt i = iNotAllowedPSChanges.Count() - 1; i >= 0; i-- )
       
  1035                 {
       
  1036                 if( iNotAllowedPSChanges[i].iProperty == aKey && iNotAllowedPSChanges[i].iIntegerValue == aValue )
       
  1037                     {
       
  1038                     VCXLOGLO1("CVCXConnUtilTest:: Property change is not allowed. Error! SIGNAL.");
       
  1039                     iNotAllowedPSChanges.Remove( i );
       
  1040                     Signal( KErrCorrupt );
       
  1041                     break;
       
  1042                     }
       
  1043                 }
       
  1044             }
       
  1045         else
       
  1046             {
       
  1047             VCXLOGLO1("CVCXConnUtilTest:: Key found and removed from wait queue.");
       
  1048 
       
  1049             // Restart timer.
       
  1050             const TInt KTimeoutMinute = 60 * 1000000;
       
  1051             iTimeoutTimer->CancelTimer();
       
  1052             iTimeoutTimer->After( KTimeoutMinute * 1 );
       
  1053 
       
  1054             if( iWaitedPSChanges.Count() == 0 )
       
  1055                 {
       
  1056                 if( iWaitingForEmptyPropertyQueue )
       
  1057                     {
       
  1058                     iWaitingForEmptyPropertyQueue = EFalse;
       
  1059                     VCXLOGLO1("CVCXConnUtilTest:: Property queue empty, SIGNAL.");
       
  1060                     iTimeoutTimer->CancelTimer();
       
  1061                     Signal();
       
  1062                     }
       
  1063                 }
       
  1064             }
       
  1065 
       
  1066         if( iWaitedPSChanges.Count() == 0 )
       
  1067             {
       
  1068             iNotAllowedPSChanges.Reset();
       
  1069             }
       
  1070         }
       
  1071 
       
  1072     TInt err( KErrNone );
       
  1073 
       
  1074     if( aUid == KVCXConnUtilTestPScategory )
       
  1075         {
       
  1076         if( aKey == KVCXConnUtilTestExeGlobalTesterCount )
       
  1077             {
       
  1078             iTesterCountChangedAlready = ETrue;
       
  1079             VCXLOGLO1("CVCXConnUtilTest:: KVCXConnUtilTestExeGlobalTesterCount changed.");
       
  1080             }
       
  1081         
       
  1082         if( aKey == KVCXConnUtilTestExePsKeyResponseAck + iPSKeyBase )
       
  1083             {
       
  1084             VCXLOGLO3("CVCXConnUtilTest:: received KVCXConnUtilTestExePsKeyResponseAck, value: %d (%S) ----->", aValue, &iName);
       
  1085             }
       
  1086 
       
  1087         if( aKey == KVCXConnUtilTestExePsKeyResponseCmd + iPSKeyBase )
       
  1088             {
       
  1089             VCXLOGLO2("CVCXConnUtilTest:: received KVCXConnUtilTestExePsKeyResponseCmd (%S) ----->", &iName);
       
  1090 
       
  1091             TInt cmd( aValue );
       
  1092             
       
  1093             TInt response( 0 );
       
  1094             
       
  1095             CVCXTestCommon::GetPSProperty( KVCXConnUtilTestPScategory,
       
  1096                     KVCXConnUtilTestExePsKeyResponseParam + iPSKeyBase, response );
       
  1097 
       
  1098             CVCXTestCommon::GetPSProperty( KVCXConnUtilTestPScategory,
       
  1099                     KVCXConnUtilTestExePsKeyResponseError + iPSKeyBase, err );
       
  1100             
       
  1101             if( cmd == EVcxConnUtilCommandDisconnect )
       
  1102                 {
       
  1103                 VCXLOGLO3("CVCXConnUtilTest:: response for EVcxConnUtilCommandDisconnect, error: %d (%S) ----->", err, &iName);
       
  1104                 }
       
  1105             
       
  1106             if( cmd == EVcxConnUtilCommandGetIap )
       
  1107                 {
       
  1108                 if( response == 0 )
       
  1109                     {
       
  1110                     VCXLOGLO1("CVCXConnUtilTest:: response for EVcxConnUtilCommandGetIap, IAP is 0, error!");
       
  1111                     err = KErrGeneral;
       
  1112                     }
       
  1113                 else
       
  1114                     {
       
  1115                     VCXLOGLO2("CVCXConnUtilTest:: response for EVcxConnUtilCommandGetIap returned IAP: %d", response);
       
  1116                     }
       
  1117                 }
       
  1118             
       
  1119             if( cmd == EVcxConnUtilCommandGetWapIdForIap )
       
  1120                 {
       
  1121                 VCXLOGLO2("CVCXConnUtilTest:: response for EVcxConnUtilCommandGetWapIdForIap returned: %d", response);
       
  1122                 }            
       
  1123 
       
  1124             Signal( err );
       
  1125             }
       
  1126         }
       
  1127 
       
  1128     VCXLOGLO2("<<<CVCXConnUtilTest::ValueChangedL (%S)", &iName);
       
  1129     }
       
  1130 
       
  1131 // -----------------------------------------------------------------------------
       
  1132 // CVCXConnUtilTest::ValueChangedL
       
  1133 // -----------------------------------------------------------------------------
       
  1134 //
       
  1135 void CVCXConnUtilTest::ValueChangedL( const TUid& aUid, const TUint32& aKey, const TDesC& aValue )
       
  1136     {
       
  1137     VCXLOGLO2(">>>CVCXConnUtilTest::ValueChangedL (%S)", &iName);
       
  1138 
       
  1139     if( aUid == KVcxConnUtilPScategory )
       
  1140         {
       
  1141         TBuf<256> pName;
       
  1142         GetPropertyNameL( aKey, pName );
       
  1143         VCXLOGLO3("CVCXConnUtilTest::ValueChanged: %S = %S", &pName, &aValue);
       
  1144 
       
  1145         TBool found = EFalse;
       
  1146         for( TInt i = iWaitedPSChanges.Count() - 1; i >= 0; i-- )
       
  1147             {
       
  1148             if( iWaitedPSChanges[i].iProperty == aKey && iWaitedPSChanges[i].iStringValue.Compare( aValue ) == 0 )
       
  1149                 {
       
  1150                 iWaitedPSChanges.Remove( i );
       
  1151                 found = ETrue;
       
  1152                 break;
       
  1153                 }
       
  1154             }
       
  1155 
       
  1156         if( !found )
       
  1157             {
       
  1158             VCXLOGLO1("CVCXConnUtilTest:: The key was not found from wait queue.");
       
  1159 
       
  1160             // Check not allowed property changes.
       
  1161             for( TInt i = iNotAllowedPSChanges.Count() - 1; i >= 0; i-- )
       
  1162                 {
       
  1163                 if( iNotAllowedPSChanges[i].iProperty == aKey && iWaitedPSChanges[i].iStringValue.Compare( aValue ) )
       
  1164                     {
       
  1165                     VCXLOGLO1("CVCXConnUtilTest:: Property change is not allowed. Error!");
       
  1166                     iNotAllowedPSChanges.Remove( i );
       
  1167                     Signal( KErrCorrupt );
       
  1168                     break;
       
  1169                     }
       
  1170                 }
       
  1171             }
       
  1172         else
       
  1173             {
       
  1174             VCXLOGLO1("CVCXConnUtilTest:: Key found and removed from wait queue.");
       
  1175 
       
  1176             const TInt KTimeoutMinute = 60 * 1000000;
       
  1177             iTimeoutTimer->CancelTimer();
       
  1178             iTimeoutTimer->After( KTimeoutMinute * 1 );
       
  1179 
       
  1180             if( iWaitedPSChanges.Count() == 0 )
       
  1181                 {
       
  1182                 if( iWaitingForEmptyPropertyQueue )
       
  1183                     {
       
  1184                     iWaitingForEmptyPropertyQueue = EFalse;
       
  1185                     VCXLOGLO1("CVCXConnUtilTest:: Property queue empty, SIGNAL.");
       
  1186                     iTimeoutTimer->CancelTimer();
       
  1187                     Signal();
       
  1188                     }
       
  1189                 }
       
  1190             }
       
  1191 
       
  1192         if( iWaitedPSChanges.Count() == 0 )
       
  1193             {
       
  1194             iNotAllowedPSChanges.Reset();
       
  1195             }
       
  1196         }
       
  1197 
       
  1198     if( aUid == KVCXConnUtilTestPScategory )
       
  1199         {
       
  1200 
       
  1201         }
       
  1202 
       
  1203     VCXLOGLO2("<<<CVCXConnUtilTest::ValueChangedL (%S)", &iName);
       
  1204     }
       
  1205 
       
  1206 // -----------------------------------------------------------------------------
       
  1207 // CVCXConnUtilTest::TimerComplete
       
  1208 // -----------------------------------------------------------------------------
       
  1209 //
       
  1210 void CVCXConnUtilTest::TimerComplete( TInt aTimerId, TInt aError )
       
  1211     {
       
  1212     VCXLOGLO3(">>>CVCXConnUtilTest::TimerComplete, err: %d (%S)", aError, &iName);
       
  1213 
       
  1214     if( aError == KErrNone && aTimerId == KTimeoutTimerId && iWaitingForEmptyPropertyQueue )
       
  1215         {
       
  1216         if( iWaitedPSChanges.Count() > 0 )
       
  1217             {
       
  1218             VCXLOGLO1("CVCXConnUtilTest:: ---- TIMEOUT --- when waiting P&S changes ----->");
       
  1219 
       
  1220             _LIT( KVCXConnUtilTest, "CVCXConnUtilTest" );
       
  1221             _LIT( KWhere, "TIMEOUT!" );
       
  1222             TestModuleIf().Printf( 0, KVCXConnUtilTest, KWhere );
       
  1223 
       
  1224             Signal( KErrTimedOut );
       
  1225             }
       
  1226         else
       
  1227             {
       
  1228             VCXLOGLO1("CVCXConnUtilTest:: Timed out but property queue empty. Signal ok.");
       
  1229             Signal( KErrNone );
       
  1230             }
       
  1231         }
       
  1232 
       
  1233     VCXLOGLO2("<<<CVCXConnUtilTest::TimerComplete (%S)", &iName);
       
  1234     }
       
  1235 
       
  1236 // -----------------------------------------------------------------------------
       
  1237 // CVCXConnUtilTest::GetConnectionStatusL
       
  1238 // -----------------------------------------------------------------------------
       
  1239 //
       
  1240 void CVCXConnUtilTest::GetConnectionStatusL( TInt aConnectionStatus, TDes& aStatusString )
       
  1241     {
       
  1242     switch( aConnectionStatus )
       
  1243         {
       
  1244         case EVCxNotConnected:
       
  1245             {
       
  1246             aStatusString.Copy( _L("EVCxNotConnected") );
       
  1247             }
       
  1248             break;
       
  1249 
       
  1250         case EVCxConnecting:
       
  1251             {
       
  1252             aStatusString.Copy( _L("EVCxConnecting") );
       
  1253             }
       
  1254             break;
       
  1255 
       
  1256         case EVCxConnected:
       
  1257             {
       
  1258             aStatusString.Copy( _L("EVCxConnected") );
       
  1259             }
       
  1260             break;
       
  1261 
       
  1262         case EVCxDisconnecting:
       
  1263             {
       
  1264             aStatusString.Copy( _L("EVCxDisconnecting") );
       
  1265             }
       
  1266             break;
       
  1267 
       
  1268         case EVCxRoamingRequest:
       
  1269             {
       
  1270             aStatusString.Copy( _L("EVCxRoamingRequest") );
       
  1271             }
       
  1272             break;
       
  1273 
       
  1274         case EVCxRoamingAccepted:
       
  1275             {
       
  1276             aStatusString.Copy( _L("EVCxRoamingAccepted") );
       
  1277             }
       
  1278             break;
       
  1279 
       
  1280         case EVCxError:
       
  1281             {
       
  1282             aStatusString.Copy( _L("EVCxError") );
       
  1283             }
       
  1284             break;
       
  1285 
       
  1286         default:
       
  1287             {
       
  1288             VCXLOGLO2("CVCXConnUtilTest:: state %d is UKNOWN!", aConnectionStatus);
       
  1289             User::Leave( KErrArgument );
       
  1290             }
       
  1291             break;
       
  1292         }
       
  1293     }
       
  1294 
       
  1295 // -----------------------------------------------------------------------------
       
  1296 // CVCXConnUtilTest::TesterExeAliveL
       
  1297 // -----------------------------------------------------------------------------
       
  1298 //
       
  1299 void CVCXConnUtilTest::TesterExeAliveL()
       
  1300     {
       
  1301     if( iProcess.ExitType() != EExitPending || iProcess.ExitReason() != KErrNone )
       
  1302         {
       
  1303         VCXLOGLO2("CVCXConnUtilTest:: ERROR: Tester process has terminated! (%S)", &iName);
       
  1304         VCXLOGLO2("CVCXConnUtilTest:: Exit type: %d", iProcess.ExitType());
       
  1305         VCXLOGLO2("CVCXConnUtilTest:: Exit reason: %d", iProcess.ExitReason());
       
  1306         TExitCategoryName exitCatName = iProcess.ExitCategory();
       
  1307         VCXLOGLO2("CVCXConnUtilTest:: Exit category: %S", &exitCatName);
       
  1308         User::Leave( KErrGeneral );
       
  1309         }
       
  1310     }
       
  1311 
       
  1312 // -----------------------------------------------------------------------------
       
  1313 // CVCXConnUtilTest::GetPropertyNameL
       
  1314 // -----------------------------------------------------------------------------
       
  1315 //
       
  1316 void CVCXConnUtilTest::GetPropertyNameL( TInt aProperty, TDes& aPropertyName )
       
  1317     {
       
  1318     switch( aProperty )
       
  1319         {
       
  1320         case EVCxPSConnectionStatus:
       
  1321             {
       
  1322             aPropertyName.Copy( _L("EVCxPSConnectionStatus") );
       
  1323             break;
       
  1324             }
       
  1325 
       
  1326         case EVCxPSIapId:
       
  1327             {
       
  1328             aPropertyName.Copy( _L("EVCxPSIapId") );
       
  1329             break;
       
  1330             }
       
  1331 
       
  1332         case EVCxPSSnapId:
       
  1333             {
       
  1334             aPropertyName.Copy( _L("EVCxPSSnapId") );
       
  1335             break;
       
  1336             }
       
  1337 
       
  1338         case EVCxPSMasterExists:
       
  1339             {
       
  1340             aPropertyName.Copy( _L("EVCxPSMasterExists") );
       
  1341             break;
       
  1342             }
       
  1343 
       
  1344         case EVCxPSNbrConnInstances:
       
  1345             {
       
  1346             aPropertyName.Copy( _L("EVCxPSNbrConnInstances") );
       
  1347             break;
       
  1348             }
       
  1349 
       
  1350         case EVCxPSRoamingRequestStatus:
       
  1351             {
       
  1352             aPropertyName.Copy( _L("EVCxPSRoamingRequestStatus") );
       
  1353             break;
       
  1354             }
       
  1355 
       
  1356         case EVCxPSNbrRoamResp:
       
  1357             {
       
  1358             aPropertyName.Copy( _L("EVCxPSNbrRoamResp") );
       
  1359             break;
       
  1360             }
       
  1361 
       
  1362         case EVCxPSNbRoamAccepted:
       
  1363             {
       
  1364             aPropertyName.Copy( _L("EVCxPSNbRoamAccepted") );
       
  1365             break;
       
  1366             }
       
  1367 
       
  1368         default:
       
  1369             {
       
  1370             VCXLOGLO2("CVCXConnUtilTest:: Unknown property: %d!", aProperty);
       
  1371             User::Leave( KErrArgument );
       
  1372             }
       
  1373             break;
       
  1374         }
       
  1375     }
       
  1376 
       
  1377 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  1378 // None
       
  1379 
       
  1380 //  [End of File] - Do not remove
       
  1381