|
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 "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 //Test Step header |
|
18 #include "HWRMFmTxReserve_CStep.h" |
|
19 #include "HWRMFmTxClientServer.h" |
|
20 |
|
21 |
|
22 //TO BE SAFE |
|
23 IMPORT_C TInt StartDialogThread(); |
|
24 |
|
25 CHWRMFmTxReserveStep::CHWRMFmTxReserveStep() |
|
26 /** Each test step initialises it's own name |
|
27 */ |
|
28 { |
|
29 // store the name of this test case |
|
30 // this is the name that is used by the script file |
|
31 //DEF iTestStepName = _L("CPARAM_MESS_NAMEStep"); |
|
32 |
|
33 TUint32 KCapabilityNoneBitMask = 0x80000000; // 2147483648LL; |
|
34 |
|
35 //The server name and IPC number is obtained and all messages are checked Sync |
|
36 SR_ServerName = KServerProcessName; |
|
37 SR_MESSAGE_TYPE = KSyncMessage; //Is it Async or sync? |
|
38 SR_MESSAGE_ID = EHWRMFmTxReserve ; //It holds the IPC number |
|
39 SR_MESSAGE_MASK = KCapabilityNoneBitMask; //Holds the cap mask for the message |
|
40 |
|
41 |
|
42 |
|
43 //The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName |
|
44 |
|
45 iServer_Panic = _L("HWRM Server"); |
|
46 |
|
47 //TCapability cap[] = {ECapabilityPARAM_MESS_NAMECAP, ECapability_Limit}; |
|
48 TCapability cap[] = {ECapability_None, ECapability_Limit}; |
|
49 |
|
50 TSecurityInfo info; |
|
51 info.Set(RProcess()); |
|
52 TBool result = EFalse; |
|
53 |
|
54 for (TInt i = 0; cap[i] != ECapability_Limit; i++) |
|
55 { |
|
56 |
|
57 if (!(info.iCaps.HasCapability(cap[i]))) |
|
58 { |
|
59 result=ETrue; |
|
60 |
|
61 } |
|
62 |
|
63 } |
|
64 |
|
65 iExpect_Rejection = result; |
|
66 iStepCap = KCapabilityNoneBitMask; |
|
67 |
|
68 //Get a unique thread name |
|
69 ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID); |
|
70 } |
|
71 |
|
72 /* |
|
73 Exec_SendReceive(): |
|
74 This Fn is called by the Child Thread |
|
75 1. Create a session with the server |
|
76 2. Test an SendReceive call |
|
77 3. Informs the main thread about the status of the call using |
|
78 a. iSessionCreated, if the a connection is established |
|
79 b. iResult_Server, holds the return value for connection |
|
80 c. iResult_SR, the return value of SendReceive call |
|
81 */ |
|
82 |
|
83 TInt CHWRMFmTxReserveStep::Exec_SendReceive() |
|
84 { |
|
85 iResult_Server = CreateSession(SR_ServerName,Version(),2); |
|
86 |
|
87 if (iResult_Server!=KErrNone) |
|
88 { |
|
89 |
|
90 iResult_Server=StartServer(); |
|
91 if (iResult_Server!=KErrNone) |
|
92 return(iResult_Server); |
|
93 |
|
94 iResult_Server = CreateSession(SR_ServerName,TVersion(),2); |
|
95 } |
|
96 if(iResult_Server == KErrNone) |
|
97 { |
|
98 iSessionCreated = ETrue; |
|
99 |
|
100 /* |
|
101 if(SR_MESSAGE_ID == EEtelDbgMarkHeap || |
|
102 SR_MESSAGE_ID == EEtelDbgCheckHeap || |
|
103 SR_MESSAGE_ID == EEtelDbgMarkEnd || |
|
104 SR_MESSAGE_ID == EEtelDbgFailNext) |
|
105 { |
|
106 iResult_SR = TestDebugHeap(SR_MESSAGE_ID); |
|
107 } |
|
108 else |
|
109 */ |
|
110 if(SR_MESSAGE_ID >= 0) |
|
111 { |
|
112 TIpcArgs args(0,0,0,0); |
|
113 iResult_SR = SendReceive(SR_MESSAGE_ID,args); |
|
114 } |
|
115 } |
|
116 |
|
117 return iResult_Server; |
|
118 } |