|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <errno.h> |
|
19 #include "monitor.h" |
|
20 #include "TestHarness.h" |
|
21 #include "logger.h" |
|
22 |
|
23 #include "commsserverendpoint.h" |
|
24 #include "commsclientendpoint.h" |
|
25 #include "commsmessage.h" |
|
26 #include "echoserver.h" |
|
27 |
|
28 using namespace java::comms; |
|
29 |
|
30 TEST_GROUP(Heap) |
|
31 { |
|
32 TEST_SETUP() |
|
33 { |
|
34 { |
|
35 } |
|
36 } |
|
37 |
|
38 TEST_TEARDOWN() |
|
39 { |
|
40 } |
|
41 }; |
|
42 |
|
43 |
|
44 #ifdef __SYMBIAN32__ |
|
45 class HeapListener : public CommsListener |
|
46 { |
|
47 virtual void processMessage(CommsMessage& message) |
|
48 { |
|
49 std::string s; |
|
50 int i; |
|
51 message >> s >> i; |
|
52 } |
|
53 }; |
|
54 |
|
55 // The purpose of this test is to ensure that clients of javacomms library |
|
56 // can use __UHEAP_MARK etc macros in their unit tests without giving false alarms |
|
57 TEST(Heap, HeapCheck) |
|
58 { |
|
59 __UHEAP_MARK; |
|
60 { |
|
61 EchoServer server; |
|
62 CHECK(!server.start(IPC_ADDRESS_COMMS_MODULE_TEST)); |
|
63 |
|
64 CommsClientEndpoint client; |
|
65 HeapListener listener; |
|
66 CHECK(!client.registerDefaultListener(&listener)); |
|
67 CHECK(!client.connect(IPC_ADDRESS_COMMS_MODULE_TEST)); |
|
68 |
|
69 CommsMessage msg; |
|
70 msg << "add some random stuff" << 123; |
|
71 |
|
72 CHECK(!client.send(msg)); |
|
73 |
|
74 CommsMessage receivedMsg; |
|
75 CHECK(!client.sendReceive(msg, receivedMsg, 1)); |
|
76 } |
|
77 __UHEAP_MARKEND; |
|
78 } |
|
79 #endif |
|
80 |