|
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 TestAuthenticationDialog.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 "TestAuthenticationDialog.h" |
|
29 |
|
30 |
|
31 |
|
32 CTestAuthenticationDialog::~CTestAuthenticationDialog() |
|
33 /** |
|
34 * Destructor |
|
35 */ |
|
36 { |
|
37 } |
|
38 |
|
39 CTestAuthenticationDialog::CTestAuthenticationDialog() |
|
40 /** |
|
41 * Constructor |
|
42 */ |
|
43 { |
|
44 SetTestStepName(KTestAuthenticationDialog); |
|
45 } |
|
46 |
|
47 |
|
48 TVerdict CTestAuthenticationDialog::doTestStepL() |
|
49 { |
|
50 |
|
51 // When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since |
|
52 // it needs a different CommDB |
|
53 _LIT(KPhbkSyncCMI, "phbsync.cmi"); |
|
54 TInt ret = StartC32WithCMISuppressions(KPhbkSyncCMI); |
|
55 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
56 INFO_PRINTF2(_L("error is : %d \n"),ret); |
|
57 else |
|
58 INFO_PRINTF1(_L("Started C32\n")); |
|
59 |
|
60 RGenConAgentDialogServer dlgSv; |
|
61 TRAP_IGNORE(dlgSv.Connect()); |
|
62 INFO_PRINTF1(_L("Connected Dialog Server\n")); |
|
63 |
|
64 TRequestStatus status; |
|
65 |
|
66 TBuf<KCommsDbSvrMaxFieldLength> username=_L("LnUser"); |
|
67 TBuf<KCommsDbSvrMaxFieldLength> password=_L("LnPass"); |
|
68 |
|
69 |
|
70 INFO_PRINTF1(_L("\nTesting the Authentication Dialog\n")); |
|
71 username.Copy(_L("User")); |
|
72 password.Copy(_L("Pass")); |
|
73 dlgSv.Authenticate(username,password,EFalse,status); |
|
74 User::WaitForRequest(status); |
|
75 ret=status.Int(); |
|
76 INFO_PRINTF2(_L("Authenticate completed with code=%d\n"),ret); |
|
77 checkError(dlgSv,ret); |
|
78 INFO_PRINTF3(_L("Username=%S Password=%S\n"),&username,&password); |
|
79 |
|
80 return TestStepResult(); |
|
81 } |
|
82 |
|
83 |
|
84 void CTestAuthenticationDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
85 { |
|
86 if (aError!=KErrNone && aError!=KErrCancel) |
|
87 aDlgSvr.Close(); |
|
88 |
|
89 if ((aError!=KErrNone) && (aError!=KErrCancel)) |
|
90 INFO_PRINTF2(_L("Error is : %d \n"), aError); |
|
91 } |
|
92 |
|
93 void CTestAuthenticationDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
94 { |
|
95 if (aError!=KErrNone) |
|
96 { |
|
97 aDlgSvr.ClosePct(); |
|
98 TRequestStatus destroyStatus; |
|
99 User::WaitForRequest(destroyStatus); |
|
100 aDlgSvr.Close(); |
|
101 } |
|
102 |
|
103 TEST(aError==KErrNone); |
|
104 } |
|
105 |
|
106 |