|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: STIF testing for MPX Harvester |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <Stiftestinterface.h> |
|
21 #include <SettingServerClient.h> |
|
22 #include "mpxharvestertest.h" |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // Cmpxharvestertest::Cmpxharvestertest |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 Cmpxharvestertest::Cmpxharvestertest( |
|
33 CTestModuleIf& aTestModuleIf ): |
|
34 CScriptBase( aTestModuleIf ) |
|
35 { |
|
36 iHarvester = NULL; |
|
37 iCollection = NULL; |
|
38 iFileMan = NULL; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Cmpxharvestertest::ConstructL |
|
43 // Symbian 2nd phase constructor can leave. |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 void Cmpxharvestertest::ConstructL() |
|
47 { |
|
48 iLog = CStifLogger::NewL( KmpxharvestertestLogPath, |
|
49 KmpxharvestertestLogFile, |
|
50 CStifLogger::ETxt, |
|
51 CStifLogger::EFile, |
|
52 EFalse ); |
|
53 User::LeaveIfError( iFs.Connect() ); |
|
54 iFileMan = CFileMan::NewL(iFs); |
|
55 |
|
56 TBool err = KErrNone; |
|
57 err = iFs.MkDir(Kmpxharvester_soundsPath); |
|
58 if ( err == KErrNone || err == KErrAlreadyExists ) |
|
59 { |
|
60 err = iFs.MkDir(Kmpxharvester_digitalPath); |
|
61 if ( err != KErrNone && err != KErrAlreadyExists ) |
|
62 { |
|
63 User::Leave(err); |
|
64 } |
|
65 } |
|
66 else |
|
67 { |
|
68 User::Leave(err); |
|
69 } |
|
70 |
|
71 // Print title of the test case |
|
72 TName title; |
|
73 TestModuleIf().GetTestCaseTitleL(title); |
|
74 iLog->Log(_L(" ")); |
|
75 iLog->Log(_L("[Title] %S"), &title); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // Cmpxharvestertest::NewL |
|
80 // Two-phased constructor. |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 Cmpxharvestertest* Cmpxharvestertest::NewL( |
|
84 CTestModuleIf& aTestModuleIf ) |
|
85 { |
|
86 Cmpxharvestertest* self = new (ELeave) Cmpxharvestertest( aTestModuleIf ); |
|
87 |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL(); |
|
90 CleanupStack::Pop(); |
|
91 return self; |
|
92 } |
|
93 |
|
94 // Destructor |
|
95 Cmpxharvestertest::~Cmpxharvestertest() |
|
96 { |
|
97 // Delete resources allocated from test methods |
|
98 Delete(); |
|
99 // Delete logger |
|
100 delete iLog; |
|
101 delete iFileMan; |
|
102 iFs.Close(); |
|
103 } |
|
104 |
|
105 // ======== GLOBAL FUNCTIONS ======== |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // LibEntryL is a polymorphic Dll entry point. |
|
109 // Returns: CScriptBase: New CScriptBase derived object |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C CScriptBase* LibEntryL( |
|
113 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
114 { |
|
115 return ( CScriptBase* ) Cmpxharvestertest::NewL( aTestModuleIf ); |
|
116 } |