Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: content/shell/renderer/test_runner/helper/layout_test_helper_win.cc

Issue 120773007: content: Copy layout test helpers from Blink to Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert some unintended changes Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/renderer/test_runner/helper/layout_test_helper_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « content/shell/renderer/test_runner/helper/layout_test_helper_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698