OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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 <stdlib.h> // required by _set_abort_behavior | |
6 #include <gtk/gtk.h> | |
7 | |
8 #include "base/command_line.h" | |
9 #include "webkit/tools/test_shell/test_shell.h" | |
10 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | |
11 | |
12 // Hooks Gtk's logs so that we can ignore harmless warnings. | |
13 static void GtkLogHandler(const gchar* log_domain, | |
14 GLogLevelFlags log_level, | |
15 const gchar* message, | |
16 gpointer userdata) { | |
17 if (strstr(message, "Loading IM context type") || | |
18 strstr(message, "wrong ELF class: ELFCLASS64")) { | |
19 // GTK outputs some warnings when it attempts to load 64bit shared | |
20 // objects from 32bit binaries. Suppress them as they are not | |
21 // actual errors. The warning messages are like | |
22 // | |
23 // (test_shell:2476): Gtk-WARNING **: | |
24 // /usr/lib/gtk-2.0/2.10.0/immodules/im-uim.so: wrong ELF class: ELFCLASS64 | |
25 // | |
26 // (test_shell:2476): Gtk-WARNING **: Loading IM context type 'uim' failed | |
27 // | |
28 // Related bug: http://crbug.com/9643 | |
29 } else { | |
30 g_log_default_handler(log_domain, log_level, message, userdata); | |
31 } | |
32 } | |
33 | |
34 static void SetUpGtkLogHandler() { | |
35 g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, GtkLogHandler, NULL); | |
36 } | |
37 | |
38 void TestShellPlatformDelegate::PreflightArgs(int *argc, char ***argv) { | |
39 gtk_init(argc, argv); | |
40 SetUpGtkLogHandler(); | |
41 } | |
42 | |
43 void TestShellPlatformDelegate::SelectUnifiedTheme() { | |
44 // Stop custom gtkrc files from messing with the theme. | |
45 gchar* default_gtkrc_files[] = { NULL }; | |
46 gtk_rc_set_default_files(default_gtkrc_files); | |
47 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE); | |
48 | |
49 // Pick a theme that uses Cairo for drawing, since we: | |
50 // 1) currently don't support GTK themes that use the GDK drawing APIs, and | |
51 // 2) need to use a unified theme for layout tests anyway. | |
52 g_object_set(gtk_settings_get_default(), | |
53 "gtk-theme-name", "Mist", | |
54 NULL); | |
55 } | |
56 | |
57 TestShellPlatformDelegate::TestShellPlatformDelegate( | |
58 const CommandLine& command_line) | |
59 : command_line_(command_line) { | |
60 } | |
61 | |
62 bool TestShellPlatformDelegate::CheckLayoutTestSystemDependencies() { | |
63 return true; | |
64 } | |
65 | |
66 void TestShellPlatformDelegate::SuppressErrorReporting() { | |
67 } | |
68 | |
69 void TestShellPlatformDelegate::InitializeGUI() { | |
70 } | |
71 | |
72 void TestShellPlatformDelegate::SetWindowPositionForRecording(TestShell *) { | |
73 } | |
74 | |
75 TestShellPlatformDelegate::~TestShellPlatformDelegate() { | |
76 } | |
OLD | NEW |