[tools] Fix printed chrome command in callstats

Review-Url: https://codereview.chromium.org/2559723002
Cr-Commit-Position: refs/heads/master@{#41615}
This commit is contained in:
jgruber 2016-12-09 03:48:28 -08:00 committed by Commit bot
parent 9fde10ebed
commit e127ec00c2

View File

@ -126,25 +126,28 @@ def generate_injection(f, sites, refreshes=0):
onLoad(window.location.href);
})();"""
def get_chrome_flags(js_flags, user_data_dir):
def get_chrome_flags(js_flags, user_data_dir, arg_delimiter=""):
return [
"--no-default-browser-check",
"--no-sandbox",
"--disable-translate",
"--enable-benchmarking",
"--js-flags={}".format(js_flags),
"--enable-stats-table",
"--js-flags={}{}{}".format(arg_delimiter, js_flags, arg_delimiter),
"--no-first-run",
"--user-data-dir={}".format(user_data_dir),
"--user-data-dir={}{}{}".format(arg_delimiter, user_data_dir,
arg_delimiter),
]
def get_chrome_replay_flags(args):
def get_chrome_replay_flags(args, arg_delimiter=""):
http_port = 4080 + args.port_offset
https_port = 4443 + args.port_offset
return [
"--host-resolver-rules=MAP *:80 localhost:%s, " \
"MAP *:443 localhost:%s, " \
"EXCLUDE localhost" % (
http_port, https_port),
"--host-resolver-rules=%sMAP *:80 localhost:%s, " \
"MAP *:443 localhost:%s, " \
"EXCLUDE localhost%s" % (
arg_delimiter, http_port, https_port,
arg_delimiter),
"--ignore-certificate-errors",
"--disable-seccomp-sandbox",
"--disable-web-security",
@ -295,10 +298,10 @@ def do_run_replay_server(args):
print(" "+site['url'])
print("- " * 40)
print("Launch chromium with the following commands for debugging:")
flags = get_chrome_flags("'--runtime-call-stats --allow-natives-syntax'",
"/var/tmp/`date +%s`")
flags += get_chrome_replay_flags(args)
print(" $CHROMIUM_DIR/out/Release/chomium " + (" ".join(flags)) + " <URL>")
flags = get_chrome_flags("--runtime-call-stats --allow-natives-syntax",
"/var/tmp/`date +%s`", '"')
flags += get_chrome_replay_flags(args, "'")
print(" $CHROMIUM_DIR/out/Release/chrome " + (" ".join(flags)) + " <URL>")
print("- " * 40)
replay_server = start_replay_server(args, sites, discard_output=False)
try: