|
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 te_uloggerserialpluginstep.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #include "te_uloggerfilepluginsteperr.h" |
|
24 #include "te_uloggerfilepluginstep.h" |
|
25 #include "te_uloggermclsuitedefs.h" |
|
26 |
|
27 ///negative testing |
|
28 CULoggerFilePluginStepErr::~CULoggerFilePluginStepErr() |
|
29 { |
|
30 } |
|
31 |
|
32 CULoggerFilePluginStepErr::CULoggerFilePluginStepErr() |
|
33 { |
|
34 SetTestStepName(KULoggerFilePluginStepErr); |
|
35 } |
|
36 |
|
37 TVerdict CULoggerFilePluginStepErr::doTestStepPreambleL() |
|
38 { |
|
39 INFO_PRINTF1(_L("Negative testing of ulogger - returning err code from a plugin.")); |
|
40 return TestStepResult(); |
|
41 } |
|
42 |
|
43 TVerdict CULoggerFilePluginStepErr::doTestStepL() |
|
44 { |
|
45 if (TestStepResult()==EPass) |
|
46 { |
|
47 TInt result = 0; |
|
48 INFO_PRINTF1(_L("Testing...")); |
|
49 RULogger logger; |
|
50 logger.Connect(); |
|
51 CClearConfig configIni; |
|
52 configIni.Clear(logger); |
|
53 _LIT8(KTextmedia,"te_fileplugin"); |
|
54 const TPtrC8 mediaptr(KTextmedia); |
|
55 INFO_PRINTF1(_L("Setting test plugin as active...")); |
|
56 result = logger.ActivateOutputPlugin(mediaptr); |
|
57 if(result != KErrNone && result != KErrAlreadyExists) |
|
58 { |
|
59 INFO_PRINTF1(_L("ERROR: Setting test plugin as active error.")); |
|
60 SetTestStepResult(EFail); |
|
61 } |
|
62 |
|
63 if(result==0||result==-11) |
|
64 { |
|
65 INFO_PRINTF1(_L("Tesr File Plugin active")); |
|
66 _LIT(KTextsetting, "ErrorCode"); |
|
67 _LIT(KTextvalue, "10"); |
|
68 // test setting the plugin settings |
|
69 TPluginConfiguration pluginConfig; |
|
70 pluginConfig.SetKey(KTextsetting); |
|
71 pluginConfig.SetValue(KTextvalue); |
|
72 result=logger.SetPluginConfigurations(mediaptr,pluginConfig); |
|
73 if(result!=KErrNone) |
|
74 { |
|
75 INFO_PRINTF1(_L("ERROR: Setting test plugin configuration error.")); |
|
76 SetTestStepResult(EFail); |
|
77 } |
|
78 _LIT(KTextsetting2, "output_path"); |
|
79 _LIT(KTextvalue2, "C:\\logs\\ULoggerFileLoggingTest.log"); |
|
80 // test setting the plugin settings |
|
81 TPluginConfiguration pluginConfig2; |
|
82 pluginConfig2.SetKey(KTextsetting2); |
|
83 pluginConfig2.SetValue(KTextvalue2); |
|
84 result=logger.SetPluginConfigurations(mediaptr,pluginConfig2); |
|
85 if(result!=KErrNone) |
|
86 { |
|
87 INFO_PRINTF1(_L("ERROR: Setting test plugin configuration (path) error.")); |
|
88 SetTestStepResult(EFail); |
|
89 } |
|
90 |
|
91 INFO_PRINTF1(_L("setting filters...")); |
|
92 CArrayFixFlat<TUint8>*a = new (ELeave) CArrayFixFlat<TUint8>(1); |
|
93 a->AppendL(4); |
|
94 logger.SetPrimaryFiltersEnabled(*a, ETrue); |
|
95 logger.SetNotificationSize(0); |
|
96 logger.SetBufferSize(1020); |
|
97 delete a; |
|
98 |
|
99 INFO_PRINTF1(_L("starting ulogger...")); |
|
100 logger.Stop(); |
|
101 result = logger.Start(); |
|
102 if(result != KErrNone) |
|
103 { |
|
104 INFO_PRINTF2(_L("ERROR: Starting Ulogger error: %d"), result); |
|
105 SetTestStepResult(EFail); |
|
106 } |
|
107 User::After(1*1000*1000); |
|
108 |
|
109 INFO_PRINTF1(_L("stopping ulogger...")); |
|
110 result = logger.Stop(); |
|
111 if(result != KErrNone) |
|
112 { |
|
113 INFO_PRINTF2(_L("ERROR: Stopping error %d (server probably panicked)"), result); |
|
114 SetTestStepResult(EFail); |
|
115 } |
|
116 } |
|
117 else |
|
118 { |
|
119 INFO_PRINTF1(_L("ERROR: Test plugin not found.")); |
|
120 SetTestStepResult(EFail); |
|
121 } |
|
122 } |
|
123 return TestStepResult(); |
|
124 } |
|
125 |
|
126 TVerdict CULoggerFilePluginStepErr::doTestStepPostambleL() |
|
127 { |
|
128 INFO_PRINTF1(_L("Negative testing of ulogger (err code from plugin) passed")); |
|
129 return TestStepResult(); |
|
130 } |
|
131 |