summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordroger <droger@chromium.org>2016-03-21 03:26:20 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-21 10:28:00 +0000
commit63512b75fc78ecb89e3740224ddf902879ee374d (patch)
tree66fb9b60559c6da1b21098a8badbd8fc38ea6c99
parent07f4a3a5a594aa9ed564f0bfde3098a34d63fff1 (diff)
downloadchromium_src-63512b75fc78ecb89e3740224ddf902879ee374d.zip
chromium_src-63512b75fc78ecb89e3740224ddf902879ee374d.tar.gz
chromium_src-63512b75fc78ecb89e3740224ddf902879ee374d.tar.bz2
tools/android/loading Add support for headless mode in analyse.py
Review URL: https://codereview.chromium.org/1814863003 Cr-Commit-Position: refs/heads/master@{#382263}
-rwxr-xr-xtools/android/loading/analyze.py2
-rw-r--r--tools/android/loading/controller.py17
2 files changed, 15 insertions, 4 deletions
diff --git a/tools/android/loading/analyze.py b/tools/android/loading/analyze.py
index 4b72ec6..2aed605b 100755
--- a/tools/android/loading/analyze.py
+++ b/tools/android/loading/analyze.py
@@ -314,6 +314,8 @@ def main():
'prefetch_delay_seconds', 5,
'delay after requesting load of prefetch page '
'(only when running full fetch)')
+ OPTIONS.AddGlobalArgument(
+ 'headless', False, 'Do not display Chrome UI (only works in local mode).')
parser = argparse.ArgumentParser(description='Analyzes loading')
parser.add_argument('command', help=' '.join(COMMAND_MAP.keys()))
diff --git a/tools/android/loading/controller.py b/tools/android/loading/controller.py
index 2d9c3bd..9226ab3 100644
--- a/tools/android/loading/controller.py
+++ b/tools/android/loading/controller.py
@@ -233,11 +233,18 @@ class LocalChromeController(ChromeControllerBase):
profile_dir = tempfile.mkdtemp()
flags = ['--user-data-dir=%s' % profile_dir] + flags
chrome_out = None if OPTIONS.local_noisy else file('/dev/null', 'w')
- process = subprocess.Popen(
- [binary_filename] + flags, shell=False, stderr=chrome_out)
+ environment = os.environ.copy()
+ if OPTIONS.headless:
+ environment['DISPLAY'] = 'localhost:99'
+ xvfb_process = subprocess.Popen(
+ ['Xvfb', ':99', '-screen', '0', '1600x1200x24'], shell=False,
+ stderr=chrome_out)
+ chrome_process = subprocess.Popen(
+ [binary_filename] + flags, shell=False, stderr=chrome_out,
+ env=environment)
try:
time.sleep(10)
- process_result = process.poll()
+ process_result = chrome_process.poll()
if process_result is not None:
logging.error('Unexpected process exit: %s', process_result)
else:
@@ -246,6 +253,8 @@ class LocalChromeController(ChromeControllerBase):
self._StartConnection(connection)
yield connection
finally:
- process.kill()
+ chrome_process.kill()
+ if OPTIONS.headless:
+ xvfb_process.kill()
if using_temp_profile_dir:
shutil.rmtree(profile_dir)