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

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

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « views/examples/widget_example.cc ('k') | views/focus/focus_manager_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/view.h" 10 #include "views/view.h"
(...skipping 10 matching lines...) Expand all
21 AcceleratorHandlerGtkTest() 21 AcceleratorHandlerGtkTest()
22 : kMenuAccelerator(ui::VKEY_MENU, false, false, false), 22 : kMenuAccelerator(ui::VKEY_MENU, false, false, false),
23 kHomepageAccelerator(ui::VKEY_HOME, false, false, true), 23 kHomepageAccelerator(ui::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 = window_->GetFocusManager();
32 GetFocusManager();
33 focus_manager->RegisterAccelerator(kMenuAccelerator, this); 32 focus_manager->RegisterAccelerator(kMenuAccelerator, this);
34 focus_manager->RegisterAccelerator(kHomepageAccelerator, this); 33 focus_manager->RegisterAccelerator(kHomepageAccelerator, this);
35 menu_pressed_ = false; 34 menu_pressed_ = false;
36 home_pressed_ = false; 35 home_pressed_ = false;
37 } 36 }
38 37
39 virtual void TearDown() { 38 virtual void TearDown() {
40 window_->CloseWindow(); 39 window_->Close();
41 40
42 // Flush the message loop to make Purify happy. 41 // Flush the message loop to make Purify happy.
43 message_loop_.RunAllPending(); 42 message_loop_.RunAllPending();
44 } 43 }
45 44
46 GdkEventKey CreateKeyEvent(GdkEventType type, guint keyval, guint state) { 45 GdkEventKey CreateKeyEvent(GdkEventType type, guint keyval, guint state) {
47 GdkEventKey evt; 46 GdkEventKey evt;
48 memset(&evt, 0, sizeof(evt)); 47 memset(&evt, 0, sizeof(evt));
49 evt.type = type; 48 evt.type = type;
50 evt.keyval = keyval; 49 evt.keyval = keyval;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 183
185 // Release Alt - now this should trigger the menu shortcut. 184 // Release Alt - now this should trigger the menu shortcut.
186 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0); 185 evt = CreateKeyEvent(GDK_KEY_RELEASE, GDK_Alt_L, 0);
187 evt.hardware_keycode = 0x40; 186 evt.hardware_keycode = 0x40;
188 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt))); 187 EXPECT_TRUE(handler.Dispatch(reinterpret_cast<GdkEvent*>(&evt)));
189 188
190 ASSERT_TRUE(menu_pressed_); 189 ASSERT_TRUE(menu_pressed_);
191 } 190 }
192 191
193 } // namespace views 192 } // namespace views
OLDNEW
« no previous file with comments | « views/examples/widget_example.cc ('k') | views/focus/focus_manager_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698