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

Side by Side Diff: ash/wm/workspace/workspace_event_handler_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/workspace/workspace_event_handler.h" 5 #include "ash/wm/workspace/workspace_event_handler.h"
6 6
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "ash/wm/wm_event.h" 12 #include "ash/wm/wm_event.h"
13 #include "ash/wm/workspace_controller.h" 13 #include "ash/wm/workspace_controller.h"
14 #include "ash/wm/workspace_controller_test_helper.h" 14 #include "ash/wm/workspace_controller_test_helper.h"
15 #include "base/thread_task_runner_handle.h"
15 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/test/test_window_delegate.h" 17 #include "ui/aura/test/test_window_delegate.h"
17 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
18 #include "ui/aura/window_tree_host.h" 19 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/hit_test.h" 20 #include "ui/base/hit_test.h"
20 #include "ui/events/event_processor.h" 21 #include "ui/events/event_processor.h"
21 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
22 #include "ui/events/test/event_generator.h" 23 #include "ui/events/test/event_generator.h"
23 #include "ui/gfx/screen.h" 24 #include "ui/gfx/screen.h"
24 #include "ui/wm/core/window_util.h" 25 #include "ui/wm/core/window_util.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 447 }
447 448
448 // Verifies deleting the window while in a run loop doesn't crash. 449 // Verifies deleting the window while in a run loop doesn't crash.
449 TEST_F(WorkspaceEventHandlerTest, DeleteWhileInRunLoop) { 450 TEST_F(WorkspaceEventHandlerTest, DeleteWhileInRunLoop) {
450 aura::test::TestWindowDelegate delegate; 451 aura::test::TestWindowDelegate delegate;
451 const gfx::Rect bounds(10, 20, 30, 40); 452 const gfx::Rect bounds(10, 20, 30, 40);
452 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, bounds)); 453 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, bounds));
453 delegate.set_window_component(HTCAPTION); 454 delegate.set_window_component(HTCAPTION);
454 455
455 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); 456 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow()));
456 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); 457 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window.get());
457 aura::client::GetWindowMoveClient(window->GetRootWindow()) 458 aura::client::GetWindowMoveClient(window->GetRootWindow())
458 ->RunMoveLoop(window.release(), 459 ->RunMoveLoop(window.release(),
459 gfx::Vector2d(), 460 gfx::Vector2d(),
460 aura::client::WINDOW_MOVE_SOURCE_MOUSE); 461 aura::client::WINDOW_MOVE_SOURCE_MOUSE);
461 } 462 }
462 463
463 // Verifies that double clicking in the header does not maximize if the target 464 // Verifies that double clicking in the header does not maximize if the target
464 // component has changed. 465 // component has changed.
465 TEST_F(WorkspaceEventHandlerTest, 466 TEST_F(WorkspaceEventHandlerTest,
466 DoubleClickTwoDifferentTargetsDoesntMaximize) { 467 DoubleClickTwoDifferentTargetsDoesntMaximize) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 delegate.set_window_component(HTCAPTION); 544 delegate.set_window_component(HTCAPTION);
544 generator.PressRightButton(); 545 generator.PressRightButton();
545 generator.ReleaseRightButton(); 546 generator.ReleaseRightButton();
546 EXPECT_FALSE(window_state->IsMaximized()); 547 EXPECT_FALSE(window_state->IsMaximized());
547 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON, 548 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON,
548 ui::EF_IS_DOUBLE_CLICK); 549 ui::EF_IS_DOUBLE_CLICK);
549 EXPECT_FALSE(window_state->IsMaximized()); 550 EXPECT_FALSE(window_state->IsMaximized());
550 } 551 }
551 552
552 } // namespace ash 553 } // namespace ash
OLDNEW
« ash/accelerators/key_hold_detector.cc ('K') | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698