def UpdateFromParseResults(self, finder_options): """Copies our options from finder_options.""" browser_options_list = [ 'extra_browser_args_as_string', 'extra_wpr_args_as_string', 'profile_dir', 'profile_type', 'show_stdout', 'compatibility_mode' ] 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 self._finder_options = finder_options if hasattr(self, 'extra_browser_args_as_string'): tmp = shlex.split( self.extra_browser_args_as_string) self.AppendExtraBrowserArgs(tmp) delattr(self, 'extra_browser_args_as_string') if hasattr(self, 'extra_wpr_args_as_string'): tmp = shlex.split( self.extra_wpr_args_as_string) 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: if 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) self.profile_dir = os.path.abspath(self.profile_dir) 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) if getattr(finder_options, 'logging_verbosity'): self.logging_verbosity = finder_options.logging_verbosity delattr(finder_options, 'logging_verbosity') # This deferred import is necessary because browser_options is imported in # telemetry/telemetry/__init__.py. finder_options.browser_options = CreateChromeBrowserOptions(self)
def testGetProfileDir(self): self.assertFalse(profile_types.GetProfileDir('typical_user') is None)