OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/client/cursor_client.h" | 13 #include "ui/aura/client/cursor_client.h" |
13 #include "ui/aura/client/window_tree_client.h" | 14 #include "ui/aura/client/window_tree_client.h" |
14 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
16 #include "ui/aura/window_tree_host.h" | 17 #include "ui/aura/window_tree_host.h" |
17 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
18 #include "ui/events/event_processor.h" | 19 #include "ui/events/event_processor.h" |
19 #include "ui/events/event_utils.h" | 20 #include "ui/events/event_utils.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 233 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
233 params.native_widget = new DesktopNativeWidgetAura(widget.get()); | 234 params.native_widget = new DesktopNativeWidgetAura(widget.get()); |
234 widget->Init(params); | 235 widget->Init(params); |
235 widget->Show(); | 236 widget->Show(); |
236 | 237 |
237 // Post a task that terminates the nested loop and destroyes the widget. This | 238 // Post a task that terminates the nested loop and destroyes the widget. This |
238 // task will be executed from the nested loop initiated with the call to | 239 // task will be executed from the nested loop initiated with the call to |
239 // |RunWithDispatcher()| below. | 240 // |RunWithDispatcher()| below. |
240 base::RunLoop run_loop; | 241 base::RunLoop run_loop; |
241 base::Closure quit_runloop = run_loop.QuitClosure(); | 242 base::Closure quit_runloop = run_loop.QuitClosure(); |
242 message_loop()->PostTask(FROM_HERE, | 243 message_loop()->task_runner()->PostTask( |
243 base::Bind(&QuitNestedLoopAndCloseWidget, | 244 FROM_HERE, |
244 base::Passed(&widget), | 245 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget), |
245 base::Unretained(&quit_runloop))); | 246 base::Unretained(&quit_runloop))); |
246 run_loop.Run(); | 247 run_loop.Run(); |
247 } | 248 } |
248 | 249 |
249 // This class provides functionality to create fullscreen and top level popup | 250 // This class provides functionality to create fullscreen and top level popup |
250 // windows. It additionally tests whether the destruction of these windows | 251 // windows. It additionally tests whether the destruction of these windows |
251 // occurs correctly in desktop AURA without crashing. | 252 // occurs correctly in desktop AURA without crashing. |
252 // It provides facilities to test the following cases:- | 253 // It provides facilities to test the following cases:- |
253 // 1. Child window destroyed which should lead to the destruction of the | 254 // 1. Child window destroyed which should lead to the destruction of the |
254 // parent. | 255 // parent. |
255 // 2. Parent window destroyed which should lead to the child being destroyed. | 256 // 2. Parent window destroyed which should lead to the child being destroyed. |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); | 655 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); |
655 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); | 656 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); |
656 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); | 657 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); |
657 widget.CloseNow(); | 658 widget.CloseNow(); |
658 } | 659 } |
659 | 660 |
660 #endif // defined(OS_WIN) | 661 #endif // defined(OS_WIN) |
661 | 662 |
662 } // namespace test | 663 } // namespace test |
663 } // namespace views | 664 } // namespace views |
OLD | NEW |