| 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 import os | 4 import os |
| 5 | 5 |
| 6 from telemetry.page import page_measurement | 6 from telemetry.page import page_measurement |
| 7 from telemetry.page import page_test | 7 from telemetry.page import page_test |
| 8 from telemetry.value import scalar |
| 8 | 9 |
| 9 | 10 |
| 10 class Screenshot(page_measurement.PageMeasurement): | 11 class Screenshot(page_measurement.PageMeasurement): |
| 11 def __init__(self): | 12 def __init__(self): |
| 12 super(Screenshot, self).__init__( | 13 super(Screenshot, self).__init__( |
| 13 action_name_to_run = 'RunPrepareForScreenshot', | 14 action_name_to_run = 'RunPrepareForScreenshot', |
| 14 is_action_name_to_run_optional=True) | 15 is_action_name_to_run_optional=True) |
| 15 | 16 |
| 16 @classmethod | 17 @classmethod |
| 17 def AddCommandLineArgs(cls, parser): | 18 def AddCommandLineArgs(cls, parser): |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 if os.path.exists(outpath): | 39 if os.path.exists(outpath): |
| 39 previous_mtime = os.path.getmtime(outpath) | 40 previous_mtime = os.path.getmtime(outpath) |
| 40 else: | 41 else: |
| 41 previous_mtime = -1 | 42 previous_mtime = -1 |
| 42 | 43 |
| 43 screenshot.WritePngFile(outpath) | 44 screenshot.WritePngFile(outpath) |
| 44 | 45 |
| 45 saved_picture_count = 0 | 46 saved_picture_count = 0 |
| 46 if os.path.exists(outpath) and os.path.getmtime(outpath) > previous_mtime: | 47 if os.path.exists(outpath) and os.path.getmtime(outpath) > previous_mtime: |
| 47 saved_picture_count = 1 | 48 saved_picture_count = 1 |
| 48 results.Add('saved_picture_count', 'count', saved_picture_count) | 49 results.AddValue(scalar.ScalarValue( |
| 50 results.current_page, 'saved_picture_count', 'count', |
| 51 saved_picture_count)) |
| OLD | NEW |