| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import time | 5 import time |
| 6 | 6 |
| 7 from metrics import network | 7 from metrics import network |
| 8 from metrics import power | 8 from metrics import power |
| 9 from telemetry.core import util | 9 from telemetry.core import util |
| 10 from telemetry.page import page_test | 10 from telemetry.page import page_test |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 def DidNavigateToPage(self, page, tab): | 28 def DidNavigateToPage(self, page, tab): |
| 29 self._power_metric.Start(page, tab) | 29 self._power_metric.Start(page, tab) |
| 30 | 30 |
| 31 def ValidateAndMeasurePage(self, page, tab, results): | 31 def ValidateAndMeasurePage(self, page, tab, results): |
| 32 self._network_metric.Stop(page, tab) | 32 self._network_metric.Stop(page, tab) |
| 33 self._power_metric.Stop(page, tab) | 33 self._power_metric.Stop(page, tab) |
| 34 self._network_metric.AddResults(tab, results) | 34 self._network_metric.AddResults(tab, results) |
| 35 self._power_metric.AddResults(tab, results) | 35 self._power_metric.AddResults(tab, results) |
| 36 | 36 |
| 37 def DidRunPage(self, platform): | 37 def DidRunPage(self, platform): |
| 38 del platform # unused |
| 38 self._power_metric.Close() | 39 self._power_metric.Close() |
| 39 | 40 |
| 40 | 41 |
| 41 class LoadPower(Power): | 42 class LoadPower(Power): |
| 42 | 43 |
| 43 def WillNavigateToPage(self, page, tab): | 44 def WillNavigateToPage(self, page, tab): |
| 44 self._network_metric.Start(page, tab) | 45 self._network_metric.Start(page, tab) |
| 45 self._power_metric.Start(page, tab) | 46 self._power_metric.Start(page, tab) |
| 46 | 47 |
| 47 def DidNavigateToPage(self, page, tab): | 48 def DidNavigateToPage(self, page, tab): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 | 61 |
| 61 util.WaitFor(tab.HasReachedQuiescence, 60) | 62 util.WaitFor(tab.HasReachedQuiescence, 60) |
| 62 | 63 |
| 63 metric = power.PowerMetric(tab.browser.platform) | 64 metric = power.PowerMetric(tab.browser.platform) |
| 64 metric.Start(page, tab) | 65 metric.Start(page, tab) |
| 65 | 66 |
| 66 time.sleep(QuiescentPower.SAMPLE_TIME) | 67 time.sleep(QuiescentPower.SAMPLE_TIME) |
| 67 | 68 |
| 68 metric.Stop(page, tab) | 69 metric.Stop(page, tab) |
| 69 metric.AddResults(tab, results) | 70 metric.AddResults(tab, results) |
| OLD | NEW |