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

Side by Side Diff: ui/wm/core/nested_accelerator_controller_unittest.cc

Issue 731373002: Enable MSVC warning for unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another Windows fix Created 6 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
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | win8/delegate_execute/crash_server_init.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/wm/core/nested_accelerator_controller.h" 5 #include "ui/wm/core/nested_accelerator_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/event_types.h" 8 #include "base/event_types.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 }; 76 };
77 77
78 void DispatchKeyReleaseA(aura::Window* root_window) { 78 void DispatchKeyReleaseA(aura::Window* root_window) {
79 // Sending both keydown and keyup is necessary here because the accelerator 79 // Sending both keydown and keyup is necessary here because the accelerator
80 // manager only checks a keyup event following a keydown event. See 80 // manager only checks a keyup event following a keydown event. See
81 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details. 81 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details.
82 #if defined(OS_WIN) 82 #if defined(OS_WIN)
83 aura::WindowTreeHost* host = root_window->GetHost(); 83 aura::WindowTreeHost* host = root_window->GetHost();
84 HWND hwnd = host->GetAcceleratedWidget(); 84 HWND hwnd = host->GetAcceleratedWidget();
85 ::PostMessage(hwnd, WM_KEYDOWN, ui::VKEY_A, 0); 85 ::PostMessage(hwnd, WM_KEYDOWN, ui::VKEY_A, 0);
86 MSG native_event_up = {NULL, WM_KEYUP, ui::VKEY_A, 0};
87 ::PostMessage(hwnd, WM_KEYUP, ui::VKEY_A, 0); 86 ::PostMessage(hwnd, WM_KEYUP, ui::VKEY_A, 0);
88 #elif defined(USE_X11) 87 #elif defined(USE_X11)
89 ui::ScopedXI2Event native_event; 88 ui::ScopedXI2Event native_event;
90 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); 89 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
91 aura::WindowTreeHost* host = root_window->GetHost(); 90 aura::WindowTreeHost* host = root_window->GetHost();
92 aura::test::PostEventToWindowTreeHost(*native_event, host); 91 aura::test::PostEventToWindowTreeHost(*native_event, host);
93 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0); 92 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0);
94 aura::test::PostEventToWindowTreeHost(*native_event, host); 93 aura::test::PostEventToWindowTreeHost(*native_event, host);
95 #endif 94 #endif
96 // Make sure the inner message-loop terminates after dispatching the events. 95 // Make sure the inner message-loop terminates after dispatching the events.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 &inner_dispatcher); 197 &inner_dispatcher);
199 aura::client::DispatcherRunLoop run_loop( 198 aura::client::DispatcherRunLoop run_loop(
200 aura::client::GetDispatcherClient(root_window()), NULL); 199 aura::client::GetDispatcherClient(root_window()), NULL);
201 run_loop.Run(); 200 run_loop.Run();
202 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 201 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
203 EXPECT_EQ(1, target.accelerator_pressed_count()); 202 EXPECT_EQ(1, target.accelerator_pressed_count());
204 } 203 }
205 204
206 } // namespace test 205 } // namespace test
207 } // namespace wm 206 } // namespace wm
OLDNEW
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | win8/delegate_execute/crash_server_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698