24
|
1 |
// Copyright (c) 2001-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 |
// This contains PsdAgt TestCase Test 2.1 - 2.4
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
// EPOC includes
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <in_sock.h>
|
|
21 |
|
|
22 |
// Test system includes
|
|
23 |
#include "networking/log.h"
|
|
24 |
#include "networking/teststep.h"
|
|
25 |
#include "TestStepPsdAgt.h"
|
|
26 |
#include "TestSuitePsdAgt.h"
|
|
27 |
|
|
28 |
// RPacketContext
|
|
29 |
#include <etelpckt.h>
|
|
30 |
|
|
31 |
// EConnectionOpen
|
|
32 |
#include <connectprog.h>
|
|
33 |
|
|
34 |
// COMMDB Database Undo
|
|
35 |
#include "DbUndo.h"
|
|
36 |
|
|
37 |
// Class definitions
|
|
38 |
#include "Psdagttestcontextconfigchange.h"
|
|
39 |
|
|
40 |
|
|
41 |
// Test case 2.1, Context Config change, Service Option reduced, disconnect
|
|
42 |
enum TVerdict CPsdAgtTest2_1::doPsdAgtTestStepL( void )
|
|
43 |
{
|
|
44 |
TRealAgtNotify agtNotify;
|
|
45 |
agtNotify.SetTestCase(201);
|
|
46 |
// Call QoSChange connection function
|
|
47 |
QoSChangeDisconnectL(agtNotify);
|
|
48 |
|
|
49 |
// Close database object, forcing it to undo all changes that were made
|
|
50 |
Log(_L("Reverting COMMDB changes"));
|
|
51 |
|
|
52 |
return iTestStepResult;
|
|
53 |
}
|
|
54 |
|
|
55 |
void CPsdAgtTest2_1::DialogHasAppeared()
|
|
56 |
{
|
|
57 |
// Should only display the dialog once before the disconnect request
|
|
58 |
TEST(iStage==0);
|
|
59 |
|
|
60 |
iStage++;
|
|
61 |
}
|
|
62 |
|
|
63 |
void CPsdAgtTest2_1::PsdAgtDisconnectRequest()
|
|
64 |
{
|
|
65 |
// Should only receive a disconnect request immediately
|
|
66 |
// after displaying the first dialog
|
|
67 |
// TEST(iStage==1);
|
|
68 |
TEST(iStage==0);
|
|
69 |
iStage++;
|
|
70 |
|
|
71 |
// Unblock the call to QoSChangeDisconnectL();
|
|
72 |
CActiveScheduler::Stop();
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// Test case 2.2, Context Config change, Service Option reduced, don't disconnect
|
|
77 |
enum TVerdict CPsdAgtTest2_2::doPsdAgtTestStepL( void )
|
|
78 |
{
|
|
79 |
|
|
80 |
TRealAgtNotify agtNotify;
|
|
81 |
agtNotify.SetTestCase(202);
|
|
82 |
|
|
83 |
// Call QoSChange connection function
|
|
84 |
QoSChangeNoDisconnectL(agtNotify);
|
|
85 |
|
|
86 |
// Close database object, forcing it to undo all changes that were made
|
|
87 |
Log(_L("Reverting COMMDB changes"));
|
|
88 |
|
|
89 |
return iTestStepResult;
|
|
90 |
}
|
|
91 |
|
|
92 |
void CPsdAgtTest2_2::DialogHasAppeared()
|
|
93 |
{
|
|
94 |
// Should only display the dialog once
|
|
95 |
TEST(iStage==0);
|
|
96 |
|
|
97 |
iStage++;
|
|
98 |
|
|
99 |
// Unblock the call to QoSChangeNoDisconnectL();
|
|
100 |
CActiveScheduler::Stop();
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
// Test case 2.3, Context Config change, Service Option reduced
|
|
105 |
enum TVerdict CPsdAgtTest2_3::doPsdAgtTestStepL( void )
|
|
106 |
{
|
|
107 |
|
|
108 |
TRealAgtNotify agtNotify;
|
|
109 |
agtNotify.SetTestCase(203);
|
|
110 |
|
|
111 |
// Call QoSChange connection function
|
|
112 |
QoSChangeWithinTimeoutL(agtNotify);
|
|
113 |
|
|
114 |
// Close database object, forcing it to undo all changes that were made
|
|
115 |
Log(_L("Reverting COMMDB changes"));
|
|
116 |
|
|
117 |
return iTestStepResult;
|
|
118 |
}
|
|
119 |
|
|
120 |
// Test case 2.4, GPRS Context Config change, no effect
|
|
121 |
enum TVerdict CPsdAgtTest2_4::doPsdAgtTestStepL( void )
|
|
122 |
{
|
|
123 |
TInt err;
|
|
124 |
TInt stage;
|
|
125 |
CNifAgentRefN1 *agent;
|
|
126 |
TRealAgtNotify agtNotify;
|
|
127 |
|
|
128 |
agtNotify.SetTestCase(204);
|
|
129 |
SetGPRSModeL(agtNotify);
|
|
130 |
|
|
131 |
// Construct a new Dummy Nifman Instance
|
|
132 |
Log(_L("Loading DUMMYNIF.DLL"));
|
|
133 |
agent = CNifAgentRefN1::NewL(this,EFalse);
|
|
134 |
CleanupStack::PushL(agent);
|
|
135 |
|
|
136 |
// Attempt connection
|
|
137 |
Log(_L("Connecting..."));
|
|
138 |
agent->Connect();
|
|
139 |
|
|
140 |
// Check result codes
|
|
141 |
agent->GetCompletionCode(err);
|
|
142 |
TESTEL(err==KErrNone,err);
|
|
143 |
|
|
144 |
// Check ConnectComplete was reported at the correct stage in the state machine
|
|
145 |
agent->GetProgressStage(stage);
|
|
146 |
TESTEL(stage==KConnectionOpen,stage);
|
|
147 |
|
|
148 |
Log(_L("Connect Successful"));
|
|
149 |
|
|
150 |
// Predetermined QoS warning response
|
|
151 |
iDlgSvr->SetQoSWarnResponse(EFalse);
|
|
152 |
|
|
153 |
DelayL(3000000);
|
|
154 |
|
|
155 |
// Tell the ETEL layer to send a context config change to PsdAgt
|
|
156 |
Log(_L("Notify PsdAgt of Context Config change"));
|
|
157 |
agtNotify.NotifyAgt(EReduce);
|
|
158 |
|
|
159 |
// Wait to make sure that no dialog appears
|
|
160 |
DelayL(3000000);
|
|
161 |
|
|
162 |
// Disconnect
|
|
163 |
Log(_L("Disconnecting"));
|
|
164 |
agent->Disconnect();
|
|
165 |
|
|
166 |
// Check result code
|
|
167 |
agent->GetCompletionCode(err);
|
|
168 |
TESTEL(err==KErrNone, err);
|
|
169 |
|
|
170 |
Log(_L("Disconnect Successful"));
|
|
171 |
|
|
172 |
// Finished with Dummy Nifman so delete it
|
|
173 |
CleanupStack::PopAndDestroy(agent);
|
|
174 |
Log(_L("DUMMYNIF.DLL Unloaded"));
|
|
175 |
|
|
176 |
return iTestStepResult;
|
|
177 |
}
|
|
178 |
|