|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 /** |
|
17 @file UloggerServerTest6Step.cpp |
|
18 @internalTechnology |
|
19 */ |
|
20 #include "uloggerservertest6step.h" |
|
21 #include "te_uloggerservertestsuitedefs.h" |
|
22 |
|
23 |
|
24 namespace Ulogger |
|
25 { |
|
26 |
|
27 CUloggerServerTest6Step::~CUloggerServerTest6Step() |
|
28 /** |
|
29 * Destructor |
|
30 */ |
|
31 { |
|
32 |
|
33 } |
|
34 |
|
35 CUloggerServerTest6Step::CUloggerServerTest6Step() |
|
36 /** |
|
37 * Constructor |
|
38 */ |
|
39 { |
|
40 SetTestStepName(KUloggerServerTest6Step); |
|
41 } |
|
42 |
|
43 TVerdict CUloggerServerTest6Step::doTestStepPreambleL() |
|
44 /** |
|
45 * @return - TVerdict code |
|
46 * Override of base class virtual |
|
47 */ |
|
48 { |
|
49 INFO_PRINTF1(_L("****This is unit test for ControlDataManager class****")); |
|
50 iScheduler = new (ELeave) CActiveScheduler(); |
|
51 CActiveScheduler::Install(iScheduler); |
|
52 |
|
53 iMan = new CInputData(); |
|
54 if(!iMan) |
|
55 SetTestStepResult(EFail); |
|
56 |
|
57 SetTestStepResult(EPass); |
|
58 return TestStepResult(); |
|
59 } |
|
60 |
|
61 |
|
62 TVerdict CUloggerServerTest6Step::doTestStepL() |
|
63 /** |
|
64 * @return - TVerdict code |
|
65 * Override of base class pure virtual |
|
66 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
67 * not leave. That being the case, the current test result value will be EPass. |
|
68 */ |
|
69 { |
|
70 if (TestStepResult()==EPass) |
|
71 { |
|
72 TBuf8<32> cmdDes; |
|
73 cmdDes.Copy(_L8("set f1")); |
|
74 ControlData* cData = iMan->CreatePackage((void*)cmdDes.Ptr(), cmdDes.Length()); |
|
75 if(!cData) |
|
76 { |
|
77 INFO_PRINTF1(_L("error")); |
|
78 SetTestStepResult(EFail); |
|
79 } |
|
80 |
|
81 TBuf8<32> cmdDes3; |
|
82 cmdDes3.Num(4); |
|
83 iMan->AppendNewData(cData, (const void*)cmdDes3.Ptr(), cmdDes3.Length()); |
|
84 TInt chunks = iMan->GetChunksCount(cData); |
|
85 if(chunks != 3) |
|
86 { |
|
87 INFO_PRINTF1(_L("error")); |
|
88 SetTestStepResult(EFail); |
|
89 } |
|
90 |
|
91 //test method |
|
92 TInt size = iMan->GetSize(cData); |
|
93 |
|
94 unsigned long cSize; |
|
95 const void* _cmd3 = iMan->GetChunk(cData, 2, cSize); |
|
96 TPtrC8 cmd3((const unsigned char*)_cmd3, cSize); |
|
97 if(cmd3.Compare(cmdDes3) != 0) |
|
98 { |
|
99 INFO_PRINTF1(_L("error")); |
|
100 SetTestStepResult(EFail); |
|
101 } |
|
102 |
|
103 delete [] cData; |
|
104 if(TestStepResult()!=EFail) |
|
105 SetTestStepResult(EPass); |
|
106 } |
|
107 |
|
108 return TestStepResult(); |
|
109 } |
|
110 |
|
111 |
|
112 |
|
113 TVerdict CUloggerServerTest6Step::doTestStepPostambleL() |
|
114 /** |
|
115 * @return - TVerdict code |
|
116 * Override of base class virtual |
|
117 */ |
|
118 { |
|
119 delete iScheduler; |
|
120 iScheduler = NULL; |
|
121 |
|
122 delete iMan; |
|
123 iMan = NULL; |
|
124 |
|
125 return TestStepResult(); |
|
126 } |
|
127 } |