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 from telemetry.page import legacy_page_test |
| 6 |
| 7 from metrics import usecounter |
| 8 |
| 9 class UseCounter(legacy_page_test.LegacyPageTest): |
| 10 |
| 11 def __init__(self, needs_browser_restart_after_each_page=False): |
| 12 super(UseCounter, self).__init__(needs_browser_restart_after_each_page) |
| 13 self._metric = usecounter.UseCounterMetric() |
| 14 |
| 15 @classmethod |
| 16 def CustomizeBrowserOptions(cls, options): |
| 17 usecounter.UseCounterMetric.CustomizeBrowserOptions(options) |
| 18 |
| 19 def WillNavigateToPage(self, page, tab): |
| 20 self._metric.Start(page, tab) |
| 21 |
| 22 def DidNavigateToPage(self, page, tab): |
| 23 self._metric.Stop(page, tab) |
| 24 |
| 25 def ValidateAndMeasurePage(self, page, tab, results): |
| 26 self._metric.AddResults(tab, results) |
OLD | NEW |