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

Side by Side 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: format Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include <signal.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <windows.h>
9
10 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.
11
12 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.
13 ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothingEnabled, 0);
14 }
15
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(void) {
jochen (gone - plz use gerrit) 2014/01/03 14:08:58 Install... and no (void)
tfarina 2014/01/03 22:08:52 Done.
21 ::SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, 0, 0);
22 }
23
24 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.
25 ::SystemParametersInfo(
26 SPI_SETFONTSMOOTHING, static_cast<UINT>(fontSmoothingEnabled), 0, 0);
27 }
28
29 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.
30 // Try to restore the settings and then go down cleanly
31 restoreInitialSettings();
32 exit(128 + signalNumber);
33 }
34
35 int main(int, char * []) {
36 // Hooks the ways we might get told to clean up...
37 signal(SIGINT, simpleSignalHandler);
38 signal(SIGTERM, simpleSignalHandler);
39
40 saveInitialSettings();
41
42 installLayoutTestSettings();
43
44 // Let the script know we're ready
45 printf("ready\n");
46 fflush(stdout);
47
48 // Wait for any key (or signal)
49 getchar();
50
51 restoreInitialSettings();
52
53 return EXIT_SUCCESS;
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698