| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <gdk/gdkkeysyms.h> | 5 #include <gdk/gdkkeysyms.h> |
| 6 | 6 |
| 7 #include "gfx/rect.h" | 7 #include "gfx/rect.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "views/focus/accelerator_handler.h" | 9 #include "views/focus/accelerator_handler.h" |
| 10 #include "views/view.h" | 10 #include "views/view.h" |
| 11 #include "views/window/window_gtk.h" | 11 #include "views/window/window_gtk.h" |
| 12 #include "views/window/window_delegate.h" | 12 #include "views/window/window_delegate.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 class AcceleratorHandlerGtkTest | 16 class AcceleratorHandlerGtkTest |
| 17 : public testing::Test, | 17 : public testing::Test, |
| 18 public WindowDelegate, | 18 public WindowDelegate, |
| 19 public AcceleratorTarget { | 19 public AcceleratorTarget { |
| 20 public: | 20 public: |
| 21 AcceleratorHandlerGtkTest() | 21 AcceleratorHandlerGtkTest() |
| 22 : kMenuAccelerator(base::VKEY_MENU, false, false, false), | 22 : kMenuAccelerator(app::VKEY_MENU, false, false, false), |
| 23 kHomepageAccelerator(base::VKEY_HOME, false, false, true), | 23 kHomepageAccelerator(app::VKEY_HOME, false, false, true), |
| 24 content_view_(NULL) { | 24 content_view_(NULL) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual void SetUp() { | 27 virtual void SetUp() { |
| 28 window_ = Window::CreateChromeWindow( | 28 window_ = Window::CreateChromeWindow( |
| 29 NULL, gfx::Rect(0, 0, 500, 500), this); | 29 NULL, gfx::Rect(0, 0, 500, 500), this); |
| 30 window_->Show(); | 30 window_->Show(); |
| 31 FocusManager* focus_manager = static_cast<WindowGtk*>(window_)-> | 31 FocusManager* focus_manager = static_cast<WindowGtk*>(window_)-> |
| 32 GetFocusManager(); | 32 GetFocusManager(); |
| 33 focus_manager->RegisterAccelerator(kMenuAccelerator, this); | 33 focus_manager->RegisterAccelerator(kMenuAccelerator, this); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Release Alt - now this should trigger the menu shortcut. | 185 // Release Alt - now this should trigger the menu shortcut. |
| 186 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0); | 186 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0); |
| 187 evt.hardware_keycode = 0x40; | 187 evt.hardware_keycode = 0x40; |
| 188 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt))); | 188 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt))); |
| 189 | 189 |
| 190 ASSERT_TRUE(menu_pressed_); | 190 ASSERT_TRUE(menu_pressed_); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace views | 193 } // namespace views |
| OLD | NEW |