|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent - Internal Symbian test code |
|
19 */ |
|
20 |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 #include <apacmdln.h> |
|
26 #include <apaid.h> |
|
27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 #include <apaidpartner.h> |
|
29 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
30 #include <apgcli.h> |
|
31 #include <apgicnfl.h> |
|
32 #include <apmstd.h> |
|
33 |
|
34 const TUint KPropertyCategory=0x101F289C; |
|
35 const TUint KPropertyKey=0; |
|
36 |
|
37 _LIT(KLitExtension, ".NNAPP2"); |
|
38 |
|
39 inline void DoTest(TBool aCondition) {__ASSERT_ALWAYS(aCondition, User::Invariant());} |
|
40 |
|
41 // top-level functions |
|
42 |
|
43 LOCAL_C void MainL() |
|
44 { |
|
45 CApaCommandLine* commandLine=NULL; |
|
46 User::LeaveIfError(CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine)); |
|
47 CleanupStack::PushL(commandLine); |
|
48 const TPtrC executableName(commandLine->ExecutableName()); |
|
49 DoTest(TParsePtrC(executableName).Ext().CompareF(KLitExtension)==0); |
|
50 User::LeaveIfError(RProperty::Set(TUid::Uid(KPropertyCategory), KPropertyKey, commandLine->DocumentName())); |
|
51 CleanupStack::PopAndDestroy(commandLine); |
|
52 } |
|
53 |
|
54 GLDEF_C TInt E32Main() |
|
55 { |
|
56 CTrapCleanup* const trapCleanup=CTrapCleanup::New(); |
|
57 if (trapCleanup==NULL) |
|
58 { |
|
59 return KErrNoMemory; |
|
60 } |
|
61 TRAPD(error, MainL()); |
|
62 DoTest(error==KErrNone); |
|
63 delete trapCleanup; |
|
64 return error; |
|
65 } |
|
66 |