diff options
author | krisr@chromium.org <krisr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-29 19:50:56 +0000 |
---|---|---|
committer | krisr@chromium.org <krisr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-29 19:50:56 +0000 |
commit | c42372371c2c9e8326260f9af01594f943a06aa2 (patch) | |
tree | 0741dc632f3484fd4c81865ab67e6b6de4e3d3ad /chrome/test/pyautolib | |
parent | 7b597ec816c31706b33d45ab25ee966975c73a20 (diff) | |
download | chromium_src-c42372371c2c9e8326260f9af01594f943a06aa2.zip chromium_src-c42372371c2c9e8326260f9af01594f943a06aa2.tar.gz chromium_src-c42372371c2c9e8326260f9af01594f943a06aa2.tar.bz2 |
Add incognito ability to stress, allow time to handle functions with multiple args.
Review URL: http://codereview.chromium.org/7523049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r-- | chrome/test/pyautolib/timer_queue.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/test/pyautolib/timer_queue.py b/chrome/test/pyautolib/timer_queue.py index 2f7148d..8985803 100644 --- a/chrome/test/pyautolib/timer_queue.py +++ b/chrome/test/pyautolib/timer_queue.py @@ -19,7 +19,7 @@ class TimerQueue(threading.Thread): print('foo : %s' % word) timers = TimerQueue() - timers.addTimer(self._fooPrinter, 15, args='hello') + timers.addTimer(self._fooPrinter, 15, args=('hello',)) timers.start() >> hello will be printed after 15 seconds @@ -36,7 +36,7 @@ class TimerQueue(threading.Thread): self.wait_time = 1 self.timers = [] - def AddTimer(self, method, interval, args=[]): + def AddTimer(self, method, interval, args=()): """Adds a timer to the queue. Args: @@ -78,7 +78,8 @@ class TimerQueue(threading.Thread): self.timer_queue_lock.acquire() for timer in self.timers: if timer['next time'] <= now: - timer['method'](timer['args']) + # Use * to break the list into separate arguments + timer['method'](*timer['args']) timer['next time'] += timer['interval'] self.timer_queue_lock.release() if self.terminate: |