diff -r 000000000000 -r 3553901f7fa8 telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketPenultimateContextTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketPenultimateContextTest.cpp Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,306 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "Te_SimPacketPenultimateContextTest.h" + +CSimPacketPenultimateContextTest::CSimPacketPenultimateContextTest() + { + SetTestStepName(_L("PenultimateContextTest")); + } + +TVerdict CSimPacketPenultimateContextTest::doTestStepL() + { + INFO_PRINTF1(_L("BeginPacketPenultimateContextTest")); + + CreateConfigFileL(_L("c:\\config3.txt")); + SetTestNumberL(6); + + TInt x=0; + TInt ret = iPhone.Open(iTelServer,KPhoneName); + INFO_PRINTF2(_L("Result: %d"),ret); + TESTL(ret == KErrNone); + INFO_PRINTF1(_L("Opened phone object")); + TESTL(iPacketService.Open(iPhone)==KErrNone); + INFO_PRINTF1(_L("Opened Packet object")); + + // test RPacketContext::OpenNewContext + TName contextName; + TName contextNameCompare; + TESTL(iFirstPrimaryPacketContext.OpenNewContext(iPacketService, contextName)==KErrNone); + contextNameCompare.Append(KSimPrimaryPacketContextName); + contextNameCompare.AppendNum(1); + TESTL(contextName.Compare(contextNameCompare)==KErrNone); + INFO_PRINTF1(_L("Opened Context object")); + + TName anotherContextName; + TName anotherContextNameCompare; + TESTL(iSecondPrimaryPacketContext.OpenNewContext(iPacketService, anotherContextName)==KErrNone); + anotherContextNameCompare.Append(KSimPrimaryPacketContextName); + anotherContextNameCompare.AppendNum(2); + TESTL(anotherContextName.Compare(anotherContextNameCompare)==KErrNone); + INFO_PRINTF1(_L("Opened another Primary Context object")); + + // test RPacketContext::Activate - before calling InitialiseContext + TRequestStatus reqStatus; + StartNTRasSimulation(); + iFirstPrimaryPacketContext.Activate(reqStatus); + User::WaitForRequest(reqStatus); + TESTL(reqStatus.Int()==KErrNone); + INFO_PRINTF1(_L("Activate test passed")); + + // test RPacketContext::InitialiseContext + RPacketContext::TDataChannelV2 channelV2; + RPacketContext::TDataChannelV2Pckg channelV2pckg(channelV2); + iFirstPrimaryPacketContext.InitialiseContext(reqStatus, channelV2pckg); + User::WaitForRequest(reqStatus); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.41")); + + // test RPacketContext::OpenNewSecondaryContext + TName aNewContextName; + + iPacketContext.OpenNewSecondaryContext(iPacketService, + contextName, + aNewContextName); + + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.29")); + INFO_PRINTF1(_L("OpenNewSeondaryContext called successfully")); + + // test RPacketService::EnumerateNifs + TInt count; + iPacketService.EnumerateNifs(reqStatus, count); + iPacketService.CancelAsyncRequest(EPacketEnumerateNifs); + User::WaitForRequest(reqStatus); + TESTL(count == 2); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.30")); + INFO_PRINTF1(_L("EnumerateNifs tested successfully")); + + // test RPacketService::GetNifInfo + TInt index = count-1; + RPacketService::TNifInfoV2 nifInfoV2; + RPacketService::TNifInfoV2Pckg nifInfoV2Pckg(nifInfoV2); + + iPacketService.GetNifInfo(reqStatus, index, nifInfoV2Pckg); + iPacketService.CancelAsyncRequest(EPacketGetNifInfo); + User::WaitForRequest(reqStatus); + TESTL(nifInfoV2.iContextName.Compare(anotherContextName)==0); + TESTL(nifInfoV2.iContextType == RPacketService::EUnspecified); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.31")); + INFO_PRINTF1(_L("GetNifInfo Test Passed")); + + // test RPacketService::EnumerateContextsInNif + iPacketService.EnumerateContextsInNif(reqStatus, nifInfoV2.iContextName, count); + iPacketService.CancelAsyncRequest(EPacketEnumerateContextsInNif); + User::WaitForRequest(reqStatus); + TESTL(count == 1); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.32")); + INFO_PRINTF1(_L("EnumerateContextsInNif Test Passed")); + + // test RPacketService::GetContextNameInNif + index = count-1; + iPacketService.GetContextNameInNif(reqStatus, nifInfoV2.iContextName, index, anotherContextNameCompare); + iPacketService.CancelAsyncRequest(EPacketGetContextNameInNif); + User::WaitForRequest(reqStatus); + TESTL(anotherContextNameCompare.Compare(anotherContextName)==0); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.33")); + + INFO_PRINTF1(_L("GetContextNameInNif Test Passed")); + + // test RPacketService::GetCurrentReleaseMode + RPacketService::TPacketReleaseMode releaseMode; + iPacketService.GetCurrentReleaseMode(reqStatus, releaseMode); + iPacketService.CancelAsyncRequest(EPacketGetCurrentReleaseMode); + User::WaitForRequest(reqStatus); + TESTL(releaseMode==5); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.34")); + INFO_PRINTF1(_L("GetCurrentReleaseMode Test Passed")); + + // test RPacketService::NotifyReleaseModeChange + iPacketService.NotifyReleaseModeChange(reqStatus, releaseMode); + User::WaitForRequest(reqStatus); + CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.35")); + INFO_PRINTF1(_L("NotifyReleaseModeChange Test Passed")); + + TUint8 addrArray[RPacketContext::KIPAddressSize] = {0,0,0,0, + 0,0,0,0, + 0,0,255,255, + 102,23,224,132}; + TUint8 subArray[RPacketContext::KIPAddressSize] = {0,0,0,0, + 0,0,0,0, + 0,0,255,255, + 255,255,255,255}; + RPacketContext::TPacketFilterV2 packetFilterV2; + packetFilterV2.iId = 0; + packetFilterV2.iEvaluationPrecedenceIndex = 1; + + for(x = 0; x