1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <e32base_private.h> |
23 #include <e32base_private.h> |
24 #include <e32Test.h> // RTest headder |
24 #include <e32Test.h> // RTest headder |
25 #include "testcaseroot.h" |
25 #include "testcaseroot.h" |
26 #include "testcase0457.h" |
26 #include "testcase0457.h" |
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "testcase0457Traces.h" |
|
30 #endif |
|
31 |
27 |
32 |
28 |
33 |
29 |
34 // the name below is used to add a pointer to our construction method to a pointer MAP in |
30 // the name below is used to add a pointer to our construction method to a pointer MAP in |
35 // the class factory |
31 // the class factory |
39 // # times to repeat the steps |
35 // # times to repeat the steps |
40 #define OPEN_REPEATS gOpenIterations |
36 #define OPEN_REPEATS gOpenIterations |
41 |
37 |
42 CTestCase0457* CTestCase0457::NewL(TBool aHost) |
38 CTestCase0457* CTestCase0457::NewL(TBool aHost) |
43 { |
39 { |
44 if(gVerboseOutput) |
40 LOG_FUNC |
45 { |
|
46 OstTraceFunctionEntry0(CTESTCASE0457_NEWL); |
|
47 } |
|
48 CTestCase0457* self = new (ELeave) CTestCase0457(aHost); |
41 CTestCase0457* self = new (ELeave) CTestCase0457(aHost); |
49 CleanupStack::PushL(self); |
42 CleanupStack::PushL(self); |
50 self->ConstructL(); |
43 self->ConstructL(); |
51 CleanupStack::Pop(self); |
44 CleanupStack::Pop(self); |
52 return self; |
45 return self; |
54 |
47 |
55 |
48 |
56 CTestCase0457::CTestCase0457(TBool aHost) |
49 CTestCase0457::CTestCase0457(TBool aHost) |
57 : CTestCaseRoot(KTestCaseId, aHost) |
50 : CTestCaseRoot(KTestCaseId, aHost) |
58 { |
51 { |
59 if(gVerboseOutput) |
52 LOG_FUNC |
60 { |
|
61 OstTraceFunctionEntry0(CTESTCASE0457_CTESTCASE0457); |
|
62 } |
|
63 } |
53 } |
64 |
54 |
65 |
55 |
66 /** |
56 /** |
67 ConstructL |
57 ConstructL |
68 */ |
58 */ |
69 void CTestCase0457::ConstructL() |
59 void CTestCase0457::ConstructL() |
70 { |
60 { |
71 if(gVerboseOutput) |
61 LOG_FUNC |
72 { |
|
73 OstTraceFunctionEntry0(CTESTCASE0457_CONSTRUCTL); |
|
74 } |
|
75 iRepeats = OPEN_REPEATS; |
62 iRepeats = OPEN_REPEATS; |
76 |
63 |
77 BaseConstructL(); |
64 BaseConstructL(); |
78 } |
65 } |
79 |
66 |
80 |
67 |
81 CTestCase0457::~CTestCase0457() |
68 CTestCase0457::~CTestCase0457() |
82 { |
69 { |
83 if(gVerboseOutput) |
70 LOG_FUNC |
84 { |
|
85 OstTraceFunctionEntry0(CTESTCASE0457_DCTESTCASE0457); |
|
86 } |
|
87 |
71 |
88 Cancel(); |
72 Cancel(); |
89 } |
73 } |
90 |
74 |
91 |
75 |
92 void CTestCase0457::ExecuteTestCaseL() |
76 void CTestCase0457::ExecuteTestCaseL() |
93 { |
77 { |
94 if(gVerboseOutput) |
78 LOG_FUNC |
95 { |
|
96 OstTraceFunctionEntry0(CTESTCASE0457_EXECUTETESTCASEL); |
|
97 } |
|
98 iCaseStep = EPreconditions; |
79 iCaseStep = EPreconditions; |
99 |
80 |
100 CActiveScheduler::Add(this); |
81 CActiveScheduler::Add(this); |
101 SelfComplete(); |
82 SelfComplete(); |
102 } |
83 } |
103 |
84 |
104 |
85 |
105 void CTestCase0457::DescribePreconditions() |
86 void CTestCase0457::DescribePreconditions() |
106 { |
87 { |
107 test.Printf(_L("Remove any USB plug beforehand.\n")); |
88 test.Printf(_L("Remove any USB plug beforehand.\n")); |
108 OstTrace0(TRACE_NORMAL, CTESTCASE0457_DESCRIBEPRECONDITIONS, "Remove any USB plug beforehand.\n"); |
|
109 } |
89 } |
110 |
90 |
111 |
91 |
112 void CTestCase0457::DoCancel() |
92 void CTestCase0457::DoCancel() |
113 { |
93 { |
114 if(gVerboseOutput) |
94 LOG_FUNC |
115 { |
|
116 OstTraceFunctionEntry0(CTESTCASE0457_DOCANCEL); |
|
117 } |
|
118 |
95 |
119 // cancel our timer |
96 // cancel our timer |
120 iTimer.Cancel(); |
97 iTimer.Cancel(); |
121 } |
98 } |
122 |
99 |
123 |
100 |
124 // handle event completion |
101 // handle event completion |
125 void CTestCase0457::RunStepL() |
102 void CTestCase0457::RunStepL() |
126 { |
103 { |
127 if(gVerboseOutput) |
104 LOG_FUNC |
128 { |
|
129 OstTraceFunctionEntry0(CTESTCASE0457_RUNSTEPL); |
|
130 } |
|
131 |
105 |
132 // Obtain the completion code for this CActive obj. |
106 // Obtain the completion code for this CActive obj. |
133 TInt completionCode(iStatus.Int()); |
107 TInt completionCode(iStatus.Int()); |
134 |
108 |
135 switch(iCaseStep) |
109 switch(iCaseStep) |
136 { |
110 { |
137 case EPreconditions: |
111 case EPreconditions: |
138 { |
112 { |
139 test.Printf(KPressAnyKeyToStart); |
113 test.Printf(KPressAnyKeyToStart); |
140 OstTrace0(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP01, KPressAnyKeyToStart); |
|
141 iCaseStep = ELoadLdd; |
114 iCaseStep = ELoadLdd; |
142 RequestCharacter(); |
115 RequestCharacter(); |
143 break; |
116 break; |
144 } |
117 } |
145 |
118 |
146 case ELoadLdd: |
119 case ELoadLdd: |
147 test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
120 test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
148 OstTraceExt2(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP02, "Load the LDD iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
|
149 if (!StepLoadLDD()) |
121 if (!StepLoadLDD()) |
150 { |
122 { |
151 break; |
123 break; |
152 } |
124 } |
153 |
125 |