| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 4 |
| 5 """Controller objects that control the context in which chrome runs. | 5 """Controller objects that control the context in which chrome runs. |
| 6 | 6 |
| 7 This is responsible for the setup necessary for launching chrome, and for | 7 This is responsible for the setup necessary for launching chrome, and for |
| 8 creating a DevToolsConnection. There are remote device and local | 8 creating a DevToolsConnection. There are remote device and local |
| 9 desktop-specific versions. | 9 desktop-specific versions. |
| 10 """ | 10 """ |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 """Overridden android device.""" | 332 """Overridden android device.""" |
| 333 return self._device | 333 return self._device |
| 334 | 334 |
| 335 @contextlib.contextmanager | 335 @contextlib.contextmanager |
| 336 def Open(self): | 336 def Open(self): |
| 337 """Overridden connection creation.""" | 337 """Overridden connection creation.""" |
| 338 if self._wpr_attributes: | 338 if self._wpr_attributes: |
| 339 assert self._wpr_attributes.chrome_env_override == {}, \ | 339 assert self._wpr_attributes.chrome_env_override == {}, \ |
| 340 'Remote controller doesn\'t support chrome environment variables.' | 340 'Remote controller doesn\'t support chrome environment variables.' |
| 341 package_info = OPTIONS.ChromePackage() | 341 package_info = OPTIONS.ChromePackage() |
| 342 command_line_path = '/data/local/chrome-command-line' | 342 command_line_path = '/data/local/tmp/chrome-command-line' |
| 343 self._device.ForceStop(package_info.package) | 343 self._device.ForceStop(package_info.package) |
| 344 chrome_args = self._GetChromeArguments() | 344 chrome_args = self._GetChromeArguments() |
| 345 logging.info('Launching %s with flags: %s' % (package_info.package, | 345 logging.info('Launching %s with flags: %s' % (package_info.package, |
| 346 subprocess.list2cmdline(chrome_args))) | 346 subprocess.list2cmdline(chrome_args))) |
| 347 with device_setup.FlagReplacer( | 347 with device_setup.FlagReplacer( |
| 348 self._device, command_line_path, self._GetChromeArguments()): | 348 self._device, command_line_path, self._GetChromeArguments()): |
| 349 self._DismissCrashDialogIfNeeded() | 349 self._DismissCrashDialogIfNeeded() |
| 350 start_intent = intent.Intent( | 350 start_intent = intent.Intent( |
| 351 package=package_info.package, activity=package_info.activity, | 351 package=package_info.package, activity=package_info.activity, |
| 352 data='about:blank') | 352 data='about:blank') |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 if (not os.path.isdir(self._profile_dir) or | 644 if (not os.path.isdir(self._profile_dir) or |
| 645 os.listdir(self._profile_dir) == []): | 645 os.listdir(self._profile_dir) == []): |
| 646 # Launch chrome so that it populates the profile directory. | 646 # Launch chrome so that it populates the profile directory. |
| 647 with self.Open(): | 647 with self.Open(): |
| 648 pass | 648 pass |
| 649 assert os.path.isdir(self._profile_dir) | 649 assert os.path.isdir(self._profile_dir) |
| 650 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath())) | 650 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath())) |
| 651 | 651 |
| 652 def _GetCacheDirectoryPath(self): | 652 def _GetCacheDirectoryPath(self): |
| 653 return os.path.join(self._profile_dir, 'Default', 'Cache') | 653 return os.path.join(self._profile_dir, 'Default', 'Cache') |
| OLD | NEW |