Index: build/android/pylib/utils/reraiser_thread_unittest.py |
diff --git a/build/android/pylib/utils/reraiser_thread_unittest.py b/build/android/pylib/utils/reraiser_thread_unittest.py |
index 9228829fa23e25c98cb683d635d37ac36a547473..916d47efbc21897ce86e97db8daf9874d67f632e 100644 |
--- a/build/android/pylib/utils/reraiser_thread_unittest.py |
+++ b/build/android/pylib/utils/reraiser_thread_unittest.py |
@@ -4,9 +4,11 @@ |
"""Unittests for reraiser_thread.py.""" |
+import threading |
import unittest |
import reraiser_thread |
+import watchdog_timer |
class TestException(Exception): |
@@ -75,6 +77,20 @@ class TestReraiserThreadGroup(unittest.TestCase): |
with self.assertRaises(TestException): |
group.JoinAll() |
+ def testJoinTimeout(self): |
+ def f(): |
+ pass |
+ event = threading.Event() |
+ def g(): |
+ event.wait() |
+ group = reraiser_thread.ReraiserThreadGroup( |
+ [reraiser_thread.ReraiserThread(g), |
+ reraiser_thread.ReraiserThread(f)]) |
+ group.StartAll() |
+ with self.assertRaises(reraiser_thread.TimeoutError): |
+ group.JoinAll(watchdog_timer.WatchdogTimer(0.01)) |
+ event.set() |
+ |
if __name__ == '__main__': |
unittest.main() |