OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import random |
| 6 |
| 7 from pylib import constants |
| 8 from pylib.base import test_instance |
| 9 |
| 10 |
| 11 _SINGLE_EVENT_TIMEOUT = 100 # Milliseconds |
| 12 |
| 13 class MonkeyTestInstance(test_instance.TestInstance): |
| 14 |
| 15 def __init__(self, args, _): |
| 16 super(MonkeyTestInstance, self).__init__() |
| 17 |
| 18 self._categories = args.categories |
| 19 self._event_count = args.event_count |
| 20 self._seed = args.seed or random.randint(1, 100) |
| 21 self._throttle = args.throttle |
| 22 self._verbose_count = args.verbose_count |
| 23 |
| 24 self._package = constants.PACKAGE_INFO[args.browser].package |
| 25 self._activity = constants.PACKAGE_INFO[args.browser].activity |
| 26 |
| 27 self._timeout_ms = (self.event_count * |
| 28 (self.throttle + _SINGLE_EVENT_TIMEOUT)) |
| 29 |
| 30 #override |
| 31 def TestType(self): |
| 32 return 'monkey' |
| 33 |
| 34 #override |
| 35 def SetUp(self): |
| 36 pass |
| 37 |
| 38 #override |
| 39 def TearDown(self): |
| 40 pass |
| 41 |
| 42 @property |
| 43 def activity(self): |
| 44 return self._activity |
| 45 |
| 46 @property |
| 47 def categories(self): |
| 48 return self._categories |
| 49 |
| 50 @property |
| 51 def event_count(self): |
| 52 return self._event_count |
| 53 |
| 54 @property |
| 55 def package(self): |
| 56 return self._package |
| 57 |
| 58 @property |
| 59 def seed(self): |
| 60 return self._seed |
| 61 |
| 62 @property |
| 63 def throttle(self): |
| 64 return self._throttle |
| 65 |
| 66 @property |
| 67 def timeout(self): |
| 68 return self._timeout_ms |
| 69 |
| 70 @property |
| 71 def verbose_count(self): |
| 72 return self._verbose_count |
OLD | NEW |