diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-07 16:37:35 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-07 16:37:35 +0000 |
commit | 6d9316df745bfacb8012cf304c9ba48bb665073d (patch) | |
tree | da7793964c3176fa6bd3378e343f1498549b2779 /webkit/tools | |
parent | 3f99285232930c6151ba5edac7349694e5535fcb (diff) | |
download | chromium_src-6d9316df745bfacb8012cf304c9ba48bb665073d.zip chromium_src-6d9316df745bfacb8012cf304c9ba48bb665073d.tar.gz chromium_src-6d9316df745bfacb8012cf304c9ba48bb665073d.tar.bz2 |
During layout tests, for a bunch of appearance related settings so we make sure
the running users environment doesn't affect the layout tests. Clear those
settings when not in layout mode just to be sure the app looks like the user
would expect when running interactive.
Review URL: http://codereview.chromium.org/16576
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index a96d587..3f10f8f 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -136,6 +136,66 @@ void TestShell::InitializeTestShell(bool layout_test_mode) { window_list_ = new WindowList; layout_test_mode_ = layout_test_mode; + // So we can match the WebKit layout tests, we want to force a bunch of + // preferences that control appearance to match. + // (We want to do this as early as possible in application startup so + // the settings are in before any higher layers could cache values.) + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + if (layout_test_mode_) { + const NSInteger kMinFontSizeCGSmoothes = 4; + const NSInteger kNoFontSmoothing = 0; + const NSInteger kBlueTintedAppearance = 1; + [defaults setInteger:kMinFontSizeCGSmoothes + forKey:@"AppleAntiAliasingThreshold"]; + [defaults setInteger:kNoFontSmoothing + forKey:@"AppleFontSmoothing"]; + [defaults setInteger:kBlueTintedAppearance + forKey:@"AppleAquaColorVariant"]; + [defaults setObject:@"0.709800 0.835300 1.000000" + forKey:@"AppleHighlightColor"]; + [defaults setObject:@"0.500000 0.500000 0.500000" + forKey:@"AppleOtherHighlightColor"]; + [defaults setObject:[NSArray arrayWithObject:@"en"] + forKey:@"AppleLanguages"]; + + // AppKit pulls scrollbar style from NSUserDefaults. HIToolbox uses + // CFPreferences, but AnyApplication, so we set it, force it to load, and + // then reset the pref to what it was (HIToolbox will cache what it loaded). + [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"]; + CFTypeRef initialValue + = CFPreferencesCopyValue(CFSTR("AppleScrollBarVariant"), + kCFPreferencesAnyApplication, + kCFPreferencesCurrentUser, + kCFPreferencesAnyHost); + CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), + CFSTR("DoubleMax"), + kCFPreferencesAnyApplication, + kCFPreferencesCurrentUser, + kCFPreferencesAnyHost); + // Make HIToolbox read from CFPreferences + ThemeScrollBarArrowStyle style; + GetThemeScrollBarArrowStyle(&style); + if (initialValue) { + // Reset the preference to what it was + CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), + initialValue, + kCFPreferencesAnyApplication, + kCFPreferencesCurrentUser, + kCFPreferencesAnyHost); + CFRelease(initialValue); + } + } else { + // Not running a test, clear the keys so the TestShell looks right to the + // running user. + [defaults removeObjectForKey:@"AppleAntiAliasingThreshold"]; + [defaults removeObjectForKey:@"AppleFontSmoothing"]; + [defaults removeObjectForKey:@"AppleAquaColorVariant"]; + [defaults removeObjectForKey:@"AppleHighlightColor"]; + [defaults removeObjectForKey:@"AppleOtherHighlightColor"]; + [defaults removeObjectForKey:@"AppleLanguages"]; + [defaults removeObjectForKey:@"AppleScrollBarVariant"]; + } + web_prefs_ = new WebPreferences; ResetWebPreferences(); |