0
|
1 |
// Copyright (c) 2005-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 |
// Example CTestStep derived implementation
|
|
15 |
//
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file DEXECPlugin.cpp
|
|
21 |
@internalTechnology
|
|
22 |
*/
|
|
23 |
#include "SELFPluginStep.h"
|
|
24 |
#include "tcoredumpserversuitedefs.h"
|
|
25 |
#include "CDSconnectionstep.h"
|
|
26 |
|
|
27 |
CCDSConnectionsStep::~CCDSConnectionsStep()
|
|
28 |
/**
|
|
29 |
* Destructor
|
|
30 |
*/
|
|
31 |
{
|
|
32 |
}
|
|
33 |
|
|
34 |
CCDSConnectionsStep::CCDSConnectionsStep()
|
|
35 |
/**
|
|
36 |
* Constructor
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
// **MUST** call SetTestStepName in the constructor as the controlling
|
|
40 |
// framework uses the test step name immediately following construction to set
|
|
41 |
// up the step's unique logging ID.
|
|
42 |
SetTestStepName(KCDSConnectionsStep);
|
|
43 |
}
|
|
44 |
|
|
45 |
TVerdict CCDSConnectionsStep::doTestStepPreambleL()
|
|
46 |
/**
|
|
47 |
* @return - TVerdict code
|
|
48 |
* Override of base class virtual
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
return TestStepResult();
|
|
52 |
}
|
|
53 |
|
|
54 |
TVerdict CCDSConnectionsStep::doTestStepL()
|
|
55 |
/**
|
|
56 |
* @return - TVerdict code
|
|
57 |
* Override of base class pure virtual
|
|
58 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
59 |
* not leave. That being the case, the current test result value will be EPass.
|
|
60 |
*/
|
|
61 |
{
|
|
62 |
if (TestStepResult()==EPass)
|
|
63 |
{
|
|
64 |
TInt ret = KErrNone;
|
|
65 |
|
|
66 |
__UHEAP_MARK;
|
|
67 |
|
|
68 |
TRAP(ret, ClientAppL());
|
|
69 |
if(KErrNone != ret)
|
|
70 |
{
|
|
71 |
SetTestStepResult(EFail);
|
|
72 |
ERR_PRINTF2(_L("Error %d from CCDSConnectionsStep->ClientAppL()"), ret);
|
|
73 |
}
|
|
74 |
|
|
75 |
__UHEAP_MARKEND;
|
|
76 |
|
|
77 |
}
|
|
78 |
return TestStepResult();
|
|
79 |
}
|
|
80 |
|
|
81 |
void CCDSConnectionsStep::ClientAppL()
|
|
82 |
/**
|
|
83 |
* @return void
|
|
84 |
* This calls each stage of the test
|
|
85 |
*/
|
|
86 |
{
|
|
87 |
INFO_PRINTF1(_L("Starting CSDConnections Plugin Test Suite") );
|
|
88 |
TestConnectionsL();
|
|
89 |
}
|
|
90 |
|
|
91 |
void CCDSConnectionsStep::TestConnectionsL()
|
|
92 |
{
|
|
93 |
|
|
94 |
if (TestStepResult()==EPass)
|
|
95 |
{
|
|
96 |
RCoreDumpSession cdsSess;
|
|
97 |
|
|
98 |
//Try connecting
|
|
99 |
TInt ret = KErrNone;
|
|
100 |
ret = cdsSess.Connect();
|
|
101 |
CleanupClosePushL(cdsSess);
|
|
102 |
|
|
103 |
if(ret != KErrNone)
|
|
104 |
{
|
|
105 |
SetTestStepResult( EFail );
|
|
106 |
ERR_PRINTF2(_L("Error %d from cdsSess->Connect()"), ret);
|
|
107 |
return;
|
|
108 |
}
|
|
109 |
INFO_PRINTF1(_L("Connected successfully"));
|
|
110 |
|
|
111 |
//close the connection
|
|
112 |
cdsSess.Disconnect();
|
|
113 |
INFO_PRINTF1(_L("Disconnected successfully"));
|
|
114 |
|
|
115 |
//Try opening another one straight away and using it...
|
|
116 |
ret = cdsSess.Connect();
|
|
117 |
if(ret != KErrNone)
|
|
118 |
{
|
|
119 |
SetTestStepResult( EFail );
|
|
120 |
ERR_PRINTF2(_L("Error %d from cdsSess->Connect() the second time (following a connection just being closed)"), ret);
|
|
121 |
return;
|
|
122 |
}
|
|
123 |
INFO_PRINTF1(_L("Connected successfully"));
|
|
124 |
|
|
125 |
//now try to attach/detach
|
|
126 |
INFO_PRINTF1(_L("Attach to crashapp.exe") );
|
|
127 |
TRAPD(err, cdsSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, ETrue) );
|
|
128 |
if(err != KErrNone)
|
|
129 |
{
|
|
130 |
INFO_PRINTF2(_L("attach iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe) failed:%d\n"), err);
|
|
131 |
SetTestStepResult(EFail);
|
|
132 |
User::Leave( err );
|
|
133 |
}
|
|
134 |
|
|
135 |
INFO_PRINTF1(_L("Detach from crashapp.exe") );
|
|
136 |
TRAP(err, cdsSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, EFalse) );
|
|
137 |
if(err != KErrNone)
|
|
138 |
{
|
|
139 |
INFO_PRINTF2(_L("detach iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe) failed:%d\n"), err);
|
|
140 |
SetTestStepResult(EFail);
|
|
141 |
User::Leave( err );
|
|
142 |
}
|
|
143 |
|
|
144 |
INFO_PRINTF1(_L("Attach to crashappoem.exe") );
|
|
145 |
TRAPD(oem, cdsSess.ObservationRequestL( KCrashAppFileNameNonDebugBit, KCrashAppFileNameNonDebugBit, ETrue) );
|
|
146 |
if(oem != KErrPermissionDenied)
|
|
147 |
{
|
|
148 |
INFO_PRINTF2(_L("attach iSess.ObservationRequestL(z:\\sys\\bin\\crashappoem.exe) failed:%d\n"), oem);
|
|
149 |
SetTestStepResult(EFail);
|
|
150 |
User::Leave( oem );
|
|
151 |
}
|
|
152 |
|
|
153 |
INFO_PRINTF1(_L("Detach from crashappoem.exe") );
|
|
154 |
TRAP(oem, cdsSess.ObservationRequestL( KCrashAppFileNameNonDebugBit, KCrashAppFileNameNonDebugBit, EFalse) );
|
|
155 |
if(oem != KErrNotFound)
|
|
156 |
{
|
|
157 |
INFO_PRINTF2(_L("detach iSess.ObservationRequestL(z:\\sys\\bin\\crashappoem.exe) failed:%d\n"), oem);
|
|
158 |
SetTestStepResult(EFail);
|
|
159 |
User::Leave( oem );
|
|
160 |
}
|
|
161 |
|
|
162 |
CleanupStack::PopAndDestroy(&cdsSess);
|
|
163 |
}
|
|
164 |
}
|
|
165 |
|
|
166 |
TVerdict CCDSConnectionsStep::doTestStepPostambleL()
|
|
167 |
/**
|
|
168 |
* @return - TVerdict code
|
|
169 |
* Override of base class virtual
|
|
170 |
*/
|
|
171 |
{
|
|
172 |
return EPass;
|
|
173 |
}
|
|
174 |
|
|
175 |
|
|
176 |
|