| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from functools import wraps | 5 from functools import wraps |
| 6 import logging | 6 import logging |
| 7 import sys | 7 import sys |
| 8 import timeit | 8 import timeit |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return WrappedTest | 40 return WrappedTest |
| 41 | 41 |
| 42 | 42 |
| 43 class TracingBackendTest(tab_test_case.TabTestCase): | 43 class TracingBackendTest(tab_test_case.TabTestCase): |
| 44 | 44 |
| 45 # Number of consecutively requested memory dumps. | 45 # Number of consecutively requested memory dumps. |
| 46 _REQUESTED_DUMP_COUNT = 3 | 46 _REQUESTED_DUMP_COUNT = 3 |
| 47 | 47 |
| 48 @classmethod | 48 @classmethod |
| 49 def CustomizeBrowserOptions(cls, options): | 49 def CustomizeBrowserOptions(cls, options): |
| 50 options.enable_logging = True |
| 50 options.AppendExtraBrowserArgs([ | 51 options.AppendExtraBrowserArgs([ |
| 51 # Memory maps currently cannot be retrieved on sandboxed processes. | 52 # Memory maps currently cannot be retrieved on sandboxed processes. |
| 52 # See crbug.com/461788. | 53 # See crbug.com/461788. |
| 53 '--no-sandbox', | 54 '--no-sandbox', |
| 54 | 55 |
| 55 # Workaround to disable periodic memory dumps. See crbug.com/513692. | 56 # Workaround to disable periodic memory dumps. See crbug.com/513692. |
| 56 '--enable-memory-benchmarking' | 57 '--enable-memory-benchmarking' |
| 57 ]) | 58 ]) |
| 58 | 59 |
| 59 def setUp(self): | 60 def setUp(self): |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 n1 = 1000 | 247 n1 = 1000 |
| 247 while True: | 248 while True: |
| 248 t1 = self._MeasureReadTime(n1) | 249 t1 = self._MeasureReadTime(n1) |
| 249 if t1 > 0.01: | 250 if t1 > 0.01: |
| 250 break | 251 break |
| 251 n1 *= 5 | 252 n1 *= 5 |
| 252 t2 = self._MeasureReadTime(n1 * 10) | 253 t2 = self._MeasureReadTime(n1 * 10) |
| 253 # Time is an illusion, CPU time is doubly so, allow great deal of tolerance. | 254 # Time is an illusion, CPU time is doubly so, allow great deal of tolerance. |
| 254 toleranceFactor = 5 | 255 toleranceFactor = 5 |
| 255 self.assertLess(t2, t1 * 10 * toleranceFactor) | 256 self.assertLess(t2, t1 * 10 * toleranceFactor) |
| OLD | NEW |