|
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 TestLoginDialog.cpp |
|
18 */ |
|
19 //Symbian OS Headers |
|
20 #include <c32comm.h> |
|
21 #include <agentdialog.h> |
|
22 |
|
23 //Test Framework Header |
|
24 #include <test/testexecutelog.h> |
|
25 |
|
26 //Test Step Header |
|
27 #include "TestLoginDialog.h" |
|
28 |
|
29 |
|
30 CTestLoginDialog::~CTestLoginDialog() |
|
31 /** |
|
32 * Destructor |
|
33 */ |
|
34 { |
|
35 } |
|
36 |
|
37 CTestLoginDialog::CTestLoginDialog() |
|
38 /** |
|
39 * Constructor |
|
40 */ |
|
41 { |
|
42 SetTestStepName(KTestLoginDialog); |
|
43 } |
|
44 |
|
45 |
|
46 TVerdict CTestLoginDialog::doTestStepL() |
|
47 { |
|
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 Login Dialog\n")); |
|
66 TBuf<KCommsDbSvrMaxFieldLength> username=_L("LnUser"); |
|
67 TBuf<KCommsDbSvrMaxFieldLength> password=_L("LnPass"); |
|
68 dlgSv.Login(username,password,EFalse,status); |
|
69 User::WaitForRequest(status); |
|
70 ret=status.Int(); |
|
71 INFO_PRINTF2(_L("Login completed with code=%d\n"),ret); |
|
72 checkError(dlgSv,ret); |
|
73 INFO_PRINTF3(_L("Username=%S Password=%S\n"),&username,&password); |
|
74 |
|
75 return TestStepResult(); |
|
76 } |
|
77 |
|
78 |
|
79 void CTestLoginDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
80 { |
|
81 if (aError!=KErrNone && aError!=KErrCancel) |
|
82 aDlgSvr.Close(); |
|
83 |
|
84 if ((aError!=KErrNone) && (aError!=KErrCancel)) |
|
85 INFO_PRINTF2(_L("Error is : %d \n"), aError); |
|
86 } |
|
87 |
|
88 void CTestLoginDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
89 { |
|
90 if (aError!=KErrNone) |
|
91 { |
|
92 aDlgSvr.ClosePct(); |
|
93 TRequestStatus destroyStatus; |
|
94 User::WaitForRequest(destroyStatus); |
|
95 aDlgSvr.Close(); |
|
96 } |
|
97 |
|
98 TEST(aError==KErrNone); |
|
99 } |
|
100 |
|
101 |