|
1 // Copyright (c) 2008-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 #include <ImplementationProxy.h> |
|
24 #include "..\TRecUpgrade\upgconstants.h" |
|
25 #include "..\TRecUpgrade\recupgrade.h" |
|
26 #include <f32file.h> // TParse |
|
27 |
|
28 ///////////////////////////////////////////////// |
|
29 |
|
30 const TInt KMaxBufferLength=1024; // maximum amount of buffer space we will ever use |
|
31 |
|
32 ///////////////////////////////////////////////// |
|
33 |
|
34 /* |
|
35 DLL entry point |
|
36 */ |
|
37 GLDEF_C TInt E32Dll() |
|
38 { |
|
39 return KErrNone; |
|
40 } |
|
41 |
|
42 /* |
|
43 Private constructor |
|
44 */ |
|
45 CTestUpgradeRecognizer::CTestUpgradeRecognizer() |
|
46 :CApaDataRecognizerType(KUidUpgradeRecognizer, CApaDataRecognizerType::ENormal) |
|
47 { |
|
48 iCountDataTypes = KNumUpgradeTypes; |
|
49 } |
|
50 |
|
51 /* |
|
52 Ecom factory function |
|
53 */ |
|
54 CApaDataRecognizerType* CTestUpgradeRecognizer::CreateRecognizerL() |
|
55 { |
|
56 return new (ELeave) CTestUpgradeRecognizer(); |
|
57 } |
|
58 |
|
59 TUint CTestUpgradeRecognizer::PreferredBufSize() |
|
60 { |
|
61 return KMaxBufferLength; |
|
62 } |
|
63 |
|
64 TDataType CTestUpgradeRecognizer::SupportedDataTypeL(TInt /*aIndex*/) const |
|
65 { |
|
66 return TDataType(KMimeUpgType); |
|
67 } |
|
68 |
|
69 void CTestUpgradeRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& /*aBuffer*/) |
|
70 { |
|
71 // If an error stops CTestUpgradeRecognizer being removed as part of test cleanup, |
|
72 // returning ENotRecognized will avoid the possibility of impacting other test code. |
|
73 |
|
74 _LIT(KExtension , ".upg"); |
|
75 TParse parse; |
|
76 parse.Set(aName,NULL,NULL); |
|
77 TPtrC ext=parse.Ext(); // extract the extension from the filename |
|
78 |
|
79 if (ext.CompareF(KExtension)==0) |
|
80 { |
|
81 iDataType = TDataType(KMimeUpgType); |
|
82 iConfidence = EPossible; |
|
83 } |
|
84 else |
|
85 { |
|
86 iDataType=TDataType(); |
|
87 iConfidence=ENotRecognized; |
|
88 } |
|
89 } |
|
90 |
|
91 const TImplementationProxy ImplementationTable[] = |
|
92 { |
|
93 IMPLEMENTATION_PROXY_ENTRY(KUidUpgradeRecognizerValue, CTestUpgradeRecognizer::CreateRecognizerL) |
|
94 }; |
|
95 |
|
96 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
97 { |
|
98 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
99 return ImplementationTable; |
|
100 } |