diff options
author | dpranke@google.com <dpranke@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:45:57 +0000 |
---|---|---|
committer | dpranke@google.com <dpranke@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:45:57 +0000 |
commit | 2e25a9f4152a90a179ad37206bff79e1198379d7 (patch) | |
tree | e4bb52a61a394372aedc0900bff4161a5a154a63 /webkit | |
parent | e95ad331dcf3eed18d5851b4a97fc24d73a4b9cd (diff) | |
download | chromium_src-2e25a9f4152a90a179ad37206bff79e1198379d7.zip chromium_src-2e25a9f4152a90a179ad37206bff79e1198379d7.tar.gz chromium_src-2e25a9f4152a90a179ad37206bff79e1198379d7.tar.bz2 |
add layout_test_helper on windows
add layout_test_helper to toggle cleartype on and off as necessary for
layout tests on windows (mirroring similar functionality on the mac)
BUG=none
R=tony
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=22185
Review URL: http://codereview.chromium.org/159684
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
7 files changed, 92 insertions, 10 deletions
diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py index a15048c..b5bfad4 100644 --- a/webkit/tools/layout_tests/layout_package/path_utils.py +++ b/webkit/tools/layout_tests/layout_package/path_utils.py @@ -217,7 +217,7 @@ def LayoutTestHelperBinaryPath(target): platform_util = platform_utils.PlatformUtility('') # try output directory from either Xcode or chrome.sln full_path = platform_util.LayoutTestHelperBinaryPath(target) - if not os.path.exists(full_path): + if len(full_path) and not os.path.exists(full_path): raise PathNotFound('unable to find layout_test_helper at %s' % full_path) return full_path diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py index b496112..7d06054 100644 --- a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py +++ b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py @@ -172,6 +172,10 @@ class PlatformUtility(object): """Path to the image_diff binary.""" return PathFromBuildResults(target, 'image_diff') + def LayoutTestHelperPath(self, target): + """Path to the layout_test helper binary, if needed, empty otherwise""" + return '' + def TestShellBinary(self): """The name of the binary for TestShell.""" return 'test_shell' diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py index 0a79ba6..1aa19b0 100644 --- a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py +++ b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py @@ -158,6 +158,7 @@ class PlatformUtility(object): return PathFromBase('xcodebuild', target, 'image_diff') def LayoutTestHelperBinaryPath(self, target): + """Path to the layout_test helper binary, if needed, empty otherwise""" return PathFromBase('xcodebuild', target, 'layout_test_helper') def TestShellBinary(self): diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_win.py b/webkit/tools/layout_tests/layout_package/platform_utils_win.py index 2ba299a..cb5b343 100644 --- a/webkit/tools/layout_tests/layout_package/platform_utils_win.py +++ b/webkit/tools/layout_tests/layout_package/platform_utils_win.py @@ -188,6 +188,10 @@ class PlatformUtility(google.platform_utils_win.PlatformUtility): def ImageCompareExecutablePath(self, target): return PathFromBase('chrome', target, 'image_diff.exe') + def LayoutTestHelperBinaryPath(self, target): + """Path to the layout_test helper binary, if needed, empty otherwise""" + return PathFromBase('chrome', target, 'layout_test_helper.exe') + def TestShellBinary(self): """The name of the binary for TestShell.""" return 'test_shell.exe' diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py index a209bdb..1b09bd2 100755 --- a/webkit/tools/layout_tests/run_webkit_tests.py +++ b/webkit/tools/layout_tests/run_webkit_tests.py @@ -514,18 +514,16 @@ class TestRunner: # Start up any helper needed layout_test_helper_proc = None - if sys.platform in ('darwin'): - # Mac uses a helper for manging the color sync profile for pixel tests. - if not options.no_pixel_tests: - helper_path = \ - path_utils.LayoutTestHelperBinaryPath(self._options.target) + if not options.no_pixel_tests: + helper_path = path_utils.LayoutTestHelperBinaryPath(self._options.target) + if len(helper_path): logging.info("Starting layout helper %s" % helper_path) layout_test_helper_proc = subprocess.Popen([helper_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None) is_ready = layout_test_helper_proc.stdout.readline() - if is_ready != 'ready\n': + if not is_ready.startswith('ready'): logging.error("layout_test_helper failed to be ready") threads = self._InstantiateTestShellThreads(test_shell_binary) diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index bb4c330..1f5ecba 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -214,7 +214,7 @@ }, 'conditions': [ ['OS=="win"', { - 'dependencies': ['test_worker'], + 'dependencies': ['test_worker', 'layout_test_helper'], 'resource_include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit', ], @@ -634,7 +634,20 @@ }, ], }], - ['OS=="mac"', { + ['OS=="win"', { + 'targets': [ + { + # Helper application that disables ClearType during the + # running of the layout tests + 'target_name': 'layout_test_helper', + 'type': 'executable', + 'sources': [ + 'win/layout_test_helper.cc', + ], + }, + ], + }], + ['OS=="mac"', { 'targets': [ { # Helper application that manages the color sync profile on mac @@ -650,7 +663,7 @@ ], }, }, - ] + ], }], ], } diff --git a/webkit/tools/test_shell/win/layout_test_helper.cc b/webkit/tools/test_shell/win/layout_test_helper.cc new file mode 100644 index 0000000..b9bf0eb --- /dev/null +++ b/webkit/tools/test_shell/win/layout_test_helper.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This is a simple helper app that disables Cleartype and does whatever +// else it can to get the system into the configuration the layout tests +// expect. + +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <windows.h> + +BOOL g_font_smoothing_enabled = FALSE; + +static void SaveInitialSettings(void) { + BOOL ret; + ret = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, + (PVOID)&g_font_smoothing_enabled, 0); +} + +// Technically, all we need to do is disable ClearType. However, +// for some reason, the call to SPI_SETFONTSMOOTHINGTYPE doesn't +// seem to work, so we just disable font smoothing all together +// (which works reliably) +static void InstallLayoutTestSettings(void) { + BOOL ret; + ret = SystemParametersInfo(SPI_SETFONTSMOOTHING, (UINT)FALSE, (PVOID)0, 0); +} + +static void RestoreInitialSettings(void) { + BOOL ret; + ret = SystemParametersInfo(SPI_SETFONTSMOOTHING, + (UINT)g_font_smoothing_enabled, (PVOID)0, 0); +} + +static void SimpleSignalHandler(int sig) { + // Try to restore the settings and then go down cleanly + RestoreInitialSettings(); + exit(128 + sig); +} + +int main(int argc, char *argv[]) { + // Hooks the ways we might get told to clean up... + signal(SIGINT, SimpleSignalHandler); + signal(SIGTERM, SimpleSignalHandler); + + SaveInitialSettings(); + + InstallLayoutTestSettings(); + + // Let the script know we're ready + printf("ready\n"); + fflush(stdout); + + // Wait for any key (or signal) + getchar(); + + RestoreInitialSettings(); + + return 0; +} |