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