datacommsserver/networkingdialogapi/TE_Dialog/src/TestModemLocationDialog.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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 //
       
    15 
       
    16 /**
       
    17  @file TestModemLocationDialog.cpp
       
    18 */
       
    19 
       
    20 //Symbian OS Headers
       
    21 #include <c32comm.h>
       
    22 #include <agentdialog.h>
       
    23 
       
    24 //Test Framework Header
       
    25 #include <test/testexecutelog.h>
       
    26 
       
    27 //Test Step Header
       
    28 #include "TestModemLocationDialog.h"
       
    29 
       
    30 
       
    31 CTestModemLocationDialog::~CTestModemLocationDialog()
       
    32 /**
       
    33  * Destructor
       
    34  */
       
    35 	{
       
    36 	}
       
    37 
       
    38 CTestModemLocationDialog::CTestModemLocationDialog()
       
    39 /**
       
    40  * Constructor
       
    41  */
       
    42 	{
       
    43 	SetTestStepName(KTestModemLocationDialog);
       
    44 	}
       
    45 
       
    46 
       
    47 TVerdict CTestModemLocationDialog::doTestStepL()
       
    48 	{
       
    49 
       
    50  	// When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since
       
    51  	// it needs a different CommDB
       
    52  	_LIT(KPhbkSyncCMI, "phbsync.cmi");
       
    53     TInt ret = StartC32WithCMISuppressions(KPhbkSyncCMI);
       
    54 	if ((ret != KErrNone) && (ret != KErrAlreadyExists))
       
    55 		INFO_PRINTF2(_L("error is : %d \n"), ret);
       
    56 	else	
       
    57 		INFO_PRINTF1(_L("Started C32\n"));
       
    58 
       
    59 	RGenConAgentDialogServer dlgSv;
       
    60 	TRAP_IGNORE(dlgSv.Connect());
       
    61 	INFO_PRINTF1(_L("Connected Dialog Server\n"));
       
    62 
       
    63 	TRequestStatus status;
       
    64 	
       
    65 	INFO_PRINTF1(_L("\nTesting the Modem And Location Selection Dialog\n")); 
       
    66 	TUint32 modemId=0;
       
    67 	TUint32 locationId=0;
       
    68 	dlgSv.ModemAndLocationSelection(modemId,locationId,status);
       
    69 	INFO_PRINTF1(_L("Requested Modem And Location selection\n"));
       
    70 	User::WaitForRequest(status);
       
    71 	ret=status.Int();
       
    72 	INFO_PRINTF2(_L("Request Location selection completed with code=%d\n"),ret);
       
    73 	checkError(dlgSv,ret);
       
    74 	INFO_PRINTF2(_L("Modem id = %d\n"),modemId);
       
    75 	INFO_PRINTF2(_L("Location id = %d\n"),locationId);
       
    76 		
       
    77 	return TestStepResult();
       
    78 	}
       
    79 
       
    80 
       
    81 void CTestModemLocationDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
    82 	{
       
    83 	if (aError!=KErrNone && aError!=KErrCancel)
       
    84 		aDlgSvr.Close();
       
    85 
       
    86 	if ((aError!=KErrNone) && (aError!=KErrCancel))
       
    87 		INFO_PRINTF2(_L("Error is : %d \n"), aError);
       
    88 	}
       
    89 
       
    90 void CTestModemLocationDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
    91 	{
       
    92 	if (aError!=KErrNone)
       
    93 		{
       
    94 		aDlgSvr.ClosePct();
       
    95 		TRequestStatus destroyStatus;
       
    96 		User::WaitForRequest(destroyStatus);
       
    97 		aDlgSvr.Close();
       
    98 		}
       
    99 
       
   100 	TEST(aError==KErrNone);
       
   101 	}	
       
   102 
       
   103 
       
   104