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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2867663007: Use ScopedTaskEnvironment instead of MessageLoopForUI in ViewsTestBase. (Closed)
Patch Set: self-review Created 3 years, 7 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
« no previous file with comments | « ui/views/test/views_test_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "ui/aura/client/aura_constants.h" 13 #include "ui/aura/client/aura_constants.h"
13 #include "ui/aura/client/cursor_client.h" 14 #include "ui/aura/client/cursor_client.h"
14 #include "ui/aura/client/window_parenting_client.h" 15 #include "ui/aura/client/window_parenting_client.h"
15 #include "ui/aura/test/test_window_delegate.h" 16 #include "ui/aura/test/test_window_delegate.h"
16 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
17 #include "ui/aura/window_tree_host.h" 18 #include "ui/aura/window_tree_host.h"
18 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
19 #include "ui/events/event_processor.h" 20 #include "ui/events/event_processor.h"
20 #include "ui/events/event_utils.h" 21 #include "ui/events/event_utils.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 251 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
251 params.native_widget = new DesktopNativeWidgetAura(widget.get()); 252 params.native_widget = new DesktopNativeWidgetAura(widget.get());
252 widget->Init(params); 253 widget->Init(params);
253 widget->Show(); 254 widget->Show();
254 255
255 // Post a task that terminates the nested loop and destroyes the widget. This 256 // Post a task that terminates the nested loop and destroyes the widget. This
256 // task will be executed from the nested loop initiated with the call to 257 // task will be executed from the nested loop initiated with the call to
257 // |RunWithDispatcher()| below. 258 // |RunWithDispatcher()| below.
258 base::RunLoop run_loop; 259 base::RunLoop run_loop;
259 base::Closure quit_runloop = run_loop.QuitClosure(); 260 base::Closure quit_runloop = run_loop.QuitClosure();
260 message_loop()->task_runner()->PostTask( 261 base::ThreadTaskRunnerHandle::Get()->PostTask(
261 FROM_HERE, 262 FROM_HERE,
262 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget), 263 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget),
263 base::Unretained(&quit_runloop))); 264 base::Unretained(&quit_runloop)));
264 run_loop.Run(); 265 run_loop.Run();
265 } 266 }
266 267
267 // This class provides functionality to create fullscreen and top level popup 268 // This class provides functionality to create fullscreen and top level popup
268 // windows. It additionally tests whether the destruction of these windows 269 // windows. It additionally tests whether the destruction of these windows
269 // occurs correctly in desktop AURA without crashing. 270 // occurs correctly in desktop AURA without crashing.
270 // It provides facilities to test the following cases:- 271 // It provides facilities to test the following cases:-
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); 677 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled);
677 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); 678 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled);
678 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); 679 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled);
679 widget.CloseNow(); 680 widget.CloseNow();
680 } 681 }
681 682
682 #endif // defined(OS_WIN) 683 #endif // defined(OS_WIN)
683 684
684 } // namespace test 685 } // namespace test
685 } // namespace views 686 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/views_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698