Auto merge of #7651 - jgraham:prefs_reset, r=Ms2ger

Implement resettable and String-valued prefs.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7651)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-25 08:18:06 -06:00
commit e04c2c78ee
14 changed files with 246 additions and 51 deletions

15
tests/reftest.rs vendored
View file

@ -25,6 +25,7 @@ use std::io::{self, Read, Result};
use std::path::{Path, PathBuf};
use std::process;
use std::process::{Command, Stdio};
use std::thread::sleep_ms;
use test::run_tests_console;
use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn, ShouldPanic};
use url::Url;
@ -111,10 +112,22 @@ fn run(test_opts: TestOpts, all_tests: Vec<TestDescAndFn>,
// Verify that we're passing in valid servo arguments. Otherwise, servo
// will exit before we've run any tests, and it will appear to us as if
// all the tests are failing.
let output = match Command::new(&servo_path()).args(&servo_args).output() {
let mut command = Command::new(&servo_path());
command
.args(&servo_args)
.arg("-z")
.arg("about:blank");
let mut child = match command.spawn() {
Ok(p) => p,
Err(e) => panic!("failed to execute process: {}", e),
};
// Wait for the shell to launch or to fail
sleep_ms(1000);
child.kill().unwrap();
let output = try!(child.wait_with_output());
let stderr = String::from_utf8(output.stderr).unwrap();
if stderr.contains("Unrecognized") {

View file

@ -26,7 +26,8 @@ fn test_viewport_rule<F>(css: &str,
callback: F)
where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str)
{
::util::prefs::set_pref("layout.viewport.enabled", true);
::util::prefs::set_pref("layout.viewport.enabled",
::util::prefs::PrefValue::Boolean(true));
let stylesheet = stylesheet!(css, Author);
let mut rule_count = 0;
@ -173,7 +174,8 @@ fn cascading_within_viewport_rule() {
#[test]
fn multiple_stylesheets_cascading() {
::util::prefs::set_pref("layout.viewport.enabled", true);
::util::prefs::set_pref("layout.viewport.enabled",
::util::prefs::PrefValue::Boolean(true));
let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
let stylesheets = vec![