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

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

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month 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.page import page_test 6 from measurements import PageTestMeasurement
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.value import scalar 8 from telemetry.value import scalar
9 9
10 10
11 class Screenshot(page_test.PageTest): 11 class Screenshot(PageTestMeasurement):
12 def __init__(self): 12 def __init__(self):
13 super(Screenshot, self).__init__( 13 super(Screenshot, self).__init__(
14 action_name_to_run = 'RunPageInteractions', 14 action_name_to_run = 'RunPageInteractions',
15 is_action_name_to_run_optional=True) 15 is_action_name_to_run_optional=True)
16 16
17 @classmethod 17 @classmethod
18 def AddCommandLineArgs(cls, parser): 18 def AddCommandLineArgs(cls, parser):
19 parser.add_option('--png-outdir', 19 parser.add_option('--png-outdir',
20 help='Output directory for the PNG files') 20 help='Output directory for the PNG files')
21 21
(...skipping 20 matching lines...) Expand all
42 previous_mtime = -1 42 previous_mtime = -1
43 43
44 screenshot.WritePngFile(outpath) 44 screenshot.WritePngFile(outpath)
45 45
46 saved_picture_count = 0 46 saved_picture_count = 0
47 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:
48 saved_picture_count = 1 48 saved_picture_count = 1
49 results.AddValue(scalar.ScalarValue( 49 results.AddValue(scalar.ScalarValue(
50 results.current_page, 'saved_picture_count', 'count', 50 results.current_page, 'saved_picture_count', 'count',
51 saved_picture_count)) 51 saved_picture_count))
52
53 super(Screenshot, self).ValidateAndMeasurePage(page, tab, results)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698