sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
|
sl@0
|
23 |
#include "t_message.h"
|
sl@0
|
24 |
#include "t_input.h"
|
sl@0
|
25 |
#include "t_testactionspec.h"
|
sl@0
|
26 |
#include "t_output.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
_LIT8(KMessageStart, "<message>");
|
sl@0
|
29 |
_LIT8(KMessageEnd, "</message>");
|
sl@0
|
30 |
|
sl@0
|
31 |
CTestActionMessage* CTestActionMessage::NewL(CConsoleBase& aConsole,
|
sl@0
|
32 |
Output& aOut,
|
sl@0
|
33 |
const TTestActionSpec& aTestActionSpec)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
CTestActionMessage* self = CTestActionMessage::NewLC(aConsole, aOut, aTestActionSpec);
|
sl@0
|
36 |
CleanupStack::Pop(self);
|
sl@0
|
37 |
return self;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
CTestActionMessage* CTestActionMessage::NewLC(CConsoleBase& aConsole,
|
sl@0
|
41 |
Output& aOut,
|
sl@0
|
42 |
const TTestActionSpec& aTestActionSpec)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
CTestActionMessage* self = new(ELeave) CTestActionMessage(aConsole, aOut);
|
sl@0
|
45 |
CleanupStack::PushL(self);
|
sl@0
|
46 |
self->ConstructL(aTestActionSpec);
|
sl@0
|
47 |
return self;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
CTestActionMessage::~CTestActionMessage()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
delete iMessage;
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
void CTestActionMessage::DoPerformPrerequisite(TRequestStatus& aStatus)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
iActionState = EAction;
|
sl@0
|
58 |
TRequestStatus* status = &aStatus;
|
sl@0
|
59 |
User::RequestComplete(status, KErrNone);
|
sl@0
|
60 |
};
|
sl@0
|
61 |
|
sl@0
|
62 |
void CTestActionMessage::PerformAction(TRequestStatus& aStatus)
|
sl@0
|
63 |
{
|
sl@0
|
64 |
TRequestStatus* status = &aStatus;
|
sl@0
|
65 |
User::RequestComplete(status, KErrNone);
|
sl@0
|
66 |
iActionState = EPostrequisite;
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
void CTestActionMessage::DoPerformPostrequisite(TRequestStatus& aStatus)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
TRequestStatus* status = &aStatus;
|
sl@0
|
72 |
User::RequestComplete(status, KErrNone);
|
sl@0
|
73 |
iFinished = ETrue;
|
sl@0
|
74 |
iResult = ETrue;
|
sl@0
|
75 |
};
|
sl@0
|
76 |
|
sl@0
|
77 |
void CTestActionMessage::PerformMessage()
|
sl@0
|
78 |
{
|
sl@0
|
79 |
__ASSERT_DEBUG(EFalse, User::Panic(_L("CTestActionMessage::PerformMessage()"), 1));
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
void CTestActionMessage::Reset()
|
sl@0
|
83 |
{
|
sl@0
|
84 |
__ASSERT_DEBUG(EFalse, User::Panic(_L("CTestActionMessage::Reset()"), 1));
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
CTestActionMessage::CTestActionMessage(CConsoleBase& aConsole,
|
sl@0
|
88 |
Output& aOut)
|
sl@0
|
89 |
: CTestAction(aConsole, aOut)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
void CTestActionMessage::ConstructL(const TTestActionSpec& aTestActionSpec)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
CTestAction::ConstructL(aTestActionSpec);
|
sl@0
|
96 |
TInt pos = 0;
|
sl@0
|
97 |
TInt err = KErrNone;
|
sl@0
|
98 |
HBufC8* aBody = HBufC8::NewLC(aTestActionSpec.iActionBody.Length());
|
sl@0
|
99 |
aBody->Des().Copy(aTestActionSpec.iActionBody);
|
sl@0
|
100 |
TPtrC8 pMessage = Input::ParseElement(*aBody, KMessageStart, KMessageEnd, pos, err);
|
sl@0
|
101 |
User::LeaveIfError(err);
|
sl@0
|
102 |
iMessage = pMessage.AllocL();
|
sl@0
|
103 |
CleanupStack::PopAndDestroy();
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
void CTestActionMessage::DoReportAction()
|
sl@0
|
107 |
{
|
sl@0
|
108 |
iOut.writeString(*iMessage);
|
sl@0
|
109 |
iOut.writeNewLine();
|
sl@0
|
110 |
iOut.writeNewLine();
|
sl@0
|
111 |
}
|
sl@0
|
112 |
|
sl@0
|
113 |
void CTestActionMessage::DoCheckResult(TInt /*aError*/)
|
sl@0
|
114 |
{
|
sl@0
|
115 |
}
|