|
1 // Copyright (c) 1997-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 |
|
18 //Test Step header |
|
19 #include "PARAM_MESS_NAME_CStep.h" |
|
20 |
|
21 |
|
22 //TO BE SAFE |
|
23 IMPORT_C TInt StartDialogThread(); |
|
24 |
|
25 CPARAM_MESS_NAMEStep::CPARAM_MESS_NAMEStep() |
|
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 //The server name and IPC number is obtained and all messages are checked Sync |
|
34 SR_ServerName = _L("PARAM_SVR_NAME"); |
|
35 SR_MESSAGE_TYPE = 2; |
|
36 SR_MESSAGE_ID = PARAM_MESS_VALUE; |
|
37 SR_MESSAGE_MASK = PARAM_MESS_CAPMASK; |
|
38 |
|
39 //The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName |
|
40 |
|
41 iServer_Panic = _L("PARAM_SVR_T16_PANIC"); |
|
42 |
|
43 TCapability cap[] = {ECapabilityPARAM_MESS_NAMECAP, ECapability_Limit}; |
|
44 |
|
45 TSecurityInfo info; |
|
46 info.Set(RProcess()); |
|
47 TInt capMask = 0; |
|
48 |
|
49 // Dummy Port 2 is deliberately inaccessible and will fail every caps check. |
|
50 if( SR_MESSAGE_ID == KCommOpenWithDummy2 ) |
|
51 { |
|
52 iExpect_Rejection = ETrue; |
|
53 } |
|
54 else |
|
55 { |
|
56 iExpect_Rejection = EFalse; |
|
57 |
|
58 for ( TInt i = 0; cap[i] != ECapability_Limit; i ++ ) |
|
59 { |
|
60 if ( !( info.iCaps.HasCapability( cap[i] ) ) ) |
|
61 { |
|
62 iExpect_Rejection = ETrue; |
|
63 } |
|
64 else |
|
65 { |
|
66 capMask |= 1<<i; |
|
67 } |
|
68 } |
|
69 } |
|
70 |
|
71 iStepCap = PARAM_MESS_CAPMASK; |
|
72 |
|
73 //Get a unique thread name |
|
74 ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID); |
|
75 |
|
76 } |
|
77 |
|
78 /* |
|
79 Exec_SendReceive(): |
|
80 This Fn is called by the Child Thread |
|
81 1. Create a session with the server |
|
82 2. Test an SendReceive call |
|
83 3. Informs the main thread about the status of the call using |
|
84 a. iSessionCreated, if the a connection is established |
|
85 b. iResult_Server, holds the return value for connection |
|
86 c. iResult_SR, the return value of SendReceive call |
|
87 */ |
|
88 TInt CPARAM_MESS_NAMEStep::Exec_SendReceive() |
|
89 { |
|
90 iResult_Server = CreateSession(SR_ServerName,Version(),2); |
|
91 |
|
92 if (iResult_Server!=KErrNone) |
|
93 { |
|
94 |
|
95 iResult_Server=StartServer(); |
|
96 if (iResult_Server!=KErrNone) |
|
97 return(iResult_Server); |
|
98 |
|
99 iResult_Server = CreateSession(SR_ServerName,TVersion(),2); |
|
100 } |
|
101 if(iResult_Server == 0) |
|
102 { |
|
103 iSessionCreated = ETrue; |
|
104 |
|
105 if(SR_MESSAGE_ID >= 0) |
|
106 { |
|
107 switch(SR_MESSAGE_ID) |
|
108 { |
|
109 case ECommDbgMarkHeap: |
|
110 case ECommDbgCheckHeap: |
|
111 case ECommDbgMarkEnd: |
|
112 case ECommDbgFailNext: |
|
113 iResult_SR = TestDebugHeap(SR_MESSAGE_ID); |
|
114 break; |
|
115 case KCommOpenWithEcuart0: |
|
116 case KCommOpenWithEcuart1: |
|
117 case KCommOpenWithEcuart2: |
|
118 case KCommOpenWithDummy0: |
|
119 case KCommOpenWithDummy1: |
|
120 case KCommOpenWithDummy2: |
|
121 iResult_SR = TestDeferCaps(SR_MESSAGE_ID); |
|
122 break; |
|
123 default: |
|
124 iResult_SR = SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0)); |
|
125 break; |
|
126 } |
|
127 } |
|
128 } |
|
129 |
|
130 return iResult_Server; |
|
131 } |
|
132 |