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..089c39f412f0dbd57b5b76cc71ecdf2f6a74b41e |
--- /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 fontSmoothingEnabled = FALSE; |
jochen (gone - plz use gerrit)
2014/01/03 14:08:58
font_smoothing_enabled
tfarina
2014/01/03 22:08:52
Done.
|
+ |
+static void saveInitialSettings(void) { |
jochen (gone - plz use gerrit)
2014/01/03 14:08:58
SaveInitial... and no (void)
tfarina
2014/01/03 22:08:52
Done.
|
+ ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothingEnabled, 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) { |
jochen (gone - plz use gerrit)
2014/01/03 14:08:58
Install... and no (void)
tfarina
2014/01/03 22:08:52
Done.
|
+ ::SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, 0, 0); |
+} |
+ |
+static void restoreInitialSettings(void) { |
jochen (gone - plz use gerrit)
2014/01/03 14:08:58
Restore... and no (void)
tfarina
2014/01/03 22:08:52
Done.
|
+ ::SystemParametersInfo( |
+ SPI_SETFONTSMOOTHING, static_cast<UINT>(fontSmoothingEnabled), 0, 0); |
+} |
+ |
+static void simpleSignalHandler(int signalNumber) { |
jochen (gone - plz use gerrit)
2014/01/03 14:08:58
Simple...
tfarina
2014/01/03 22:08:52
Done.
|
+ // 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; |
+} |