linklayercontrol/nullagt/TS_nullagt/src/Nullagentcancelconnection.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2002-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 // Contain the implementation of the class for this null agent test
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "NullAgentTestSteps.h"
       
    19 #include "es_sock.h"
       
    20 #include "in_sock.h"
       
    21 #include "commdbconnpref.h"
       
    22 
       
    23 
       
    24 CTestStepNullAgtConnectionCancel::CTestStepNullAgtConnectionCancel(TPtrC aName)
       
    25 {
       
    26 	iTestStepName=aName;
       
    27 }
       
    28 
       
    29 enum TVerdict CTestStepNullAgtConnectionCancel::doTestStepL(void)
       
    30 {
       
    31 	__UHEAP_MARK;
       
    32 
       
    33 	TInt r; // the result of various operations
       
    34 	RSocketServ server;
       
    35 	RConnection connection;
       
    36 	TRequestStatus status;
       
    37 
       
    38 	// connect to the socket server
       
    39 	r = server.Connect();
       
    40 	TESTEL(r == KErrNone, r);
       
    41 	CleanupClosePushL(server);
       
    42 
       
    43 	// we created a socket server so we had it when opening the connection...
       
    44 	r = connection.Open(server, KAfInet);
       
    45 	TESTEL(r == KErrNone, r);
       
    46 	CleanupClosePushL(connection);
       
    47 	
       
    48 	// start the connection (outgoing)
       
    49 	// create the overrides
       
    50 	TCommDbConnPref prefs;
       
    51 	prefs.SetIapId(6);
       
    52 	prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
       
    53 
       
    54 	// start the connection with the overrides so we have a broken entry in the commdb
       
    55 	connection.Start(prefs, status);
       
    56 	User::WaitForRequest(status);
       
    57 	TESTEL(status.Int() == KErrNotFound, status.Int());
       
    58 	
       
    59 	// Try to stop connection that failed to start
       
    60 	r = connection.Stop();
       
    61 	TESTEL(r == KErrNotReady, r);
       
    62 	CleanupStack::Pop();
       
    63 
       
    64 	// close the socket server
       
    65 	server.Close();
       
    66 	CleanupStack::Pop();
       
    67 
       
    68 	__UHEAP_MARKEND;
       
    69 
       
    70 	return iTestStepResult;
       
    71 }