sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\misc\t_asid.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
#define __E32TEST_EXTENSION__
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include "t_asid.h"
|
sl@0
|
20 |
#include "d_asid.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
RTest test(_L("T_ASID_DUMMY"));
|
sl@0
|
23 |
|
sl@0
|
24 |
class RAsidSession : RSessionBase
|
sl@0
|
25 |
{
|
sl@0
|
26 |
public:
|
sl@0
|
27 |
TInt CreateSession(const TDesC& aServerName, TInt aMsgSlots)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
return RSessionBase::CreateSession(aServerName,User::Version(),aMsgSlots);
|
sl@0
|
30 |
}
|
sl@0
|
31 |
TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
return (SendReceive(aFunction, aPtr));
|
sl@0
|
34 |
}
|
sl@0
|
35 |
TInt PublicSend(TInt aFunction, const TIpcArgs &aPtr)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
return (Send(aFunction, aPtr));
|
sl@0
|
38 |
}
|
sl@0
|
39 |
};
|
sl@0
|
40 |
|
sl@0
|
41 |
GLDEF_C TInt E32Main()
|
sl@0
|
42 |
{
|
sl@0
|
43 |
|
sl@0
|
44 |
TUint len = User::CommandLineLength();
|
sl@0
|
45 |
if (len > 0)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
HBufC* buf = HBufC::New(len);
|
sl@0
|
48 |
test(buf != NULL);
|
sl@0
|
49 |
TPtr ptr = buf->Des();
|
sl@0
|
50 |
User::CommandLine(ptr);
|
sl@0
|
51 |
|
sl@0
|
52 |
if (ptr == KAsidIpcServerName)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
TUint8 array[KAsidDesLen];
|
sl@0
|
55 |
memset(array, KAsidValue, KAsidDesLen);
|
sl@0
|
56 |
TPtr8 buf(array, KAsidDesLen, KAsidDesLen);
|
sl@0
|
57 |
|
sl@0
|
58 |
RAsidSession session;
|
sl@0
|
59 |
test_KErrNone(session.CreateSession(KAsidIpcServerName, 1));
|
sl@0
|
60 |
|
sl@0
|
61 |
test_KErrNone(session.PublicSendReceive(EIpcData, TIpcArgs(&buf)));
|
sl@0
|
62 |
test_KErrNone(session.PublicSend(EIpcData, TIpcArgs(&buf)));
|
sl@0
|
63 |
// Just exit badly, i.e. without disconnecting...
|
sl@0
|
64 |
}
|
sl@0
|
65 |
else if (ptr == KAsidDesServerName)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
TUint8 array[KAsidDesLen];
|
sl@0
|
68 |
memset(array, KAsidValue, KAsidDesLen);
|
sl@0
|
69 |
TPtr8 buf(array, KAsidDesLen, KAsidDesLen);
|
sl@0
|
70 |
|
sl@0
|
71 |
// Get the current thread pointer to pass to server.
|
sl@0
|
72 |
TAny* threadPtr;
|
sl@0
|
73 |
RAsidLdd asidLdd;
|
sl@0
|
74 |
test_KErrNone(asidLdd.Open());
|
sl@0
|
75 |
test_KErrNone(asidLdd.GetCurrentThread(threadPtr));
|
sl@0
|
76 |
|
sl@0
|
77 |
RAsidSession session;
|
sl@0
|
78 |
test_KErrNone(session.CreateSession(KAsidDesServerName, 1));
|
sl@0
|
79 |
|
sl@0
|
80 |
test_KErrNone(session.PublicSendReceive(EDesData, TIpcArgs((TAny*)&buf, threadPtr)));
|
sl@0
|
81 |
test_KErrNone(session.PublicSend(EDesData, TIpcArgs((TAny*)&buf, threadPtr)));
|
sl@0
|
82 |
// Just exit badly, i.e. without disconnecting...
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
return KErrNone;
|
sl@0
|
88 |
}
|