localisation/apparchitecture/tef/T_Serv2Step.CPP
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    13 // Description:
    13 // Description:
    14 // Test wrapper to Application Architecture Server.
    14 // Test wrapper to Application Architecture Server.
    15 // Tests Application information, Data recognition and application
    15 // Tests Application information, Data recognition and application
    16 // launching capabilities of the application architecture server.\n
    16 // launching capabilities of the application architecture server.\n
    17 // 
    17 // 
       
    18 // t_serv2step.cpp
    18 //
    19 //
    19 
    20 
    20 
    21 /**
    21 
    22  @file t_serv2step.cpp
    22 /**
       
    23  @file
       
    24  @test 
    23  @test 
    25  @internalComponent - Internal Symbian test code
    24  @internalComponent - Internal Symbian test code
    26 */
    25 */
    27 
    26 
    28 #include <f32file.h>
    27 #include <f32file.h>
    29 #include <fbs.h>
    28 #include <fbs.h>
    30 #include <apaid.h>
    29 #include <apaid.h>
       
    30 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    31 #include <apaidpartner.h>
       
    32 #include <apgicnflpartner.h>
       
    33 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    31 #include <apgaplst.h>
    34 #include <apgaplst.h>
    32 #include <apaflrec.h>
    35 #include <apaflrec.h>
    33 #include "testableapalssession.h"
    36 #include "testableapalssession.h"
    34 #include <apacmdln.h>
    37 #include <apacmdln.h>
    35 #include <apsserv.h>
       
    36 #include <apfrec.h>
    38 #include <apfrec.h>
    37 #include <datastor.h>
    39 #include <datastor.h>
    38 #include <apgicnfl.h>
    40 #include <apgicnfl.h>
    39 #include <apasvst.h>
    41 #include <apasvst.h>
    40 #include "tstapp.h"
    42 #include "tstapp.h"
   361 	
   363 	
   362 	_LIT8(KLitDogfish,"dogfish");
   364 	_LIT8(KLitDogfish,"dogfish");
   363 	_LIT(KLitWibble,"wibble");
   365 	_LIT(KLitWibble,"wibble");
   364 	cmdLn->SetExecutableNameL(filename);
   366 	cmdLn->SetExecutableNameL(filename);
   365 	cmdLn->SetTailEndL(KLitDogfish);
   367 	cmdLn->SetTailEndL(KLitDogfish);
   366 	TInt ret = aLs.StartApp(*cmdLn); // explicit
   368 	
   367 	TEST(ret==KErrNone);
   369 	TThreadId Id;
       
   370 	TInt ret = aLs.StartApp(*cmdLn,Id); // explicit
       
   371 	TEST(ret==KErrNone);
       
   372 
       
   373 	//Wait till the thread exits
       
   374 	if (ret==KErrNone)	
       
   375 		{
       
   376 		RThread thread;
       
   377 		TRequestStatus status;
       
   378 		
       
   379 		User::LeaveIfError(thread.Open(Id));
       
   380 		thread.Rendezvous(status);
       
   381 		User::WaitForRequest(status);
       
   382 		thread.Close();
       
   383 		}
   368 
   384 
   369 	// start a non-existant app
   385 	// start a non-existant app
   370 	cmdLn->SetExecutableNameL(KLitWibble);
   386 	cmdLn->SetExecutableNameL(KLitWibble);
   371 	ret = aLs.StartApp(*cmdLn);
   387 	ret = aLs.StartApp(*cmdLn);
   372 	TEST(ret==KErrNotFound);
   388 	TEST(ret==KErrNotFound);
   374 	//
   390 	//
   375 	CleanupStack::PopAndDestroy(); // cmdLn
   391 	CleanupStack::PopAndDestroy(); // cmdLn
   376 
   392 
   377 }
   393 }
   378 
   394 
   379 /**
   395 
   380  * @SYMTestCaseID T_Serv2Step_StartAppTests4L
   396 /**
   381  *
   397 * Auxiliary Fn for Test Case ID T_Serv2Step_StartAppTests1L, T_Serv2Step_StartAppTests3L
   382  * @SYMPREQ
       
   383  *
       
   384  * @SYMTestCaseDesc Test Launching of an application. 
       
   385  * 
       
   386  * @SYMTestActions Call RApaLsSession::StartDocument() to start an
       
   387  * application defined by the command line information.\n
       
   388  * Test the launching of application for following scenarios:\n
       
   389  * (1) When Application specified by command line is EmbeddableOnly.\n
       
   390  * (2) When Application specified by command line is EmbeddableUiNotStandAlone.\n
       
   391  * (3) When Application specified by command line is Embeddable or StandAlone.\n
       
   392  * API Calls:\n	
       
   393  * RApaLsSession::StartDocument(const TDesC &aFileName, TUid aAppUid, TThreadId &aId, TLaunchType aLaunchType=ELaunchNewApp)\n
       
   394  * 
       
   395  * @SYMTestExpectedResults The test observes that StartDocument() returns KErrNone and
       
   396  * starts the app in the third scenario. In the first and second case KErrNotSupported is
       
   397  * returned.
       
   398  *  
       
   399  */	
       
   400  
       
   401 void CT_Serv2Step::StartAppTests4L(RApaLsSession& aLs)
       
   402 	{
       
   403 	TInt ret;
       
   404 	TThreadId id;
       
   405 
       
   406 	_LIT(KLitSdkDocPath,"\\system\\data\\sdk.txt");
       
   407 	TFileName filename = SearchAndReturnCompleteFileName(KLitSdkDocPath);
       
   408 	
       
   409 	// Test starting a file using an app which can be embeddable only.
       
   410 	ret=aLs.StartDocument(filename,KUidAppEmbeddableUiNotStandAlone,id);
       
   411 	TEST(ret==KErrNotSupported);
       
   412 	
       
   413 	// Test starting a file using an app which can be embeddable only.
       
   414 	ret=aLs.StartDocument(filename,KUidAppEmbeddableOnly,id);
       
   415 	TEST(ret==KErrNotSupported);
       
   416 
       
   417 	// Test starting a file using an app which can be embeddable or standalone.
       
   418 	ret=aLs.StartDocument(filename,KUidAppEmbeddable,id);
       
   419 	TEST(ret==KErrNone);
       
   420 	}
       
   421 
       
   422 /**
       
   423 * Auxiliary Fn for Test Case ID T_Serv2Step_StartAppTests1L, T_Serv2Step_StartAppTests3L,StartAppTests4L(aLs)
       
   424 *
   398 *
   425 * This method tests launching of an application from command line by calling
   399 * This method tests launching of an application from command line by calling
   426 * CT_Serv2Step::StartAppTests1L().
   400 * CT_Serv2Step::StartAppTests1L().
   427 *
   401 *
   428 */
   402 */
   430 	{
   404 	{
   431 	INFO_PRINTF1(_L("Checking application launching"));
   405 	INFO_PRINTF1(_L("Checking application launching"));
   432 
   406 
   433 	// start the test exe
   407 	// start the test exe
   434 	StartAppTests1L(aLs);
   408 	StartAppTests1L(aLs);
   435     StartAppTests4L(aLs);
       
   436 	}
   409 	}
   437 
   410 
   438 /**
   411 /**
   439    @SYMTestCaseID T-Serv2Step-DoEnquiryTestsL
   412    @SYMTestCaseID T-Serv2Step-DoEnquiryTestsL
   440   
   413   
  1824 
  1797 
  1825 	INFO_PRINTF1(_L("Test Completed!"));	
  1798 	INFO_PRINTF1(_L("Test Completed!"));	
  1826 	return TestStepResult();
  1799 	return TestStepResult();
  1827 
  1800 
  1828 }
  1801 }
       
  1802