diff options
author | Armin Weatherwax | 2010-06-14 12:04:49 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:38:25 +0200 |
commit | 35df5441d3e2789663532c948731aff3a1e04728 (patch) | |
tree | ac7674289784a5f96106ea507637055a8dada78a /linden/indra/llmessage/tests/commtest.h | |
parent | Changed version to Experimental 2010.09.18 (diff) | |
download | meta-impy-35df5441d3e2789663532c948731aff3a1e04728.zip meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.gz meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.bz2 meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.xz |
llmediaplugins first step
Diffstat (limited to 'linden/indra/llmessage/tests/commtest.h')
-rw-r--r-- | linden/indra/llmessage/tests/commtest.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/linden/indra/llmessage/tests/commtest.h b/linden/indra/llmessage/tests/commtest.h new file mode 100644 index 0000000..cf1461e --- /dev/null +++ b/linden/indra/llmessage/tests/commtest.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /** | ||
2 | * @file commtest.h | ||
3 | * @author Nat Goodspeed | ||
4 | * @date 2009-01-09 | ||
5 | * @brief | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2009&license=viewergpl$ | ||
8 | * | ||
9 | * Copyright (c) 2009, Linden Research, Inc. | ||
10 | * | ||
11 | * Second Life Viewer Source Code | ||
12 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
13 | * to you under the terms of the GNU General Public License, version 2.0 | ||
14 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
15 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
16 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
17 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
18 | * | ||
19 | * There are special exceptions to the terms and conditions of the GPL as | ||
20 | * it is applied to this Source Code. View the full text of the exception | ||
21 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
22 | * online at | ||
23 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
24 | * | ||
25 | * By copying, modifying or distributing this software, you acknowledge | ||
26 | * that you have read and understood your obligations described above, | ||
27 | * and agree to abide by those obligations. | ||
28 | * | ||
29 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
30 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
31 | * COMPLETENESS OR PERFORMANCE. | ||
32 | * $/LicenseInfo$ | ||
33 | */ | ||
34 | |||
35 | #if ! defined(LL_COMMTEST_H) | ||
36 | #define LL_COMMTEST_H | ||
37 | |||
38 | #include "networkio.h" | ||
39 | #include "llevents.h" | ||
40 | #include "llsd.h" | ||
41 | #include "llhost.h" | ||
42 | #include "stringize.h" | ||
43 | #include <string> | ||
44 | |||
45 | /** | ||
46 | * This struct is shared by a couple of standalone comm tests (ADD_COMM_BUILD_TEST). | ||
47 | */ | ||
48 | struct commtest_data | ||
49 | { | ||
50 | NetworkIO& netio; | ||
51 | LLEventPumps& pumps; | ||
52 | LLEventStream replyPump, errorPump; | ||
53 | LLSD result; | ||
54 | bool success; | ||
55 | LLHost host; | ||
56 | std::string server; | ||
57 | |||
58 | commtest_data(): | ||
59 | netio(NetworkIO::instance()), | ||
60 | pumps(LLEventPumps::instance()), | ||
61 | replyPump("reply"), | ||
62 | errorPump("error"), | ||
63 | success(false), | ||
64 | host("127.0.0.1", 8000), | ||
65 | server(STRINGIZE("http://" << host.getString() << "/")) | ||
66 | { | ||
67 | replyPump.listen("self", boost::bind(&commtest_data::outcome, this, _1, true)); | ||
68 | errorPump.listen("self", boost::bind(&commtest_data::outcome, this, _1, false)); | ||
69 | } | ||
70 | |||
71 | bool outcome(const LLSD& _result, bool _success) | ||
72 | { | ||
73 | // std::cout << "commtest_data::outcome(" << _result << ", " << _success << ")\n"; | ||
74 | result = _result; | ||
75 | success = _success; | ||
76 | // Break the wait loop in NetworkIO::pump(), otherwise devs get | ||
77 | // irritated at making the big monolithic test executable take longer | ||
78 | pumps.obtain("done").post(success); | ||
79 | return false; | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | #endif /* ! defined(LL_COMMTEST_H) */ | ||