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

Side by Side Diff: views/focus/accelerator_handler_gtk_unittest.cc

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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
OLDNEW
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 "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/rect.h" 8 #include "ui/gfx/rect.h"
9 #include "views/focus/accelerator_handler.h" 9 #include "views/focus/accelerator_handler.h"
10 #include "views/focus/focus_manager.h" 10 #include "views/focus/focus_manager.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // but the code should never depend on exact hardware keycodes, just the 51 // but the code should never depend on exact hardware keycodes, just the
52 // fact that the code for presses and releases of the same key match. 52 // fact that the code for presses and releases of the same key match.
53 evt.hardware_keycode = keyval; 53 evt.hardware_keycode = keyval;
54 evt.state = state; 54 evt.state = state;
55 GtkWidget* widget = GTK_WIDGET(window_->GetNativeWindow()); 55 GtkWidget* widget = GTK_WIDGET(window_->GetNativeWindow());
56 evt.window = widget->window; 56 evt.window = widget->window;
57 return evt; 57 return evt;
58 } 58 }
59 59
60 // AcceleratorTarget implementation. 60 // AcceleratorTarget implementation.
61 virtual bool AcceleratorPressed(const Accelerator& accelerator) { 61 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) {
62 if (accelerator == kMenuAccelerator) 62 if (accelerator == kMenuAccelerator)
63 menu_pressed_ = true; 63 menu_pressed_ = true;
64 else if (accelerator == kHomepageAccelerator) 64 else if (accelerator == kHomepageAccelerator)
65 home_pressed_ = true; 65 home_pressed_ = true;
66 return true; 66 return true;
67 } 67 }
68 68
69 // WidgetDelegate Implementation. 69 // WidgetDelegate Implementation.
70 virtual View* GetContentsView() { 70 virtual View* GetContentsView() {
71 if (!content_view_) 71 if (!content_view_)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Release Alt - now this should trigger the menu shortcut. 190 // Release Alt - now this should trigger the menu shortcut.
191 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0); 191 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0);
192 evt.hardware_keycode = 0x40; 192 evt.hardware_keycode = 0x40;
193 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt))); 193 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt)));
194 194
195 ASSERT_TRUE(menu_pressed_); 195 ASSERT_TRUE(menu_pressed_);
196 } 196 }
197 197
198 } // namespace views 198 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698