summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-30 13:21:13 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-30 13:23:25 -0700
commit08ebb3993a2b5a82d0a5ead29a649c95632f7c64 (patch)
treed545f9f1f446f9dc3ce5806823b75109d089c3dc /test
parenta5f8596add59b7ba5716abe5b0caba21ed84a0f7 (diff)
downloadsdeventplus-08ebb3993a2b5a82d0a5ead29a649c95632f7c64.tar.gz
sdeventplus-08ebb3993a2b5a82d0a5ead29a649c95632f7c64.zip
utility/timer: Implement callback setting
All of the other classes that take callbacks support having the callback updated. Tested: Builds and passed through the unit test suite. Change-Id: I0efcd074523fa6ec0cc84c7a930346dd9340f7ec Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/utility/timer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/utility/timer.cpp b/test/utility/timer.cpp
index 6c04e87..f35a0c4 100644
--- a/test/utility/timer.cpp
+++ b/test/utility/timer.cpp
@@ -379,6 +379,13 @@ TEST_F(TimerTest, CallbackMove)
expectSetTime(new_time + interval);
EXPECT_EQ(0, handler(nullptr, 0, handler_userdata));
EXPECT_EQ(1, called);
+
+ // update the callback and make sure it still works
+ timer->set_callback(std::bind([]() {}));
+ expectNow(new_time);
+ expectSetTime(new_time + interval);
+ EXPECT_EQ(0, handler(nullptr, 0, handler_userdata));
+ EXPECT_EQ(1, called);
}
TEST_F(TimerTest, SetValuesExpiredTimer)
OpenPOWER on IntegriCloud