|
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 TestIAPWArningDialog.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 "TestIAPWArningDialog.h" |
|
29 |
|
30 |
|
31 CTestIAPWArningDialog::~CTestIAPWArningDialog() |
|
32 /** |
|
33 * Destructor |
|
34 */ |
|
35 { |
|
36 } |
|
37 |
|
38 CTestIAPWArningDialog::CTestIAPWArningDialog() |
|
39 /** |
|
40 * Constructor |
|
41 */ |
|
42 { |
|
43 SetTestStepName(KTestIAPWArningDialog); |
|
44 } |
|
45 |
|
46 TVerdict CTestIAPWArningDialog::doTestStepL() |
|
47 { |
|
48 |
|
49 TConnectionPrefs prefs; |
|
50 _LIT(KIapName,"New IAP"); |
|
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 Warning Dialog\n")); |
|
68 TBuf<16> iapName(KIapName); |
|
69 TBool response = EFalse; |
|
70 dlgSv.WarnNewIapConnection(prefs,KErrBadName,iapName,response,status); |
|
71 INFO_PRINTF1(_L("Requested IAP warning\n")); |
|
72 User::WaitForRequest(status); |
|
73 ret=status.Int(); |
|
74 INFO_PRINTF2(_L("Request IAP warning completed with code=%d\n"),ret); |
|
75 checkError(dlgSv,ret); |
|
76 if (response) |
|
77 INFO_PRINTF1(_L("Attempt new connection\n")); |
|
78 else |
|
79 INFO_PRINTF1(_L("Do not attempt new connection\n")); |
|
80 |
|
81 |
|
82 return TestStepResult(); |
|
83 } |
|
84 |
|
85 |
|
86 void CTestIAPWArningDialog::checkError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
87 { |
|
88 if (aError!=KErrNone && aError!=KErrCancel) |
|
89 aDlgSvr.Close(); |
|
90 |
|
91 if ((aError!=KErrNone) && (aError!=KErrCancel)) |
|
92 INFO_PRINTF2(_L("Error is : %d \n"), aError); |
|
93 } |
|
94 |
|
95 void CTestIAPWArningDialog::checkPctError(RGenConAgentDialogServer& aDlgSvr, TInt aError) |
|
96 { |
|
97 if (aError!=KErrNone) |
|
98 { |
|
99 aDlgSvr.ClosePct(); |
|
100 TRequestStatus destroyStatus; |
|
101 User::WaitForRequest(destroyStatus); |
|
102 aDlgSvr.Close(); |
|
103 } |
|
104 |
|
105 TEST(aError==KErrNone); |
|
106 } |
|
107 |
|
108 |