diff options
author | Kozoriz <kozorizandriy@gmail.com> | 2016-02-17 10:07:52 +0200 |
---|---|---|
committer | Kozoriz <kozorizandriy@gmail.com> | 2016-02-17 10:16:17 +0200 |
commit | b47b91241b9956cc08da71cb933cfa227d3141f3 (patch) | |
tree | 7107f9789f294efd654644bfd8e9e59e5537c3d4 /src/components/utils | |
parent | 0bc55c8bf92fca0d4d65304b6733397b07d4a197 (diff) | |
download | sdl_core-b47b91241b9956cc08da71cb933cfa227d3141f3.tar.gz |
Styling correctives
Diffstat (limited to 'src/components/utils')
-rw-r--r-- | src/components/utils/test/timer_test.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/components/utils/test/timer_test.cc b/src/components/utils/test/timer_test.cc index aaec451f92..13bf5eeb0d 100644 --- a/src/components/utils/test/timer_test.cc +++ b/src/components/utils/test/timer_test.cc @@ -40,9 +40,7 @@ namespace test { namespace components { - namespace timer_test { - namespace { sync_primitives::Lock test_lock; @@ -53,15 +51,17 @@ const std::string kTimerName = "test_timer"; class TestTask : public timer::TimerTask { public: TestTask() : calls_count_(0u) {} + void run() const OVERRIDE { sync_primitives::AutoLock auto_lock(test_lock); ++calls_count_; lock_monitor.NotifyOne(); } + uint GetCallsCount() const { return calls_count_; } - ~TestTask() {} + private: mutable uint calls_count_; }; @@ -75,15 +75,18 @@ class FakeClassWithTimer { this, &FakeClassWithTimer::OnTimer)) { internal_timer_.Start(kDefaultTimeout, true); } + void OnTimer() { sync_primitives::AutoLock auto_lock_(test_lock); internal_timer_.Stop(); ++calls_count_; lock_monitor.NotifyOne(); } + bool IsTimerRunning() const { return internal_timer_.IsRunning(); } + uint GetCallsCount() const { return calls_count_; } @@ -94,7 +97,6 @@ class FakeClassWithTimer { }; } // namespace - class TimerTest : public testing::Test { protected: void SetUp() OVERRIDE { @@ -143,7 +145,7 @@ TEST_F(TimerTest, Start_Loop_3Calls) { timer::Timer test_timer(kTimerName, task); // Actions test_timer.Start(timeout_, repeatable_); - for (int i = loops_count; i; --i) { + for (uint i = loops_count; i; --i) { lock_monitor.Wait(test_lock); } test_lock.Release(); @@ -182,7 +184,6 @@ TEST_F(TimerTest, Start_NotRunned_RunnedWithNewTimeout) { ASSERT_TRUE(test_timer.IsRunning()); } - TEST_F(TimerTest, Stop_FirstLoop_NoCall) { // Preconditions timer::Timer test_timer(kTimerName, test_task_); |