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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 248 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
248 params.native_widget = new DesktopNativeWidgetAura(widget.get()); | 249 params.native_widget = new DesktopNativeWidgetAura(widget.get()); |
249 widget->Init(params); | 250 widget->Init(params); |
250 widget->Show(); | 251 widget->Show(); |
251 | 252 |
252 // Post a task that terminates the nested loop and destroyes the widget. This | 253 // Post a task that terminates the nested loop and destroyes the widget. This |
253 // task will be executed from the nested loop initiated with the call to | 254 // task will be executed from the nested loop initiated with the call to |
254 // |RunWithDispatcher()| below. | 255 // |RunWithDispatcher()| below. |
255 base::RunLoop run_loop; | 256 base::RunLoop run_loop; |
256 base::Closure quit_runloop = run_loop.QuitClosure(); | 257 base::Closure quit_runloop = run_loop.QuitClosure(); |
257 message_loop()->PostTask(FROM_HERE, | 258 message_loop()->task_runner()->PostTask( |
258 base::Bind(&QuitNestedLoopAndCloseWidget, | 259 FROM_HERE, |
259 base::Passed(&widget), | 260 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget), |
260 base::Unretained(&quit_runloop))); | 261 base::Unretained(&quit_runloop))); |
261 run_loop.Run(); | 262 run_loop.Run(); |
262 } | 263 } |
263 | 264 |
264 // This class provides functionality to create fullscreen and top level popup | 265 // This class provides functionality to create fullscreen and top level popup |
265 // windows. It additionally tests whether the destruction of these windows | 266 // windows. It additionally tests whether the destruction of these windows |
266 // occurs correctly in desktop AURA without crashing. | 267 // occurs correctly in desktop AURA without crashing. |
267 // It provides facilities to test the following cases:- | 268 // It provides facilities to test the following cases:- |
268 // 1. Child window destroyed which should lead to the destruction of the | 269 // 1. Child window destroyed which should lead to the destruction of the |
269 // parent. | 270 // parent. |
270 // 2. Parent window destroyed which should lead to the child being destroyed. | 271 // 2. Parent window destroyed which should lead to the child being destroyed. |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); | 674 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); |
674 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); | 675 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); |
675 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); | 676 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); |
676 widget.CloseNow(); | 677 widget.CloseNow(); |
677 } | 678 } |
678 | 679 |
679 #endif // defined(OS_WIN) | 680 #endif // defined(OS_WIN) |
680 | 681 |
681 } // namespace test | 682 } // namespace test |
682 } // namespace views | 683 } // namespace views |
OLD | NEW |