Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/android/loading/controller.py

Issue 2733233002: [tools/android] Replace FlagReplacer with flag_changer equivalent (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22 matching lines...) Expand all
33 import devtools_monitor 33 import devtools_monitor
34 import emulation 34 import emulation
35 from options import OPTIONS 35 from options import OPTIONS
36 36
37 _SRC_DIR = os.path.abspath(os.path.join( 37 _SRC_DIR = os.path.abspath(os.path.join(
38 os.path.dirname(__file__), '..', '..', '..')) 38 os.path.dirname(__file__), '..', '..', '..'))
39 _CATAPULT_DIR = os.path.join(_SRC_DIR, 'third_party', 'catapult') 39 _CATAPULT_DIR = os.path.join(_SRC_DIR, 'third_party', 'catapult')
40 40
41 sys.path.append(os.path.join(_CATAPULT_DIR, 'devil')) 41 sys.path.append(os.path.join(_CATAPULT_DIR, 'devil'))
42 from devil.android import device_errors 42 from devil.android import device_errors
43 from devil.android import flag_changer
43 from devil.android.sdk import intent 44 from devil.android.sdk import intent
44 45
45 sys.path.append( 46 sys.path.append(
46 os.path.join(_CATAPULT_DIR, 'telemetry', 'third_party', 'websocket-client')) 47 os.path.join(_CATAPULT_DIR, 'telemetry', 'third_party', 'websocket-client'))
47 import websocket 48 import websocket
48 49
49 50
50 class ChromeControllerMetadataGatherer(object): 51 class ChromeControllerMetadataGatherer(object):
51 """Gather metadata for the ChromeControllerBase.""" 52 """Gather metadata for the ChromeControllerBase."""
52 53
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return self._device 319 return self._device
319 320
320 @contextlib.contextmanager 321 @contextlib.contextmanager
321 def Open(self): 322 def Open(self):
322 """Overridden connection creation.""" 323 """Overridden connection creation."""
323 if self._wpr_attributes: 324 if self._wpr_attributes:
324 assert self._wpr_attributes.chrome_env_override == {}, \ 325 assert self._wpr_attributes.chrome_env_override == {}, \
325 'Remote controller doesn\'t support chrome environment variables.' 326 'Remote controller doesn\'t support chrome environment variables.'
326 package_info = OPTIONS.ChromePackage() 327 package_info = OPTIONS.ChromePackage()
327 self._device.ForceStop(package_info.package) 328 self._device.ForceStop(package_info.package)
328 with device_setup.FlagReplacer( 329 with flag_changer.CustomCommandLineFlags(
329 self._device, package_info.cmdline_file, self._GetChromeArguments()): 330 self._device, package_info.cmdline_file, self._GetChromeArguments()):
330 self._DismissCrashDialogIfNeeded() 331 self._DismissCrashDialogIfNeeded()
331 start_intent = intent.Intent( 332 start_intent = intent.Intent(
332 package=package_info.package, activity=package_info.activity, 333 package=package_info.package, activity=package_info.activity,
333 data='about:blank') 334 data='about:blank')
334 self._device.adb.Logcat(clear=True, dump=True) 335 self._device.adb.Logcat(clear=True, dump=True)
335 self._device.StartActivity(start_intent, blocking=True) 336 self._device.StartActivity(start_intent, blocking=True)
336 try: 337 try:
337 for attempt_id in xrange(self.DEVTOOLS_CONNECTION_ATTEMPTS): 338 for attempt_id in xrange(self.DEVTOOLS_CONNECTION_ATTEMPTS):
338 logging.info('Devtools connection attempt %d' % attempt_id) 339 logging.info('Devtools connection attempt %d' % attempt_id)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 if (not os.path.isdir(self._profile_dir) or 621 if (not os.path.isdir(self._profile_dir) or
621 os.listdir(self._profile_dir) == []): 622 os.listdir(self._profile_dir) == []):
622 # Launch chrome so that it populates the profile directory. 623 # Launch chrome so that it populates the profile directory.
623 with self.Open(): 624 with self.Open():
624 pass 625 pass
625 assert os.path.isdir(self._profile_dir) 626 assert os.path.isdir(self._profile_dir)
626 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath())) 627 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath()))
627 628
628 def _GetCacheDirectoryPath(self): 629 def _GetCacheDirectoryPath(self):
629 return os.path.join(self._profile_dir, 'Default', 'Cache') 630 return os.path.join(self._profile_dir, 'Default', 'Cache')
OLDNEW
« no previous file with comments | « tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py ('k') | tools/android/loading/device_setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698