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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 1640503002: ash: Do not use MessageLoopForUI when not needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_layout.h" 10 #include "ash/display/display_layout.h"
(...skipping 19 matching lines...) Expand all
30 #include "ash/wm/window_state.h" 30 #include "ash/wm/window_state.h"
31 #include "ash/wm/window_util.h" 31 #include "ash/wm/window_util.h"
32 #include "ash/wm/wm_event.h" 32 #include "ash/wm/wm_event.h"
33 #include "base/command_line.h" 33 #include "base/command_line.h"
34 #include "base/compiler_specific.h" 34 #include "base/compiler_specific.h"
35 #include "base/memory/scoped_vector.h" 35 #include "base/memory/scoped_vector.h"
36 #include "base/run_loop.h" 36 #include "base/run_loop.h"
37 #include "base/strings/string_piece.h" 37 #include "base/strings/string_piece.h"
38 #include "base/strings/utf_string_conversions.h" 38 #include "base/strings/utf_string_conversions.h"
39 #include "base/test/user_action_tester.h" 39 #include "base/test/user_action_tester.h"
40 #include "base/thread_task_runner_handle.h"
40 #include "ui/aura/client/aura_constants.h" 41 #include "ui/aura/client/aura_constants.h"
41 #include "ui/aura/client/cursor_client.h" 42 #include "ui/aura/client/cursor_client.h"
42 #include "ui/aura/client/focus_client.h" 43 #include "ui/aura/client/focus_client.h"
43 #include "ui/aura/test/test_window_delegate.h" 44 #include "ui/aura/test/test_window_delegate.h"
44 #include "ui/aura/test/test_windows.h" 45 #include "ui/aura/test/test_windows.h"
45 #include "ui/aura/window.h" 46 #include "ui/aura/window.h"
46 #include "ui/aura/window_event_dispatcher.h" 47 #include "ui/aura/window_event_dispatcher.h"
47 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 48 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
48 #include "ui/events/event_utils.h" 49 #include "ui/events/event_utils.h"
49 #include "ui/events/test/event_generator.h" 50 #include "ui/events/test/event_generator.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 // TODO(flackr): Fix memory corruption crash when running locally (not failing 1186 // TODO(flackr): Fix memory corruption crash when running locally (not failing
1186 // on bots). See http://crbug.com/342528. 1187 // on bots). See http://crbug.com/342528.
1187 TEST_F(WindowSelectorTest, DISABLED_DragDropInProgress) { 1188 TEST_F(WindowSelectorTest, DISABLED_DragDropInProgress) {
1188 bool drag_canceled_by_test = false; 1189 bool drag_canceled_by_test = false;
1189 gfx::Rect bounds(0, 0, 400, 400); 1190 gfx::Rect bounds(0, 0, 400, 400);
1190 scoped_ptr<aura::Window> window(CreateWindow(bounds)); 1191 scoped_ptr<aura::Window> window(CreateWindow(bounds));
1191 test::ShellTestApi shell_test_api(Shell::GetInstance()); 1192 test::ShellTestApi shell_test_api(Shell::GetInstance());
1192 ash::DragDropController* drag_drop_controller = 1193 ash::DragDropController* drag_drop_controller =
1193 shell_test_api.drag_drop_controller(); 1194 shell_test_api.drag_drop_controller();
1194 ui::OSExchangeData data; 1195 ui::OSExchangeData data;
1195 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 1196 base::ThreadTaskRunnerHandle::Get()->PostTask(
1196 base::Bind(&WindowSelectorTest::ToggleOverview, 1197 FROM_HERE,
1197 base::Unretained(this))); 1198 base::Bind(&WindowSelectorTest::ToggleOverview, base::Unretained(this)));
1198 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 1199 base::ThreadTaskRunnerHandle::Get()->PostTask(
1200 FROM_HERE,
1199 base::Bind(&CancelDrag, drag_drop_controller, &drag_canceled_by_test)); 1201 base::Bind(&CancelDrag, drag_drop_controller, &drag_canceled_by_test));
1200 data.SetString(base::UTF8ToUTF16("I am being dragged")); 1202 data.SetString(base::UTF8ToUTF16("I am being dragged"));
1201 drag_drop_controller->StartDragAndDrop(data, window->GetRootWindow(), 1203 drag_drop_controller->StartDragAndDrop(data, window->GetRootWindow(),
1202 window.get(), gfx::Point(5, 5), ui::DragDropTypes::DRAG_MOVE, 1204 window.get(), gfx::Point(5, 5), ui::DragDropTypes::DRAG_MOVE,
1203 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); 1205 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
1204 RunAllPendingInMessageLoop(); 1206 RunAllPendingInMessageLoop();
1205 EXPECT_FALSE(drag_canceled_by_test); 1207 EXPECT_FALSE(drag_canceled_by_test);
1206 ASSERT_TRUE(IsSelecting()); 1208 ASSERT_TRUE(IsSelecting());
1207 RunAllPendingInMessageLoop(); 1209 RunAllPendingInMessageLoop();
1208 } 1210 }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 // Switch to overview mode. 1628 // Switch to overview mode.
1627 ToggleOverview(); 1629 ToggleOverview();
1628 ASSERT_TRUE(IsSelecting()); 1630 ASSERT_TRUE(IsSelecting());
1629 1631
1630 // Tap should now exit overview mode. 1632 // Tap should now exit overview mode.
1631 generator.GestureTapAt(point_in_background_page); 1633 generator.GestureTapAt(point_in_background_page);
1632 EXPECT_FALSE(IsSelecting()); 1634 EXPECT_FALSE(IsSelecting());
1633 } 1635 }
1634 1636
1635 } // namespace ash 1637 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698