OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 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 glob | 4 import glob |
5 import os | 5 import os |
6 | 6 |
7 from telemetry.page import legacy_page_test | 7 from telemetry.page import legacy_page_test |
8 from telemetry.value import scalar | 8 from telemetry.value import scalar |
9 | 9 |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 def ValidateAndMeasurePage(self, page, tab, results): | 22 def ValidateAndMeasurePage(self, page, tab, results): |
23 if tab.browser.platform.GetOSName() in ['android', 'chromeos']: | 23 if tab.browser.platform.GetOSName() in ['android', 'chromeos']: |
24 raise legacy_page_test.MeasurementFailure( | 24 raise legacy_page_test.MeasurementFailure( |
25 'SkPicture printing not supported on this platform') | 25 'SkPicture printing not supported on this platform') |
26 | 26 |
27 outpath = os.path.abspath( | 27 outpath = os.path.abspath( |
28 os.path.join(self._skp_outdir, page.file_safe_name)) | 28 os.path.join(self._skp_outdir, page.file_safe_name)) |
29 # Replace win32 path separator char '\' with '\\'. | 29 # Replace win32 path separator char '\' with '\\'. |
30 outpath = outpath.replace('\\', '\\\\') | 30 outpath = outpath.replace('\\', '\\\\') |
31 tab.EvaluateJavaScript2( | 31 tab.EvaluateJavaScript( |
32 'chrome.gpuBenchmarking.printToSkPicture({{ outpath }});', | 32 'chrome.gpuBenchmarking.printToSkPicture({{ outpath }});', |
33 outpath=outpath) | 33 outpath=outpath) |
34 pictures = glob.glob(os.path.join(outpath, '*.skp')) | 34 pictures = glob.glob(os.path.join(outpath, '*.skp')) |
35 results.AddValue(scalar.ScalarValue( | 35 results.AddValue(scalar.ScalarValue( |
36 results.current_page, 'saved_picture_count', 'count', len(pictures))) | 36 results.current_page, 'saved_picture_count', 'count', len(pictures))) |
OLD | NEW |