// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

//! @File
//! @SYMTestSuiteName	lbsclienttracking.script
//! @SYMScriptTestEnvironment

LOAD_SUITE LbsClientTestServer -SharedData

PRINT Run LbsClientTestServer
PRINT

// Select the test A-GPS hybrid integration module and register onto the home network.
PREFIX RUN_UTILS
	MkDir c:\private\10282253\
	MkDir c:\private\10282253\lbs\
	MkDir c:\private\10282253\lbs\locmods\
	CopyFile c:\testdata\configs\ctagpsnpetestmoduledatasource.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
	DeleteFile c:\private\10202be9\1028224b.cre
	DeleteFile c:\private\10202be9\persists\1028224b.cre 
	CopyFile c:\testdata\configs\lbstestconfig.txt c:\config.txt
	DeleteFile c:\private\10282253\lbs\lbsprofile.ini
REMOVE_PREFIX

// Reset the admin to ensure we are preferred terminal mode.
RUN_TEST_STEP 010 LbsClientTestServer LbsStep_ResetDefaultAdmin

// Now start LBS. 
RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StartLbs


// Carry out the tests.
START_TESTCASE LBS-Client-Tracking-0001

//!@SYMTestCaseID			LBS-Client-Tracking-0001
//!@SYMTestCaseDesc			Tracking in partial mode, with accurate and partial updates.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Continue tracking whilst receiving accurate and partial updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,			KErrNone,				before interval
//!							Gps pos (accurate),	KErrNone,				after n * intervals
//!							Gps pos (accurate),	KErrNone, 				after interval
//!							Gps pos (partial),	KPositionPartialUpdate,	after interval
//!					
//!@SYMREQ					DEF110546
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-001
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-001

END_TESTCASE LBS-Client-Tracking-0001


START_TESTCASE LBS-Client-Tracking-0002

//!@SYMTestCaseID			LBS-Client-Tracking-0002
//!@SYMTestCaseDesc			Tracking in partial mode, with accurate updates.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Continue tracking whilst receiving accurate updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,			KErrNone,	before interval
//!							Gps pos (accurate),	KErrNone,	after n * intervals
//!							Gps pos (accurate),	KErrNone,	after interval
//!							Gps pos (accurate),	KErrNone,	after interval
//!
//!					
//!@SYMREQ					DEF110546
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-002
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-002

END_TESTCASE LBS-Client-Tracking-0002


START_TESTCASE LBS-Client-Tracking-0003

//!@SYMTestCaseID			LBS-Client-Tracking-0003
//!@SYMTestCaseDesc			Tracking in partial update mode, with partial updates.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Continue tracking whilst receiving partial updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,			KErrNone,				before interval
//!							Gps pos (accurate),	KErrNone,				after n * intervals
//!							Gps pos (NAN),		KPositionPartialUpdate,	after interval
//!							Gps pos (NAN),		KPositionPartialUpdate,	after interval
//!					
//!@SYMREQ					DEF110546
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-003
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-003

END_TESTCASE LBS-Client-Tracking-0003


START_TESTCASE LBS-Client-Tracking-0004

//!@SYMTestCaseID			LBS-Client-Tracking-0004
//!@SYMTestCaseDesc			Tracking in partial update mode, with inaccurate updates.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Continue tracking whilst receiving inaccurate updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,				KErrNone,				before interval
//!							Gps pos (accurate),		KErrNone,				after n * intervals
//!							Gps pos (inaccurate),	KPositionPartialUpdate,	after interval
//!							Gps pos (inaccurate),	KPositionPartialUpdate,	after interval
//!					
//!@SYMREQ					DEF110546
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-004
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-004

END_TESTCASE LBS-Client-Tracking-0004


START_TESTCASE LBS-Client-Tracking-0005

//!@SYMTestCaseID			LBS-Client-Tracking-0005
//!@SYMTestCaseDesc			Tracking in partial update mode, with no updates.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Continue tracking whilst the A-GPS module does not return any updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,					KErrNone,		before interval
//!							Gps pos (accurate),			KErrNone,		after n * intervals
//!							Gps pos (accurate),			KErrNone,		after interval
//!							Gps pos (not delivered),	KErrTimedOut,	after interval
//!					
//!@SYMREQ					DEF110546
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKINGs
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-005
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-005

END_TESTCASE LBS-Client-Tracking-0005

START_TESTCASE LBS-Client-Tracking-0006

//!@SYMTestCaseID			LBS-Client-Tracking-0006
//!@SYMTestCaseDesc			Tracking in partial update mode, with a futile error returned
//!							before the next interval. But the next udpate after that should
//!							still happen as if the GPS module had not returned futile.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. After receiving first accurate fix, switch on partial updates.
//!							3. Receive a normal tracking partial update.
//!							4. Receive a NaN update before the next interval. This is
//!								caused by the GPS module returning an update with
//!								KPositionCalculationFutile before the next interval.
//!							5. Continue tracking whilst receiving partial updates.
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,				KErrNone,				before interval
//!							Gps pos (accurate),		KErrNone,				after n * intervals
//!							Gps pos (inaccurate),	KPositionPartialUpdate,	after interval
//!							Gps pos (NaN),			KPositionQualityLoss,	before interval
//!							Gps pos (inaccurate),	KPositionPartialUpdate,	after interval
//!					
//!@SYMREQ					DEF111247
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-006
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-006

END_TESTCASE LBS-Client-Tracking-0006

START_TESTCASE LBS-Client-Tracking-0007
 
//!@SYMTestCaseID			LBS-Client-Tracking-0007
//!@SYMTestCaseDesc			Tracking with an inaccurate position returned after timeout with KPositionQualityLoss.
//!					
//!@SYMTestActions			1. Start a tracking session with partial updates off.
//!							2. Receive an accurate position
//!							3. Timeout and return the inaccurate position with KPositionQualityLoss
//!					
//!@SYMTestExpectedResults	Updates should be received at each interval as below:
//!
//!							Ref pos,				KErrNone,				before interval
//!							Gps pos (accurate),		KErrNone,				after n * intervals
//!							Gps pos (inaccurate),	KPositionQualityLoss,	after timeout
//!					
//!@SYMREQ					INC112270
//!					
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclienttracking.ini  LBS-CLIENT-TRACKING
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-007
RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_Tracking c:\testdata\configs\lbsclienttracking.ini LBS-TRACKING-007

END_TESTCASE LBS-Client-Tracking-0007

RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StopLbs

// Re-select the real A-GPS integration module.
RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Delete network registration status text file
RUN_UTILS DeleteFile c:\config.txt
  
