|
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 @file DataReadyCancelNotificationStep.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "DataReadyCancelNotificationStep.h" |
|
23 #include "Te_loopbackSuiteDefs.h" |
|
24 |
|
25 CDataReadyCancelNotificationStep::~CDataReadyCancelNotificationStep() |
|
26 /** |
|
27 * Destructor |
|
28 */ |
|
29 { |
|
30 } |
|
31 |
|
32 CDataReadyCancelNotificationStep::CDataReadyCancelNotificationStep() |
|
33 /** |
|
34 * Constructor |
|
35 */ |
|
36 { |
|
37 // **MUST** call SetTestStepName in the constructor as the controlling |
|
38 // framework uses the test step name immediately following construction to set |
|
39 // up the step's unique logging ID. |
|
40 SetTestStepName(KDataReadyCancelNotificationStep); |
|
41 } |
|
42 |
|
43 TVerdict CDataReadyCancelNotificationStep::doTestStepPreambleL() |
|
44 /** |
|
45 * @return - TVerdict code |
|
46 * Override of base class virtual |
|
47 */ |
|
48 { |
|
49 return OpenAllAvailablePortsL(); |
|
50 } |
|
51 |
|
52 |
|
53 TVerdict CDataReadyCancelNotificationStep::doTestStepL() |
|
54 /** |
|
55 * @return - TVerdict code |
|
56 * Override of base class pure virtual |
|
57 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
58 * not leave. That being the case, the current test result value will be EPass. |
|
59 */ |
|
60 { |
|
61 if (TestStepResult()==EPass) |
|
62 { |
|
63 _LIT8(KTestOutBuf,"test message"); |
|
64 HBufC* InBuf = HBufC::NewLC(KTestOutBuf().Length() / 2); |
|
65 TPtr ptr = InBuf->Des(); |
|
66 TPtr8 inBuf(ptr.Collapse()); |
|
67 |
|
68 TBuf<50> msg; |
|
69 _LIT(KOperReading, "Data available request canceled in port <%d>"); |
|
70 _LIT(KOperWriting, "Written port <%d>"); |
|
71 TRequestStatus status; |
|
72 for(TInt i = 0; i < KSupportedPorts; i++) |
|
73 { |
|
74 if(IsEven(i)) |
|
75 { |
|
76 iPortList[i].port.Write(status, KTestOutBuf); |
|
77 msg.Format(KOperWriting, i); |
|
78 User::WaitForRequest(status); |
|
79 TestErrorCodeL(status.Int(), msg); |
|
80 } |
|
81 else |
|
82 { |
|
83 iPortList[i].port.NotifyDataAvailableCancel(); |
|
84 msg.Format(KOperReading, i); |
|
85 } |
|
86 } |
|
87 CleanupStack::PopAndDestroy(); |
|
88 |
|
89 SetTestStepResult(EPass); |
|
90 } |
|
91 return TestStepResult(); |
|
92 } |
|
93 |
|
94 |
|
95 |
|
96 TVerdict CDataReadyCancelNotificationStep::doTestStepPostambleL() |
|
97 /** |
|
98 * @return - TVerdict code |
|
99 * Override of base class virtual |
|
100 */ |
|
101 { |
|
102 return CloseAllAvailablePortsL(); |
|
103 } |
|
104 |