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

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

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 years, 11 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
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.image_processing import image_util 6 from telemetry.image_processing import image_util
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.page import page_test 8 from telemetry.page import page_test
9 from telemetry.value import improvement_direction
9 from telemetry.value import scalar 10 from telemetry.value import scalar
10 11
11 12
12 class Screenshot(page_test.PageTest): 13 class Screenshot(page_test.PageTest):
13 def __init__(self, png_outdir): 14 def __init__(self, png_outdir):
14 super(Screenshot, self).__init__( 15 super(Screenshot, self).__init__(
15 action_name_to_run = 'RunPageInteractions', 16 action_name_to_run = 'RunPageInteractions',
16 is_action_name_to_run_optional=True) 17 is_action_name_to_run_optional=True)
17 self._png_outdir = png_outdir 18 self._png_outdir = png_outdir
18 19
(...skipping 13 matching lines...) Expand all
32 else: 33 else:
33 previous_mtime = -1 34 previous_mtime = -1
34 35
35 image_util.WritePngFile(screenshot, outpath) 36 image_util.WritePngFile(screenshot, outpath)
36 37
37 saved_picture_count = 0 38 saved_picture_count = 0
38 if os.path.exists(outpath) and os.path.getmtime(outpath) > previous_mtime: 39 if os.path.exists(outpath) and os.path.getmtime(outpath) > previous_mtime:
39 saved_picture_count = 1 40 saved_picture_count = 1
40 results.AddValue(scalar.ScalarValue( 41 results.AddValue(scalar.ScalarValue(
41 results.current_page, 'saved_picture_count', 'count', 42 results.current_page, 'saved_picture_count', 'count',
42 saved_picture_count)) 43 saved_picture_count,
44 improvement_direction=improvement_direction.DOWN))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698