| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> // required by _set_abort_behavior | 5 #include <stdlib.h> // required by _set_abort_behavior |
| 6 #include <gtk/gtk.h> | 6 #include <gtk/gtk.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "webkit/tools/test_shell/test_shell.h" | 9 #include "webkit/tools/test_shell/test_shell.h" |
| 10 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" | 10 #include "webkit/tools/test_shell/test_shell_platform_delegate.h" |
| 11 | 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 |
| 12 void TestShellPlatformDelegate::PreflightArgs(int *argc, char ***argv) { | 38 void TestShellPlatformDelegate::PreflightArgs(int *argc, char ***argv) { |
| 13 gtk_init(argc, argv); | 39 gtk_init(argc, argv); |
| 40 SetUpGtkLogHandler(); |
| 14 } | 41 } |
| 15 | 42 |
| 16 void TestShellPlatformDelegate::SelectUnifiedTheme() { | 43 void TestShellPlatformDelegate::SelectUnifiedTheme() { |
| 17 // Stop custom gtkrc files from messing with the theme. | 44 // Stop custom gtkrc files from messing with the theme. |
| 18 gchar* default_gtkrc_files[] = { NULL }; | 45 gchar* default_gtkrc_files[] = { NULL }; |
| 19 gtk_rc_set_default_files(default_gtkrc_files); | 46 gtk_rc_set_default_files(default_gtkrc_files); |
| 20 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE); | 47 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE); |
| 21 | 48 |
| 22 // Pick a theme that uses Cairo for drawing, since we: | 49 // Pick a theme that uses Cairo for drawing, since we: |
| 23 // 1) currently don't support GTK themes that use the GDK drawing APIs, and | 50 // 1) currently don't support GTK themes that use the GDK drawing APIs, and |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 } | 67 } |
| 41 | 68 |
| 42 void TestShellPlatformDelegate::InitializeGUI() { | 69 void TestShellPlatformDelegate::InitializeGUI() { |
| 43 } | 70 } |
| 44 | 71 |
| 45 void TestShellPlatformDelegate::SetWindowPositionForRecording(TestShell *) { | 72 void TestShellPlatformDelegate::SetWindowPositionForRecording(TestShell *) { |
| 46 } | 73 } |
| 47 | 74 |
| 48 TestShellPlatformDelegate::~TestShellPlatformDelegate() { | 75 TestShellPlatformDelegate::~TestShellPlatformDelegate() { |
| 49 } | 76 } |
| OLD | NEW |