localisation/apparchitecture/tef/t_largestackstep.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The following test case is used to test whether or not Apparc can handle loading applications with excessively large stack frames.
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent - Internal Symbian test code
       
    23 */
       
    24 
       
    25 #include <apgcli.h>
       
    26 #include <apacmdln.h>
       
    27 #include <apgicnfl.h>
       
    28 #include "../apserv/APSCLSV.H"
       
    29 #include "T_LargeStackStep.h"
       
    30 
       
    31 const TUid KLargeStackAppUid = {0x10282B27};
       
    32 
       
    33 TInt RTestApaLsSession::TestExeRecognizerL(const CApaCommandLine& aCommandLine)
       
    34 	{
       
    35 	TThreadId dummyThreadId;
       
    36 	TPckg<TThreadId> threadId(dummyThreadId);
       
    37 	const TInt opcode=EAppListServStartAppWithoutReturningThreadId;
       
    38 	TIpcArgs ipcArgs;
       
    39 	aCommandLine.GetIpcArgsLC(ipcArgs);
       
    40 	ipcArgs.Set(CApaCommandLine::EIpcFirstFreeSlot, &threadId);
       
    41 	User::LeaveIfError(SendReceive(opcode, ipcArgs));
       
    42 	CleanupStack::PopAndDestroy(); // the TIpcArgs
       
    43 	return KErrNone;
       
    44 	}
       
    45 
       
    46 CT_LargeStackStep::CT_LargeStackStep()
       
    47 	{
       
    48 	}
       
    49 
       
    50 CT_LargeStackStep::~CT_LargeStackStep()
       
    51 	{
       
    52 	iApaLsSession.Close();
       
    53 	}
       
    54 
       
    55 /**
       
    56    @SYMTestCaseID APPFWK-APPARC-0060
       
    57   
       
    58    @SYMPREQ CR0885
       
    59   
       
    60    @SYMTestCaseDesc
       
    61    Test apparc's use of RProcess::CreateWithStackOverride
       
    62   
       
    63    @SYMTestPriority High
       
    64   
       
    65    @SYMTestStatus Implemented
       
    66   
       
    67    @SYMTestActions
       
    68 	1. Load an application with an overly large stack requirement via RApaLsSession::StartApp.
       
    69 	2. Load the application via RApaLsSession::StartDocument
       
    70 	  
       
    71    @SYMTestExpectedResults
       
    72 	Application should start normally both times.
       
    73   
       
    74 */
       
    75 void CT_LargeStackStep::TestLargeStackL()
       
    76 	{
       
    77 	TApaAppInfo info;
       
    78 	INFO_PRINTF1(_L("Test that the large stack example application can be found"));
       
    79 	TEST(iApaLsSession.GetAppInfo(info,KLargeStackAppUid)==KErrNone);
       
    80 
       
    81 	INFO_PRINTF1(_L("Test that the application executes without error"));
       
    82 	CApaCommandLine* commandline = CApaCommandLine::NewLC();
       
    83 	commandline->SetExecutableNameL(info.iFullName);
       
    84 	commandline->SetCommandL(EApaCommandRunWithoutViews);
       
    85 	TEST(iApaLsSession.StartApp(*commandline)==KErrNone);
       
    86 	
       
    87 	INFO_PRINTF1(_L("Test running the application via the legacy recogniser code."));
       
    88 	TEST(iApaLsSession.TestExeRecognizerL(*commandline)==KErrNone);
       
    89 
       
    90 	INFO_PRINTF1(_L("Test running the application via StartDocument."));
       
    91 	TThreadId threadId;
       
    92 	TEST(iApaLsSession.StartDocument(_L("z:\fakename.doc"), KLargeStackAppUid, threadId, RApaLsSession::ELaunchNewApp)==KErrNone);
       
    93 
       
    94 	// Cleanup
       
    95 	CleanupStack::PopAndDestroy(commandline);
       
    96 	}
       
    97 
       
    98 TVerdict CT_LargeStackStep::doTestStepL()
       
    99 	{
       
   100 	INFO_PRINTF1(_L("Test T_LargeStack Started"));
       
   101 	
       
   102 	__UHEAP_MARK;
       
   103 	// Connect to RApaLsSession
       
   104 	TEST(iApaLsSession.Connect()==KErrNone);
       
   105 
       
   106 	// Run the test
       
   107 	TRAPD(err,TestLargeStackL());
       
   108 	TEST(err==KErrNone);
       
   109 	__UHEAP_MARKEND;
       
   110 
       
   111 	INFO_PRINTF1(_L("Test Finished"));	
       
   112 	return TestStepResult();
       
   113 	}