diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2017-05-10 15:04:18 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2017-05-10 15:04:18 -0400 |
commit | 9c66072cacae0b3b86a277780e3a19e94accd6bc (patch) | |
tree | be16b4903034fcad814121cfeef586ed4defa33e /indra/llcommon/tests/listener.h | |
parent | 16e9e87d925d145e7464cef24c089b3d2726d32d (diff) |
Add LLEventThrottle tests; actually *all* lleventfilter.cpp tests.
For some reason there wasn't an entry in indra/llcommon/CMakeLists.txt to run
the tests in indra/llcommon/tests/lleventfilter_test.cpp. It seems likely that
at some point it existed, since all previous tests built and ran successfully.
In any case, (re-)add lleventfilter_test.cpp to the set of llcommon tests.
Also alphabetize them to make it easier to find a particular test invocation.
Also add new tests for LLEventThrottle.
To support this, refactor the concrete LLEventThrottle class into
LLEventThrottleBase containing all the tricky logic, with pure virtual
methods for access to LLTimer and LLEventTimeout, and an LLEventThrottle
subclass containing the LLTimer and LLEventTimeout instances and corresponding
implementations of the new pure virtual methods.
That permits us to introduce TestEventThrottle, an alternate subclass with
dummy implementations of the methods related to LLTimer and LLEventTimeout. In
particular, we can explicitly advance simulated realtime to simulate
particular LLTimer and LLEventTimeout behaviors.
Finally, introduce Concat, a test LLEventPump listener class whose function is
to concatenate received string event data into a composite string so we can
readily test for particular sequences of events.
Diffstat (limited to 'indra/llcommon/tests/listener.h')
-rw-r--r-- | indra/llcommon/tests/listener.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indra/llcommon/tests/listener.h b/indra/llcommon/tests/listener.h index 9c5c18a150..6072060bb6 100644 --- a/indra/llcommon/tests/listener.h +++ b/indra/llcommon/tests/listener.h @@ -138,4 +138,15 @@ struct Collect StringVec result; }; +struct Concat +{ + bool operator()(const LLSD& event) + { + result += event.asString(); + return false; + } + void clear() { result.clear(); } + std::string result; +}; + #endif /* ! defined(LL_LISTENER_H) */ |