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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 191153004: Provide access to the WindowEventDispatcher as a ui::EventProcessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | « no previous file | ash/extended_desktop_unittest.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) 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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 #include "ash/accelerators/accelerator_table.h" 6 #include "ash/accelerators/accelerator_table.h"
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/caps_lock_delegate.h" 9 #include "ash/caps_lock_delegate.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
11 #include "ash/ime_control_delegate.h" 11 #include "ash/ime_control_delegate.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "ash/system/brightness_control_delegate.h" 15 #include "ash/system/brightness_control_delegate.h"
16 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" 16 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
17 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
18 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
19 #include "ash/test/display_manager_test_api.h" 19 #include "ash/test/display_manager_test_api.h"
20 #include "ash/test/test_screenshot_delegate.h" 20 #include "ash/test/test_screenshot_delegate.h"
21 #include "ash/test/test_shell_delegate.h" 21 #include "ash/test/test_shell_delegate.h"
22 #include "ash/volume_control_delegate.h" 22 #include "ash/volume_control_delegate.h"
23 #include "ash/wm/window_state.h" 23 #include "ash/wm/window_state.h"
24 #include "ash/wm/window_util.h" 24 #include "ash/wm/window_util.h"
25 #include "base/command_line.h" 25 #include "base/command_line.h"
26 #include "ui/aura/test/test_window_delegate.h" 26 #include "ui/aura/test/test_window_delegate.h"
27 #include "ui/aura/test/test_windows.h" 27 #include "ui/aura/test/test_windows.h"
28 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
29 #include "ui/aura/window_event_dispatcher.h"
30 #include "ui/events/event.h" 29 #include "ui/events/event.h"
30 #include "ui/events/event_processor.h"
31 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
32 32
33 #if defined(USE_X11) 33 #if defined(USE_X11)
34 #include <X11/Xlib.h> 34 #include <X11/Xlib.h>
35 #include "ui/events/test/events_test_utils_x11.h" 35 #include "ui/events/test/events_test_utils_x11.h"
36 #endif 36 #endif
37 37
38 namespace ash { 38 namespace ash {
39 39
40 namespace { 40 namespace {
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 #define MAYBE_ProcessOnce ProcessOnce 628 #define MAYBE_ProcessOnce ProcessOnce
629 #endif 629 #endif
630 630
631 #if defined(OS_WIN) || defined(USE_X11) 631 #if defined(OS_WIN) || defined(USE_X11)
632 TEST_F(AcceleratorControllerTest, MAYBE_ProcessOnce) { 632 TEST_F(AcceleratorControllerTest, MAYBE_ProcessOnce) {
633 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE); 633 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE);
634 TestTarget target; 634 TestTarget target;
635 GetController()->Register(accelerator_a, &target); 635 GetController()->Register(accelerator_a, &target);
636 636
637 // The accelerator is processed only once. 637 // The accelerator is processed only once.
638 aura::WindowEventDispatcher* dispatcher = 638 ui::EventProcessor* dispatcher =
639 Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); 639 Shell::GetPrimaryRootWindow()->GetHost()->event_processor();
640 #if defined(OS_WIN) 640 #if defined(OS_WIN)
641 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; 641 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 };
642 ui::TranslatedKeyEvent key_event1(msg1, false); 642 ui::TranslatedKeyEvent key_event1(msg1, false);
643 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event1); 643 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event1);
644 EXPECT_TRUE(key_event1.handled() || details.dispatcher_destroyed); 644 EXPECT_TRUE(key_event1.handled() || details.dispatcher_destroyed);
645 645
646 MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; 646 MSG msg2 = { NULL, WM_CHAR, L'A', 0 };
647 ui::TranslatedKeyEvent key_event2(msg2, true); 647 ui::TranslatedKeyEvent key_event2(msg2, true);
648 details = dispatcher->OnEventFromSource(&key_event2); 648 details = dispatcher->OnEventFromSource(&key_event2);
649 EXPECT_FALSE(key_event2.handled() || details.dispatcher_destroyed); 649 EXPECT_FALSE(key_event2.handled() || details.dispatcher_destroyed);
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 // Don't alert if we have a minimized window either. 1369 // Don't alert if we have a minimized window either.
1370 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); 1370 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1371 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { 1371 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1372 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1372 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1373 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1373 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1374 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); 1374 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE);
1375 } 1375 }
1376 } 1376 }
1377 1377
1378 } // namespace ash 1378 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698