|
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 TestReconnectionDialog.cpp |
|
18 */ |
|
19 |
|
20 //Symbian OS Headers |
|
21 #include <c32comm.h> |
|
22 #include <agentdialog.h> |
|
23 #include <e32cons.h> |
|
24 |
|
25 //Test Framework Header |
|
26 #include <test/testexecutelog.h> |
|
27 |
|
28 //Test Step Header |
|
29 #include "TestReconnectionDialog.h" |
|
30 |
|
31 |
|
32 |
|
33 CTestReconnectionDialog::~CTestReconnectionDialog() |
|
34 /** |
|
35 * Destructor |
|
36 */ |
|
37 { |
|
38 } |
|
39 |
|
40 CTestReconnectionDialog::CTestReconnectionDialog() |
|
41 /** |
|
42 * Constructor |
|
43 */ |
|
44 { |
|
45 |
|
46 SetTestStepName(KTestReconnectionDialog); |
|
47 } |
|
48 |
|
49 |
|
50 TVerdict CTestReconnectionDialog::doTestStepL() |
|
51 { |
|
52 |
|
53 // When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since |
|
54 // it needs a different CommDB |
|
55 _LIT(KPhbkSyncCMI, "phbsync.cmi"); |
|
56 TInt ret = StartC32WithCMISuppressions(KPhbkSyncCMI); |
|
57 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
58 INFO_PRINTF2(_L("error is : %d \n"), ret); |
|
59 else |
|
60 INFO_PRINTF1(_L("Started C32\n")); |
|
61 |
|
62 RGenConAgentDialogServer dlgSv; |
|
63 TRAP_IGNORE(dlgSv.Connect()); |
|
64 INFO_PRINTF1(_L("Connected Dialog Server\n")); |
|
65 |
|
66 TRequestStatus status; |
|
67 |
|
68 TConnectionPrefs prefs; |
|
69 _LIT(KIapName,"New IAP"); |
|
70 |
|
71 TBuf<16> iapName(KIapName); |
|
72 TBool response = EFalse; |
|
73 dlgSv.WarnNewIapConnection(prefs,KErrBadName,iapName,response,status); |
|
74 User::WaitForRequest(status); |
|
75 |
|
76 INFO_PRINTF1(_L("\nTesting the Reconnection Dialog\n")); |
|
77 TBool b=ETrue; |
|
78 dlgSv.Reconnect(b,status); |
|
79 User::WaitForRequest(status); |
|
80 ret=status.Int(); |
|
81 checkError(dlgSv,ret); |
|
82 if (b) |
|
83 INFO_PRINTF1(_L("Reconnect Required\n")); |
|
84 else |
|
85 INFO_PRINTF1(_L("Reconnect Not Required\n")); |
|
86 |
|
87 return TestStepResult(); |
|
88 } |
|
89 |
|
90 void CTestReconnectionDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
91 { |
|
92 if (aError!=KErrNone && aError!=KErrCancel) |
|
93 aDlgSvr.Close(); |
|
94 |
|
95 if ((aError!=KErrNone) && (aError!=KErrCancel)) |
|
96 INFO_PRINTF2(_L("Error is : %d \n"), aError); |
|
97 |
|
98 } |
|
99 |
|
100 void CTestReconnectionDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
101 { |
|
102 if (aError!=KErrNone) |
|
103 { |
|
104 aDlgSvr.ClosePct(); |
|
105 TRequestStatus destroyStatus; |
|
106 User::WaitForRequest(destroyStatus); |
|
107 aDlgSvr.Close(); |
|
108 } |
|
109 |
|
110 TEST(aError==KErrNone); |
|
111 } |
|
112 |
|
113 |