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

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

Issue 72503002: Remove some pass-thrus on RootWindow API in favor of exposing the RootWindowHost again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/display/display_controller.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/session_state_delegate.h" 6 #include "ash/session_state_delegate.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 DISALLOW_COPY_AND_ASSIGN(TestTarget); 73 DISALLOW_COPY_AND_ASSIGN(TestTarget);
74 }; 74 };
75 75
76 void DispatchKeyReleaseA() { 76 void DispatchKeyReleaseA() {
77 // Sending both keydown and keyup is necessary here because the accelerator 77 // Sending both keydown and keyup is necessary here because the accelerator
78 // manager only checks a keyup event following a keydown event. See 78 // manager only checks a keyup event following a keydown event. See
79 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details. 79 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details.
80 #if defined(OS_WIN) 80 #if defined(OS_WIN)
81 MSG native_event_down = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; 81 MSG native_event_down = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 };
82 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(native_event_down); 82 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent(
83 native_event_down);
83 MSG native_event_up = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; 84 MSG native_event_up = { NULL, WM_KEYUP, ui::VKEY_A, 0 };
84 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(native_event_up); 85 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent(native_event_up);
85 #elif defined(USE_X11) 86 #elif defined(USE_X11)
86 XEvent native_event; 87 XEvent native_event;
87 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 88 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
88 ui::VKEY_A, 89 ui::VKEY_A,
89 0, 90 0,
90 &native_event); 91 &native_event);
91 aura::WindowEventDispatcher* dispatcher = 92 aura::WindowEventDispatcher* dispatcher =
92 ash::Shell::GetPrimaryRootWindow()->GetDispatcher(); 93 ash::Shell::GetPrimaryRootWindow()->GetDispatcher();
93 dispatcher->PostNativeEvent(&native_event); 94 dispatcher->host()->PostNativeEvent(&native_event);
94 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, 95 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED,
95 ui::VKEY_A, 96 ui::VKEY_A,
96 0, 97 0,
97 &native_event); 98 &native_event);
98 dispatcher->PostNativeEvent(&native_event); 99 dispatcher->host()->PostNativeEvent(&native_event);
99 #endif 100 #endif
100 101
101 // Send noop event to signal dispatcher to exit. 102 // Send noop event to signal dispatcher to exit.
102 dispatcher->PostNativeEvent(ui::CreateNoopEvent()); 103 dispatcher->host()->PostNativeEvent(ui::CreateNoopEvent());
103 } 104 }
104 105
105 } // namespace 106 } // namespace
106 107
107 typedef AshTestBase NestedDispatcherTest; 108 typedef AshTestBase NestedDispatcherTest;
108 109
109 // Aura window below lock screen in z order. 110 // Aura window below lock screen in z order.
110 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) { 111 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) {
111 MockDispatcher inner_dispatcher; 112 MockDispatcher inner_dispatcher;
112 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0)); 113 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 158 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
158 &inner_dispatcher, 159 &inner_dispatcher,
159 root_window, 160 root_window,
160 true /* nestable_tasks_allowed */); 161 true /* nestable_tasks_allowed */);
161 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 162 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
162 EXPECT_EQ(1, target.accelerator_pressed_count()); 163 EXPECT_EQ(1, target.accelerator_pressed_count());
163 } 164 }
164 165
165 } // namespace test 166 } // namespace test
166 } // namespace ash 167 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/display/display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698