datacommsserver/networkingdialogapi/TE_Dialog/src/TestIAPDialog.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 TestIAPDialog.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 "TestIAPDialog.h"
       
    29 
       
    30 
       
    31 //
       
    32 
       
    33 CTestIAPDialog::~CTestIAPDialog()
       
    34 /**
       
    35  * Destructor
       
    36  */
       
    37 	{
       
    38 	}
       
    39 
       
    40 CTestIAPDialog::CTestIAPDialog()
       
    41 /**
       
    42  * Constructor
       
    43  */
       
    44 	{
       
    45 	SetTestStepName(KTestIAPDialog);
       
    46 	}
       
    47 
       
    48 TVerdict CTestIAPDialog::doTestStepL()
       
    49 	{
       
    50 
       
    51 
       
    52  	// When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since
       
    53  	// it needs a different CommDB
       
    54  	_LIT(KPhbkSyncCMI, "phbsync.cmi");
       
    55     TInt ret = StartC32WithCMISuppressions(KPhbkSyncCMI);
       
    56 	if ((ret != KErrNone) && (ret != KErrAlreadyExists))
       
    57 		INFO_PRINTF2(_L("error is : %d \n"), ret);
       
    58 	else	
       
    59 		INFO_PRINTF1(_L("Started C32\n"));
       
    60 
       
    61 	RGenConAgentDialogServer dlgSv;
       
    62 	TRAP_IGNORE(dlgSv.Connect());
       
    63 	INFO_PRINTF1(_L("Connected Dialog Server\n"));
       
    64 
       
    65 	TRequestStatus status;
       
    66 
       
    67 	INFO_PRINTF1(_L("\nTesting the IAP Selection Dialog\n")); 
       
    68 	TUint32 iap=0;
       
    69 	TConnectionPrefs prefs;
       
    70 	prefs.iRank = 1;
       
    71 	prefs.iDirection = ECommDbConnectionDirectionOutgoing;
       
    72 	prefs.iBearerSet = ECommDbBearerCSD;
       
    73 	dlgSv.IapConnection(iap,prefs,status);
       
    74 	INFO_PRINTF1(_L("Requested IAP selection\n"));
       
    75 	User::WaitForRequest(status);
       
    76 	ret=status.Int();
       
    77 	INFO_PRINTF2(_L("Request IAP selection completed with code=%d\n"),ret);
       
    78 	checkError(dlgSv,ret);
       
    79 	INFO_PRINTF2(_L("IAP id = %d\n"),iap);
       
    80 
       
    81 	return TestStepResult();
       
    82 	}
       
    83 
       
    84 
       
    85 void CTestIAPDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
    86 	{
       
    87 	if (aError!=KErrNone && aError!=KErrCancel)
       
    88 		aDlgSvr.Close();
       
    89 
       
    90 	if ((aError!=KErrNone) && (aError!=KErrCancel))
       
    91 		INFO_PRINTF2(_L("Error is : %d \n"), aError);
       
    92 	}
       
    93 
       
    94 void CTestIAPDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
    95 	{
       
    96 	if (aError!=KErrNone)
       
    97 		{
       
    98 		aDlgSvr.ClosePct();
       
    99 		TRequestStatus destroyStatus;
       
   100 		User::WaitForRequest(destroyStatus);
       
   101 		aDlgSvr.Close();
       
   102 		}
       
   103 
       
   104 	TEST(aError==KErrNone);
       
   105 	}	
       
   106 
       
   107 
       
   108 //
       
   109 
       
   110 CTestAccessPointDialog::~CTestAccessPointDialog()
       
   111 /**
       
   112  * Destructor
       
   113  */
       
   114 	{
       
   115 	}
       
   116 
       
   117 CTestAccessPointDialog::CTestAccessPointDialog()
       
   118 /**
       
   119  * Constructor
       
   120  */
       
   121 	{
       
   122 	SetTestStepName(KTestAccessPointDialog);
       
   123 	}
       
   124 
       
   125 TVerdict CTestAccessPointDialog::doTestStepL()
       
   126 	{
       
   127  	// When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since
       
   128  	// it needs a different CommDB
       
   129  	_LIT(KPhbkSyncCMI, "phbsync.cmi");
       
   130     TInt ret = StartC32WithCMISuppressions(KPhbkSyncCMI);
       
   131 	if ((ret != KErrNone) && (ret != KErrAlreadyExists))
       
   132 		INFO_PRINTF2(_L("error is : %d \n"), ret);
       
   133 	else	
       
   134 		INFO_PRINTF1(_L("Started C32\n"));
       
   135 
       
   136 	RGenConAgentDialogServer dlgSv;
       
   137 	TRAP_IGNORE(dlgSv.Connect());
       
   138 	INFO_PRINTF1(_L("Connected Dialog Server\n"));
       
   139 
       
   140 	TRequestStatus status;
       
   141 
       
   142 	INFO_PRINTF1(_L("\nTesting the Access Point Selection Dialog\n")); 
       
   143 	TUint32 ap=0;
       
   144 	dlgSv.AccessPointConnection(ap,1,status);
       
   145 	INFO_PRINTF1(_L("Requested Access Point selection\n"));
       
   146 	User::WaitForRequest(status);
       
   147 	ret=status.Int();
       
   148 	INFO_PRINTF2(_L("Request Access Point selection completed with code=%d\n"),ret);
       
   149 	checkError(dlgSv,ret);
       
   150 	INFO_PRINTF2(_L("Access Point id = %d\n"),ap);
       
   151 
       
   152 	return TestStepResult();
       
   153 	}
       
   154 
       
   155 
       
   156 void CTestAccessPointDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
   157 	{
       
   158 	if (aError!=KErrNone && aError!=KErrCancel)
       
   159 		aDlgSvr.Close();
       
   160 
       
   161 	if ((aError!=KErrNone) && (aError!=KErrCancel))
       
   162 		INFO_PRINTF2(_L("Error is : %d \n"), aError);
       
   163 	}
       
   164 
       
   165 void CTestAccessPointDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError)
       
   166 	{
       
   167 	if (aError!=KErrNone)
       
   168 		{
       
   169 		aDlgSvr.ClosePct();
       
   170 		TRequestStatus destroyStatus;
       
   171 		User::WaitForRequest(destroyStatus);
       
   172 		aDlgSvr.Close();
       
   173 		}
       
   174 
       
   175 	TEST(aError==KErrNone);
       
   176 	}
       
   177 
       
   178 
       
   179