telephonyserver/etelserverandcore/TETEL/TE_ETEL/te_etelpanicafterrequest.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "te_etelbase.h"
       
    17 #include "te_etelpanicafterrequest.h"
       
    18 #include "et_struc.h"
       
    19 #include "et_struct.h"
       
    20 #include "et_clsvr.h"
       
    21 #include "etelext.h"
       
    22 
       
    23 const TUint KDefaultHeapSizeThread = 0x4000; //< default heap size for the test Threads
       
    24 
       
    25 class RTestPanicAfterRequestPhone: public RPhone
       
    26 	{
       
    27 public:
       
    28 	RTestPanicAfterRequestPhone():RPhone()
       
    29 		{
       
    30 		
       
    31 		}
       
    32 	void GetSomeData(TRequestStatus& aStatus)
       
    33 		{
       
    34 		// Send an asynch request for GetLineInfo
       
    35 		TIpcArgs args;
       
    36 		args.Set(1,EIsaDesTobeRead);
       
    37 		TLineInfoIndex info;
       
    38 		info.iIndex=0;
       
    39 		TPtr8 ptr(REINTERPRET_CAST(TText8*,&info),sizeof(TLineInfoIndex),sizeof(TLineInfoIndex));
       
    40 		args.Set(0,&ptr);
       
    41 		SendReceive(EEtelPhoneGetLineInfo,args,aStatus);
       
    42 		
       
    43 		}
       
    44 	
       
    45 	};
       
    46 
       
    47 CTestPanicAfterRequest::CTestPanicAfterRequest()
       
    48 /** Each test step initialises it's own name
       
    49 */
       
    50 	{
       
    51 	SetTestStepName(_L("TestPanicAfterRequest"));
       
    52 	}
       
    53 
       
    54 
       
    55 TVerdict CTestPanicAfterRequest::doTestStepL()
       
    56 	{
       
    57 	INFO_PRINTF1(_L("Client sends a request to Etel server, and then exits"));
       
    58 
       
    59 	RThread panicThread;
       
    60 	TRequestStatus stat;
       
    61 	TInt res=panicThread.Create(_L("RequestAndPanicThread"),RequestAndPanicThread,KDefaultStackSize,KDefaultHeapSizeThread,KDefaultHeapSizeThread,this);
       
    62 
       
    63 	panicThread.Logon(stat);
       
    64 	
       
    65 	panicThread.Resume();
       
    66 
       
    67 	User::WaitForRequest(stat);
       
    68 	User::After(10000); // Give ETEL time to panic....
       
    69 	return TestStepResult();
       
    70 	}
       
    71 
       
    72 TInt CTestPanicAfterRequest::RequestAndPanicThread(TAny* /*aArg*/)
       
    73 	{
       
    74 	CTrapCleanup* cleanup;
       
    75 	if ((cleanup=CTrapCleanup::New())==NULL)
       
    76 		return KErrGeneral;
       
    77 	//CTestPanicAfterRequest* stepTest = reinterpret_cast<CTestPanicAfterRequest*> (aArg);
       
    78     RTelServer server;
       
    79 	TInt ret = server.Connect();
       
    80    	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
       
    81 	RTestPanicAfterRequestPhone phone;
       
    82 	ret = phone.Open(server,DSTD_SLOW_PHONE_NAME);
       
    83 	TRequestStatus status;
       
    84 	phone.GetSomeData(status);
       
    85 
       
    86 	server.Close();
       
    87 	delete cleanup;
       
    88 	
       
    89 	return KErrNone;
       
    90 	}