OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/threading/watchdog.h" | 5 #include "base/threading/watchdog.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" |
8 #include "base/synchronization/spin_wait.h" | 9 #include "base/synchronization/spin_wait.h" |
9 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 //------------------------------------------------------------------------------ | 18 //------------------------------------------------------------------------------ |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Set a time greater than the timeout into the past. | 132 // Set a time greater than the timeout into the past. |
132 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10)); | 133 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10)); |
133 // It should almost instantly go off, but certainly in less than 5 minutes. | 134 // It should almost instantly go off, but certainly in less than 5 minutes. |
134 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), | 135 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), |
135 watchdog.alarm_counter() > 0); | 136 watchdog.alarm_counter() > 0); |
136 | 137 |
137 EXPECT_EQ(1, watchdog.alarm_counter()); | 138 EXPECT_EQ(1, watchdog.alarm_counter()); |
138 } | 139 } |
139 | 140 |
140 } // namespace base | 141 } // namespace base |
OLD | NEW |