| OLD | NEW | 
|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import time | 5 import time | 
| 6 | 6 | 
| 7 from testing_support import auto_stub | 7 from testing_support import auto_stub | 
| 8 | 8 | 
| 9 from infra.libs.service_utils import outer_loop | 9 from infra.libs.service_utils import outer_loop | 
| 10 | 10 | 
| 11 from infra_libs.ts_mon.common import interface | 11 from infra_libs.ts_mon.common import interface | 
| 12 from infra_libs.ts_mon.common.test import stubs |  | 
| 13 | 12 | 
| 14 | 13 | 
| 15 class TestOuterLoop(auto_stub.TestCase): | 14 class TestOuterLoop(auto_stub.TestCase): | 
| 16 | 15 | 
| 17   class MyTime(): | 16   class MyTime(): | 
| 18     def __init__(self): | 17     def __init__(self): | 
| 19       self.sleeps = [] | 18       self.sleeps = [] | 
| 20       self.now = 0 | 19       self.now = 0 | 
| 21     def sleep(self, t): | 20     def sleep(self, t): | 
| 22       self.sleeps.append(t) | 21       self.sleeps.append(t) | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 85       if t == 'err': | 84       if t == 'err': | 
| 86         raise Exception('Horrible error') | 85         raise Exception('Horrible error') | 
| 87       if t == 'false': | 86       if t == 'false': | 
| 88         return False | 87         return False | 
| 89       return True | 88       return True | 
| 90     ret = outer_loop.loop(task, sleep_timeout=lambda: 1, max_errors=3, | 89     ret = outer_loop.loop(task, sleep_timeout=lambda: 1, max_errors=3, | 
| 91                           time_mod=self.time_mod) | 90                           time_mod=self.time_mod) | 
| 92     self.assertEqual(outer_loop.LoopResults(False, 5), ret) | 91     self.assertEqual(outer_loop.LoopResults(False, 5), ret) | 
| 93     self.assertEqual(['skipped'], tasks) | 92     self.assertEqual(['skipped'], tasks) | 
| 94     self.assertEqual([1, 1, 1, 1, 1, 1], self.time_mod.sleeps) | 93     self.assertEqual([1, 1, 1, 1, 1, 1], self.time_mod.sleeps) | 
| OLD | NEW | 
|---|