| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 measurements import v8_detached_context_age_in_gc | |
| 6 from telemetry.core import wpr_modes | 5 from telemetry.core import wpr_modes |
| 6 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_test | 7 from telemetry.page import page_test |
| 8 from telemetry.page import page as page_module | |
| 9 from telemetry.results import page_test_results | 8 from telemetry.results import page_test_results |
| 10 from telemetry.unittest_util import options_for_unittests | 9 from telemetry.unittest_util import options_for_unittests |
| 11 from telemetry.unittest_util import page_test_test_case | 10 from telemetry.unittest_util import page_test_test_case |
| 12 from telemetry.value import skip | 11 from telemetry.value import skip |
| 13 | 12 |
| 13 from measurements import v8_detached_context_age_in_gc |
| 14 |
| 14 | 15 |
| 15 class FakePage(object): | 16 class FakePage(object): |
| 16 def __init__(self, url): | 17 def __init__(self, url): |
| 17 self.url = url | 18 self.url = url |
| 18 self.is_file = url.startswith('file://') | 19 self.is_file = url.startswith('file://') |
| 19 | 20 |
| 20 | 21 |
| 21 class FakeTab(object): | 22 class FakeTab(object): |
| 22 def __init__(self, histograms): | 23 def __init__(self, histograms): |
| 23 self.histograms = histograms | 24 self.histograms = histograms |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 def testWithSimplePage(self): | 90 def testWithSimplePage(self): |
| 90 page_set = self.CreateEmptyPageSet() | 91 page_set = self.CreateEmptyPageSet() |
| 91 page = SimplePage(page_set) | 92 page = SimplePage(page_set) |
| 92 page_set.AddUserStory(page) | 93 page_set.AddUserStory(page) |
| 93 metric = v8_detached_context_age_in_gc.V8DetachedContextAgeInGC() | 94 metric = v8_detached_context_age_in_gc.V8DetachedContextAgeInGC() |
| 94 results = self.RunMeasurement(metric, page_set, options=self._options) | 95 results = self.RunMeasurement(metric, page_set, options=self._options) |
| 95 self.assertEquals(0, len(results.failures)) | 96 self.assertEquals(0, len(results.failures)) |
| 96 actual = _ActualValues(results)['V8_DetachedContextAgeInGC'] | 97 actual = _ActualValues(results)['V8_DetachedContextAgeInGC'] |
| 97 self.assertLessEqual(0, actual.value) | 98 self.assertLessEqual(0, actual.value) |
| 98 self.assertEqual('garbage_collections', actual.units) | 99 self.assertEqual('garbage_collections', actual.units) |
| OLD | NEW |