Skip to content

Commit

Permalink
[benchmarking] Skip Findbrowser if possible_browser is passed in
Browse files Browse the repository at this point in the history
This CL allow perf_benchmark to check for available possible_browser before it tries to find one.

This is the second step of the fix for crbug/1149275#c6

Bug: chromium:1149275
Change-Id: Ifb771363ba73d4d5cb83e58ba1e8e1f703ed182a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550180
Commit-Queue: Wenbin Zhang <wenbinzhang@google.com>
Reviewed-by: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829773}
  • Loading branch information
Wenbin Zhang authored and Commit Bot committed Nov 20, 2020
1 parent 71df301 commit feddbd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tools/perf/contrib/leak_detection/leak_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def CreateCoreTimelineBasedMeasurementOptions(self):
tbm_options.AddTimelineBasedMetric('leakDetectionMetric')
return tbm_options

def CustomizeOptions(self, options):
def CustomizeOptions(self, options, possible_browser=None):
# TODO(crbug.com/936805): Note this is a hack. Perf benchmarks should not
# override the CustomizeOptions method.
options.browser_options.AppendExtraBrowserArgs('--js-flags=--expose-gc')
Expand Down
17 changes: 11 additions & 6 deletions tools/perf/core/perf_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def SetExtraBrowserOptions(self, options):
"""To be overridden by perf benchmarks."""
pass

def CustomizeOptions(self, finder_options):
def CustomizeOptions(self, finder_options, possible_browser=None):
# Subclass of PerfBenchmark should override SetExtraBrowserOptions to add
# more browser options rather than overriding CustomizeOptions.
super(PerfBenchmark, self).CustomizeOptions(finder_options)
Expand All @@ -98,7 +98,7 @@ def CustomizeOptions(self, finder_options):
if (browser_options.browser_type != 'reference' and
'no-field-trials' not in browser_options.compatibility_mode):
variations = self._GetVariationsBrowserArgs(
finder_options, browser_options.extra_browser_args)
finder_options, browser_options.extra_browser_args, possible_browser)
browser_options.AppendExtraBrowserArgs(variations)

browser_options.profile_files_to_copy.extend(
Expand Down Expand Up @@ -132,15 +132,20 @@ def FixupTargetOS(target_os):
return 'chromeos'
return target_os

def _GetVariationsBrowserArgs(self, finder_options, current_args):
def _GetVariationsBrowserArgs(self,
finder_options,
current_args,
possible_browser=None):
if possible_browser is None:
possible_browser = browser_finder.FindBrowser(finder_options)
if not possible_browser:
return []

chrome_root = finder_options.chrome_root
if chrome_root is None:
chrome_root = path_module.GetChromiumSrcDir()

variations_dir = os.path.join(chrome_root, 'testing', 'variations')
possible_browser = browser_finder.FindBrowser(finder_options)
if not possible_browser:
return []

return fieldtrial_util.GenerateArgs(
os.path.join(variations_dir, 'fieldtrial_testing_config.json'),
Expand Down

0 comments on commit feddbd1

Please sign in to comment.