def UpdateFromParseResults(self, finder_options): """Copies our options from finder_options""" browser_options_list = [ 'extra_browser_args_as_string', 'extra_wpr_args_as_string', 'netsim', 'profile_dir', 'profile_type', 'show_stdout', 'synthetic_gesture_source_type', 'use_devtools_active_port', ] for o in browser_options_list: a = getattr(finder_options, o, None) if a is not None: setattr(self, o, a) delattr(finder_options, o) self.browser_type = finder_options.browser_type if hasattr(self, 'extra_browser_args_as_string'): # pylint: disable=E1101 tmp = shlex.split(self.extra_browser_args_as_string) # pylint: disable=E1101 self.AppendExtraBrowserArgs(tmp) delattr(self, 'extra_browser_args_as_string') if hasattr(self, 'extra_wpr_args_as_string'): # pylint: disable=E1101 tmp = shlex.split(self.extra_wpr_args_as_string) # pylint: disable=E1101 self.extra_wpr_args.extend(tmp) delattr(self, 'extra_wpr_args_as_string') if self.profile_type == 'default': self.dont_override_profile = True if self.profile_dir and self.profile_type != 'clean': logging.critical( "It's illegal to specify both --profile-type and --profile-dir.\n" "For more information see: http://goo.gl/ngdGD5") sys.exit(1) if self.profile_dir and not os.path.isdir(self.profile_dir): logging.critical( "Directory specified by --profile-dir (%s) doesn't exist " "or isn't a directory.\n" "For more information see: http://goo.gl/ngdGD5" % self.profile_dir) sys.exit(1) if not self.profile_dir: self.profile_dir = profile_types.GetProfileDir(self.profile_type) # This deferred import is necessary because browser_options is imported in # telemetry/telemetry/__init__.py. from telemetry.core.backends.chrome import chrome_browser_options finder_options.browser_options = ( chrome_browser_options.CreateChromeBrowserOptions(self))
def UpdateFromParseResults(self, finder_options): """Copies our options from finder_options""" browser_options_list = [ 'extra_browser_args_as_string', 'extra_wpr_args_as_string', 'netsim', 'profile_dir', 'profile_type', 'show_stdout', ] for o in browser_options_list: a = getattr(finder_options, o, None) if a is not None: setattr(self, o, a) delattr(finder_options, o) self.browser_type = finder_options.browser_type if hasattr(self, 'extra_browser_args_as_string'): # pylint: disable=E1101 tmp = shlex.split( self.extra_browser_args_as_string) # pylint: disable=E1101 self.AppendExtraBrowserArgs(tmp) delattr(self, 'extra_browser_args_as_string') if hasattr(self, 'extra_wpr_args_as_string'): # pylint: disable=E1101 tmp = shlex.split( self.extra_wpr_args_as_string) # pylint: disable=E1101 self.extra_wpr_args.extend(tmp) delattr(self, 'extra_wpr_args_as_string') if self.profile_type == 'default': self.dont_override_profile = True if self.profile_dir and self.profile_type != 'clean': raise Exception("It's illegal to specify both --profile-type and" " --profile-dir.") if self.profile_dir and not os.path.isdir(self.profile_dir): raise Exception("Directory specified by --profile-dir (%s) doesn't" " exist or isn't a directory." % (self.profile_dir)) if not self.profile_dir: self.profile_dir = profile_types.GetProfileDir(self.profile_type) # This deferred import is necessary because browser_options is imported in # telemetry/telemetry/__init__.py. from telemetry.core.backends.chrome import chrome_browser_options finder_options.browser_options = ( chrome_browser_options.CreateChromeBrowserOptions(self))