| OLD | NEW |
| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 private: | 148 private: |
| 149 scoped_ptr<NestedAcceleratorController> nested_accelerator_controller_; | 149 scoped_ptr<NestedAcceleratorController> nested_accelerator_controller_; |
| 150 MockNestedAcceleratorDelegate* delegate_; | 150 MockNestedAcceleratorDelegate* delegate_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorTest); | 152 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorTest); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| 156 | 156 |
| 157 // Aura window above lock screen in z order. | 157 // Aura window above lock screen in z order. |
| 158 TEST_F(NestedAcceleratorTest, AssociatedWindowAboveLockScreen) { | 158 // http://crbug.com/396494 |
| 159 TEST_F(NestedAcceleratorTest, DISABLED_AssociatedWindowAboveLockScreen) { |
| 159 // TODO(oshima|sadrul): remove when Win implements PES. | 160 // TODO(oshima|sadrul): remove when Win implements PES. |
| 160 if (!ui::PlatformEventSource::GetInstance()) | 161 if (!ui::PlatformEventSource::GetInstance()) |
| 161 return; | 162 return; |
| 162 MockDispatcher inner_dispatcher; | 163 MockDispatcher inner_dispatcher; |
| 163 scoped_ptr<aura::Window> mock_lock_container( | 164 scoped_ptr<aura::Window> mock_lock_container( |
| 164 CreateNormalWindow(0, root_window(), NULL)); | 165 CreateNormalWindow(0, root_window(), NULL)); |
| 165 aura::test::CreateTestWindowWithId(1, mock_lock_container.get()); | 166 aura::test::CreateTestWindowWithId(1, mock_lock_container.get()); |
| 166 | 167 |
| 167 scoped_ptr<aura::Window> associated_window( | 168 scoped_ptr<aura::Window> associated_window( |
| 168 CreateNormalWindow(2, root_window(), NULL)); | 169 CreateNormalWindow(2, root_window(), NULL)); |
| 169 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(), | 170 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(), |
| 170 mock_lock_container.get())); | 171 mock_lock_container.get())); |
| 171 | 172 |
| 172 DispatchKeyReleaseA(root_window()); | 173 DispatchKeyReleaseA(root_window()); |
| 173 scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = | 174 scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = |
| 174 ui::PlatformEventSource::GetInstance()->OverrideDispatcher( | 175 ui::PlatformEventSource::GetInstance()->OverrideDispatcher( |
| 175 &inner_dispatcher); | 176 &inner_dispatcher); |
| 176 aura::client::DispatcherRunLoop run_loop( | 177 aura::client::DispatcherRunLoop run_loop( |
| 177 aura::client::GetDispatcherClient(root_window()), NULL); | 178 aura::client::GetDispatcherClient(root_window()), NULL); |
| 178 run_loop.Run(); | 179 run_loop.Run(); |
| 179 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched()); | 180 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched()); |
| 180 } | 181 } |
| 181 | 182 |
| 182 // Test that the nested dispatcher handles accelerators. | 183 // Test that the nested dispatcher handles accelerators. |
| 183 TEST_F(NestedAcceleratorTest, AcceleratorsHandled) { | 184 // http://crbug.com/396494 |
| 185 TEST_F(NestedAcceleratorTest, DISABLED_AcceleratorsHandled) { |
| 184 // TODO(oshima|sadrul): remove when Win implements PES. | 186 // TODO(oshima|sadrul): remove when Win implements PES. |
| 185 if (!ui::PlatformEventSource::GetInstance()) | 187 if (!ui::PlatformEventSource::GetInstance()) |
| 186 return; | 188 return; |
| 187 MockDispatcher inner_dispatcher; | 189 MockDispatcher inner_dispatcher; |
| 188 ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); | 190 ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); |
| 189 accelerator.set_type(ui::ET_KEY_RELEASED); | 191 accelerator.set_type(ui::ET_KEY_RELEASED); |
| 190 TestTarget target; | 192 TestTarget target; |
| 191 delegate()->Register(accelerator, &target); | 193 delegate()->Register(accelerator, &target); |
| 192 | 194 |
| 193 DispatchKeyReleaseA(root_window()); | 195 DispatchKeyReleaseA(root_window()); |
| 194 scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = | 196 scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher = |
| 195 ui::PlatformEventSource::GetInstance()->OverrideDispatcher( | 197 ui::PlatformEventSource::GetInstance()->OverrideDispatcher( |
| 196 &inner_dispatcher); | 198 &inner_dispatcher); |
| 197 aura::client::DispatcherRunLoop run_loop( | 199 aura::client::DispatcherRunLoop run_loop( |
| 198 aura::client::GetDispatcherClient(root_window()), NULL); | 200 aura::client::GetDispatcherClient(root_window()), NULL); |
| 199 run_loop.Run(); | 201 run_loop.Run(); |
| 200 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); | 202 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); |
| 201 EXPECT_EQ(1, target.accelerator_pressed_count()); | 203 EXPECT_EQ(1, target.accelerator_pressed_count()); |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace test | 206 } // namespace test |
| 205 } // namespace wm | 207 } // namespace wm |
| OLD | NEW |