telephonyprotocols/csdagt/TS_CsdAgt/CsdAgtTestReconnect.cpp
author Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
Thu, 06 May 2010 15:10:38 +0100
branchopencode
changeset 24 6638e7f4bd8f
parent 0 3553901f7fa8
permissions -rw-r--r--
opencode
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     1
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     2
// All rights reserved.
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     3
// This component and the accompanying materials are made available
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     5
// which accompanies this distribution, and is available
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     7
//
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     8
// Initial Contributors:
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
     9
// Nokia Corporation - initial contribution.
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    10
//
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    11
// Contributors:
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    12
//
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    13
// Description:
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    14
// This contains CsdAgt TestCase Test 3.1 - 3.2
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    15
// 
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    16
//
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    17
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    18
// EPOC includes
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    19
#include <e32base.h>
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    20
#include <in_sock.h>
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    21
#include <dummyetel.h> // include here to avoid picking up the real etel.h
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    22
#include <etelmm.h>
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    23
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    24
// Test system includes
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    25
#include "log.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    26
#include "teststep.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    27
#include "TestStepCsdAgt.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    28
#include "TestSuiteCsdAgt.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    29
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    30
// COMMDB Database Undo
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    31
#include "DbUndo.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    32
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    33
// EFinishedDialling
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    34
#include <csdprog.h>
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    35
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    36
// Class definitions
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    37
#include "CsdAgtTestReconnect.h"
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    38
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    39
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    40
/**
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    41
 * Test case 3.1, CSD reconnect after open state
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    42
 *
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    43
 */
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    44
enum TVerdict CCsdAgtTest3_1::doCsdAgtTestStepL( void )
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    45
	{
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    46
	TRealAgtNotify AgtNotify; 
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    47
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    48
	AgtNotify.SetTestCase(10301);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    49
	SetGSMModeL(AgtNotify);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    50
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    51
	// Call ReConnect() utility function
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    52
	ReConnectL();
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    53
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    54
	return iTestStepResult;
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    55
	}
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    56
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    57
/**
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    58
 * Test case 3.2 CSD reconnect fails
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    59
 *
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    60
 */
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    61
enum TVerdict CCsdAgtTest3_2::doCsdAgtTestStepL( void )
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    62
	{
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    63
	TInt err;
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    64
	TInt stage;
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    65
	CNifAgentRefN1 *agent;
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    66
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    67
	TRealAgtNotify AgtNotify; 
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    68
	AgtNotify.SetTestCase((TInt)10302);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    69
	SetGSMModeL(AgtNotify);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    70
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    71
	// Construct a new Dummy Nifman Instance
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    72
	// Log(_L("Loading DUMMYNIF.DLL"));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    73
	agent = CNifAgentRefN1::NewL(this);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    74
	CleanupStack::PushL(agent);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    75
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    76
	// Attempt connection
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    77
	Log(_L("Connecting..."));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    78
	agent->Connect();
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    79
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    80
	// Check for an error code
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    81
	agent->GetCompletionCode(err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    82
	TESTEL(err==KErrNone,err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    83
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    84
	// Check ConnectComplete was reported at the correct stage in the state machine
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    85
	agent->GetProgressStage(stage);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    86
	TESTEL(stage==ECsdConnectionOpen,stage);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    87
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    88
	Log(_L("Connect Succeeded"));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    89
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    90
	DelayL(2000000);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    91
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    92
	AgtNotify.SetTestCase((TInt)10303);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    93
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    94
	// Attempt connection
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    95
	Log(_L("ReConnecting..."));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    96
	agent->ReConnect();
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    97
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    98
	// Check for an error code
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
    99
	agent->GetCompletionCode(err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   100
	TESTEL(err==KErrGeneral,err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   101
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   102
	// Check ConnectComplete was reported at the correct stage in the state machine
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   103
	agent->GetProgressStage(stage);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   104
	TESTEL(stage==ECsdScannedScript,stage);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   105
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   106
	DelayL(2000000);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   107
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   108
	// Disconnect
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   109
	Log(_L("Disconnecting..."));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   110
	agent->Disconnect();
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   111
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   112
	// Check for an error code
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   113
	agent->GetCompletionCode(err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   114
	TESTEL(err==KErrNone,err);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   115
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   116
	Log(_L("Disconnect Succeeded"));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   117
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   118
	// Finished with Dummy Nifman so delete it
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   119
	CleanupStack::PopAndDestroy(agent);
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   120
	// Log(_L("DUMMYNIF.DLL Unloaded"));
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   121
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   122
	return iTestStepResult;
6638e7f4bd8f opencode
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents: 0
diff changeset
   123
	}