Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: tools/perf/measurements/screenshot.py

Issue 380783003: Update screenshot to use results.AddValue(...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698