Allow setting preferences to false in WPT tests. closes #10161

This commit is contained in:
Awal Garg 2016-03-26 08:04:28 +05:30
parent f2f05869d6
commit b1ff30f752
7 changed files with 38 additions and 3 deletions

View file

@ -507,6 +507,7 @@ pub fn default_opts() -> Opts {
}
}
#[allow(str_to_string)]
pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
let (app_name, args) = args.split_first().unwrap();
@ -767,7 +768,14 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
// This must happen after setting the default options, since the prefs rely on
// on the resource path.
for pref in opt_match.opt_strs("pref").iter() {
prefs::set_pref(pref, PrefValue::Boolean(true));
let split: Vec<&str> = pref.splitn(2, '=').collect();
let pref_name = split[0];
let value = split.get(1);
match value {
Some(&"false") => prefs::set_pref(pref_name, PrefValue::Boolean(false)),
Some(&"true") | None => prefs::set_pref(pref_name, PrefValue::Boolean(true)),
_ => prefs::set_pref(pref_name, PrefValue::String(value.unwrap().to_string()))
};
}
ArgumentParsingResult::ChromeProcess