OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/gtk_key_bindings_handler.h" | 5 #include "content/browser/renderer_host/gtk_key_bindings_handler.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "content/common/edit_command.h" | 17 #include "content/common/edit_command.h" |
18 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
19 #include "content/public/common/content_paths.h" | 19 #include "content/public/common/content_paths.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 using content::EditCommand; | 22 namespace content { |
23 using content::EditCommands; | |
24 using content::NativeWebKeyboardEvent; | |
25 | 23 |
26 class GtkKeyBindingsHandlerTest : public testing::Test { | 24 class GtkKeyBindingsHandlerTest : public testing::Test { |
27 protected: | 25 protected: |
28 struct EditCommand { | 26 struct EditCommand { |
29 const char* name; | 27 const char* name; |
30 const char* value; | 28 const char* value; |
31 }; | 29 }; |
32 | 30 |
33 GtkKeyBindingsHandlerTest() | 31 GtkKeyBindingsHandlerTest() |
34 : window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), | 32 : window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), |
35 handler_(NULL) { | 33 handler_(NULL) { |
36 FilePath gtkrc; | 34 FilePath gtkrc; |
37 PathService::Get(content::DIR_TEST_DATA, >krc); | 35 PathService::Get(DIR_TEST_DATA, >krc); |
38 gtkrc = gtkrc.AppendASCII("gtk_key_bindings_test_gtkrc"); | 36 gtkrc = gtkrc.AppendASCII("gtk_key_bindings_test_gtkrc"); |
39 EXPECT_TRUE(file_util::PathExists(gtkrc)); | 37 EXPECT_TRUE(file_util::PathExists(gtkrc)); |
40 | 38 |
41 gtk_rc_parse(gtkrc.value().c_str()); | 39 gtk_rc_parse(gtkrc.value().c_str()); |
42 | 40 |
43 GtkWidget* fixed = gtk_fixed_new(); | 41 GtkWidget* fixed = gtk_fixed_new(); |
44 handler_ = new GtkKeyBindingsHandler(fixed); | 42 handler_ = new GtkKeyBindingsHandler(fixed); |
45 gtk_container_add(GTK_CONTAINER(window_), fixed); | 43 gtk_container_add(GTK_CONTAINER(window_), fixed); |
46 gtk_widget_show(fixed); | 44 gtk_widget_show(fixed); |
47 gtk_widget_show(window_); | 45 gtk_widget_show(window_); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 }; | 215 }; |
218 TestKeyBinding(NewNativeWebKeyboardEvent(GDK_8, GDK_CONTROL_MASK), | 216 TestKeyBinding(NewNativeWebKeyboardEvent(GDK_8, GDK_CONTROL_MASK), |
219 kSelectAll, arraysize(kSelectAll)); | 217 kSelectAll, arraysize(kSelectAll)); |
220 | 218 |
221 static const EditCommand kSetAnchor[] = { | 219 static const EditCommand kSetAnchor[] = { |
222 { "SetMark", "" } | 220 { "SetMark", "" } |
223 }; | 221 }; |
224 TestKeyBinding(NewNativeWebKeyboardEvent(GDK_9, GDK_CONTROL_MASK), | 222 TestKeyBinding(NewNativeWebKeyboardEvent(GDK_9, GDK_CONTROL_MASK), |
225 kSetAnchor, arraysize(kSetAnchor)); | 223 kSetAnchor, arraysize(kSetAnchor)); |
226 } | 224 } |
| 225 |
| 226 } // namespace content |
OLD | NEW |