Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / components / test_runner / helper / layout_test_helper_win.cc
blob9ec99890d4b56002bf5fca89d69668381d4aa842
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <signal.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <windows.h>
10 static BOOL font_smoothing_enabled = FALSE;
12 static void SaveInitialSettings() {
13 ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &font_smoothing_enabled, 0);
16 // Technically, all we need to do is disable ClearType. However,
17 // for some reason, the call to SPI_SETFONTSMOOTHINGTYPE doesn't
18 // seem to work, so we just disable font smoothing all together
19 // (which works reliably).
20 static void InstallLayoutTestSettings() {
21 ::SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, 0, 0);
24 static void RestoreInitialSettings() {
25 ::SystemParametersInfo(
26 SPI_SETFONTSMOOTHING, static_cast<UINT>(font_smoothing_enabled), 0, 0);
29 static void SimpleSignalHandler(int signalNumber) {
30 // Try to restore the settings and then go down cleanly.
31 RestoreInitialSettings();
32 exit(128 + signalNumber);
35 int main(int, char**) {
36 // Hooks the ways we might get told to clean up...
37 signal(SIGINT, SimpleSignalHandler);
38 signal(SIGTERM, SimpleSignalHandler);
40 SaveInitialSettings();
42 InstallLayoutTestSettings();
44 // Let the script know we're ready.
45 printf("ready\n");
46 fflush(stdout);
48 // Wait for any key (or signal).
49 getchar();
51 RestoreInitialSettings();
53 return EXIT_SUCCESS;