LbsApi/src/te_lbsapisuiteserver.cpp
author Maciej Seroka <maciejs@symbian.org>
Wed, 28 Jul 2010 13:24:28 +0100
branchSymbian3
changeset 54 a4835904093b
permissions -rw-r--r--
Added new LbsApi smoke test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
// Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
// Description:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
 @file Te_LbsApiSuiteServer.cpp
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
 @internalTechnology
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
*/
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
#include "te_lbsapisuiteserver.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
#include "calculationmethodsstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
#include "criteriaclassesstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
#include "dataclassesstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
#include "genericinfostep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
#include "moduleclassesstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
#include "nomemorystep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
#include "reminderstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
#include "noserverstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
#include "requestorclassesstep.h"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
_LIT(KServerName,"Te_LbsApiSuite");
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
CTe_LbsApiSuite* CTe_LbsApiSuite::NewL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
 * @return - Instance of the test server
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
 * Same code for Secure and non-secure variants
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
 * Called inside the MainL() function to create and start the
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
 * CTestServer derived server.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
	CTe_LbsApiSuite * server = new (ELeave) CTe_LbsApiSuite();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
	CleanupStack::PushL(server);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
	server->ConstructL(KServerName);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
	CleanupStack::Pop(server);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
	return server;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
// Secure variants much simpler
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
// For EKA2, just an E32Main and a MainL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
LOCAL_C void MainL()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
 * Secure variant
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
 * Much simpler, uses the new Rendezvous() call to sync with the client
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
	// Leave the hooks in for platform security
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
#if (defined __DATA_CAGING__)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
	RProcess().DataCaging(RProcess::EDataCagingOn);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
	RProcess().DataCaging(RProcess::ESecureApiOn);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
#endif
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
	CActiveScheduler* sched=NULL;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
	sched=new(ELeave) CActiveScheduler;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
	CActiveScheduler::Install(sched);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
	CTe_LbsApiSuite* server = NULL;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
	// Create the CTestServer derived server
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
	TRAPD(err,server = CTe_LbsApiSuite::NewL());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
	if(!err)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
		{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
		// Sync with the client and enter the active scheduler
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
		RProcess::Rendezvous(KErrNone);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
		sched->Start();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
		}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
	delete server;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
	delete sched;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
	}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
GLDEF_C TInt E32Main()
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
 * @return - Standard Epoc error code on process exit
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
 * Secure variant only
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
 * Process entry point. Called by client using RProcess API
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
	__UHEAP_MARK;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
	CTrapCleanup* cleanup = CTrapCleanup::New();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
	if(cleanup == NULL)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
		{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
		return KErrNoMemory;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
		}
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
	TRAPD(err,MainL());
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
	delete cleanup;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
	__UHEAP_MARKEND;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
	return err;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
CTestStep* CTe_LbsApiSuite::CreateTestStep(const TDesC& aStepName)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
 * @return - A CTestStep derived instance
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
 * Secure and non-secure variants
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
 * Implementation of CTestServer pure virtual
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
 */
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
	{
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
	CTestStep* testStep = NULL;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
	
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
	
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
	if(aStepName == KCalculationMethodsStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
		testStep = new CCalculationMethodsStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
	else if(aStepName == KCriteriaClassesStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
		testStep = new CCriteriaClassesStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
	else if(aStepName == KDataClassesStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
		testStep = new CDataClassesStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
	else if(aStepName == KGenericInfoStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
		testStep = new CGenericInfoStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
	else if(aStepName == KModuleClassesStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
		testStep = new CModuleClassesStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
	else if(aStepName == KNoMemoryStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
#if defined(__WINS__) && defined(__DEBUG__)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
		testStep = new CNoMemoryStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
#else
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
		testStep = new CReminderStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
#endif
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
	else if(aStepName == KNoServerStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
		testStep = new CNoServerStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
	else if(aStepName == KRequestorClassesStep)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
		testStep = new CRequestorClassesStep();
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
	return testStep;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
	}