diff options
author | Ted Gould <ted@gould.cx> | 2015-02-09 11:25:52 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-09 11:25:52 -0600 |
commit | 38b5f26e19facc5571723d122f4fa97eea8ba395 (patch) | |
tree | e9db5710b5dd435c733d16d208594640466f74ea /tests/indicator-fixture.h | |
parent | 00d4c04919b70f53fd6c6242e59aee631799dc4f (diff) | |
download | ayatana-indicator-sound-38b5f26e19facc5571723d122f4fa97eea8ba395.tar.gz ayatana-indicator-sound-38b5f26e19facc5571723d122f4fa97eea8ba395.tar.bz2 ayatana-indicator-sound-38b5f26e19facc5571723d122f4fa97eea8ba395.zip |
Adding time checking in
Diffstat (limited to 'tests/indicator-fixture.h')
-rw-r--r-- | tests/indicator-fixture.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h index 2948e6b..e16d254 100644 --- a/tests/indicator-fixture.h +++ b/tests/indicator-fixture.h @@ -33,6 +33,8 @@ class IndicatorFixture : public ::testing::Test std::string _indicatorPath; std::string _indicatorAddress; std::vector<std::shared_ptr<DbusTestTask>> _mocks; + protected: + std::chrono::milliseconds _eventuallyTime; class PerRunData { public: @@ -118,6 +120,7 @@ class IndicatorFixture : public ::testing::Test const std::string& addr) : _indicatorPath(path) , _indicatorAddress(addr) + , _eventuallyTime(std::chrono::seconds(5)) { }; @@ -202,14 +205,15 @@ class IndicatorFixture : public ::testing::Test std::promise<testing::AssertionResult> retpromise; auto retfuture = retpromise.get_future(); + auto start = std::chrono::steady_clock::now(); /* The core of the idle function as an object so we can use the C++-isms of attaching the variables and make this code reasonably readable */ - auto idlefunc = [&loop, &retpromise, &testfunc]() -> void { + auto idlefunc = [&loop, &retpromise, &testfunc, &start, this]() -> void { auto result = testfunc(); + g_debug("Idle Ran"); - if (result == false) { - /* TODO: Check time */ + if (result == false && _eventuallyTime > (std::chrono::steady_clock::now() - start)) { return; } |