Index: content/shell/renderer/test_runner/helper/layout_test_helper_win.cc |
diff --git a/content/shell/renderer/test_runner/helper/layout_test_helper_win.cc b/content/shell/renderer/test_runner/helper/layout_test_helper_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9ec99890d4b56002bf5fca89d69668381d4aa842 |
--- /dev/null |
+++ b/content/shell/renderer/test_runner/helper/layout_test_helper_win.cc |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 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. |
+ |
+#include <signal.h> |
+#include <stdio.h> |
+#include <stdlib.h> |
+#include <windows.h> |
+ |
+static BOOL font_smoothing_enabled = FALSE; |
+ |
+static void SaveInitialSettings() { |
+ ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &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() { |
+ ::SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, 0, 0); |
+} |
+ |
+static void RestoreInitialSettings() { |
+ ::SystemParametersInfo( |
+ SPI_SETFONTSMOOTHING, static_cast<UINT>(font_smoothing_enabled), 0, 0); |
+} |
+ |
+static void SimpleSignalHandler(int signalNumber) { |
+ // Try to restore the settings and then go down cleanly. |
+ RestoreInitialSettings(); |
+ exit(128 + signalNumber); |
+} |
+ |
+int main(int, char**) { |
+ // 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 EXIT_SUCCESS; |
+} |