Index: tools/telemetry/telemetry/page/page_measurement.py |
diff --git a/tools/telemetry/telemetry/page/page_measurement.py b/tools/telemetry/telemetry/page/page_measurement.py |
index 54fa094f9eda08d756a6463669c76380b08a39fe..26bbf1c8ae6d21cc202d8863a157f3e858abd7fc 100644 |
--- a/tools/telemetry/telemetry/page/page_measurement.py |
+++ b/tools/telemetry/telemetry/page/page_measurement.py |
@@ -5,44 +5,8 @@ |
from telemetry.page import page_test |
-class MeasurementFailure(page_test.Failure): |
- """Exception that can be thrown from MeasurePage to indicate an undesired but |
- designed-for problem.""" |
- |
- |
class PageMeasurement(page_test.PageTest): |
- """Glue code for running a measurement across a set of pages. |
- |
- To use this, subclass from the measurement and override MeasurePage. For |
- example: |
- |
- class BodyChildElementMeasurement(PageMeasurement): |
- def MeasurePage(self, page, tab, results): |
- body_child_count = tab.EvaluateJavaScript( |
- 'document.body.children.length') |
- results.AddValue(scalar.ScalarValue( |
- page, 'body_children', 'count', body_child_count)) |
- |
- if __name__ == '__main__': |
- page_measurement.Main(BodyChildElementMeasurement()) |
- |
- To add test-specific options: |
- |
- class BodyChildElementMeasurement(PageMeasurement): |
- def AddCommandLineArgs(parser): |
- parser.add_option('--element', action='store', default='body') |
- |
- def MeasurePage(self, page, tab, results): |
- body_child_count = tab.EvaluateJavaScript( |
- 'document.querySelector('%s').children.length') |
- results.AddValue(scalar.ScalarValue( |
- page, 'children', 'count', child_count)) |
- |
- is_action_name_to_run_optional determines what to do if action_name_to_run is |
- not empty but the page doesn't have that action. The page will run (without |
- any action) if is_action_name_to_run_optional is True, otherwise the page will |
- fail. |
- """ |
+ """DEPRECATED: Please extend page_test.PageTest directly.""" |
def __init__(self, |
action_name_to_run='', |
needs_browser_restart_after_each_page=False, |
@@ -55,30 +19,3 @@ class PageMeasurement(page_test.PageTest): |
discard_first_result, |
clear_cache_before_each_run, |
is_action_name_to_run_optional=is_action_name_to_run_optional) |
- |
- def ValidatePage(self, page, tab, results): |
- self.MeasurePage(page, tab, results) |
- |
- def MeasurePage(self, page, tab, results): |
- """Override to actually measure the page's performance. |
- |
- page is a page_set.Page |
- tab is an instance of telemetry.core.Tab |
- |
- Should call results.AddValue(...) for each result, or raise an |
- exception on failure. The name and units of each Add() call must be |
- the same across all iterations. The name 'url' must not be used. |
- |
- Prefer field names that are in accordance with python variable style. E.g. |
- field_name. |
- |
- Put together: |
- |
- def MeasurePage(self, page, tab, results): |
- res = tab.EvaluateJavaScript('2+2') |
- if res != 4: |
- raise Exception('Oh, wow.') |
- results.AddValue(scalar.ScalarValue( |
- page, 'two_plus_two', 'count', res)) |
- """ |
- raise NotImplementedError() |