Index: ui/wm/core/focus_controller_unittest.cc |
diff --git a/ui/wm/core/focus_controller_unittest.cc b/ui/wm/core/focus_controller_unittest.cc |
index 6cb5604b8eefa3d859a2c22bcce69fdc2e32185a..a773821daad586dee163547eaa8c5da26c4ea46f 100644 |
--- a/ui/wm/core/focus_controller_unittest.cc |
+++ b/ui/wm/core/focus_controller_unittest.cc |
@@ -472,7 +472,7 @@ class FocusControllerTestBase : public aura::test::AuraTestBase { |
virtual void ShiftFocusOnActivation() {} |
virtual void ShiftFocusOnActivationDueToHide() {} |
virtual void NoShiftActiveOnActivation() {} |
- virtual void NoFocusChangeOnClickOnCaptureWindow() {} |
+ virtual void FocusChangeDuringDrag() {} |
virtual void ChangeFocusWhenNothingFocusedAndCaptured() {} |
virtual void DontPassDeletedWindow() {} |
virtual void FocusedTextInputClient() {} |
@@ -752,24 +752,35 @@ class FocusControllerDirectTestBase : public FocusControllerTestBase { |
// from being made in response to an activation change notification. |
} |
- void NoFocusChangeOnClickOnCaptureWindow() override { |
+ void FocusChangeDuringDrag() override { |
scoped_ptr<aura::client::DefaultCaptureClient> capture_client( |
new aura::client::DefaultCaptureClient(root_window())); |
- // Clicking on a window which has capture should not cause a focus change |
- // to the window. This test verifies whether that is indeed the case. |
+ // Activating an inactive window during drag should activate the window. |
+ // This emulates the behavior of tab dragging which is merged into the |
+ // window below. |
ActivateWindowById(1); |
EXPECT_EQ(1, GetActiveWindowId()); |
EXPECT_EQ(1, GetFocusedWindowId()); |
aura::Window* w2 = root_window()->GetChildById(2); |
- aura::client::GetCaptureClient(root_window())->SetCapture(w2); |
ui::test::EventGenerator generator(root_window(), w2); |
- generator.ClickLeftButton(); |
+ generator.PressLeftButton(); |
+ aura::client::GetCaptureClient(root_window())->SetCapture(w2); |
+ EXPECT_EQ(2, GetActiveWindowId()); |
+ EXPECT_EQ(2, GetFocusedWindowId()); |
+ generator.MoveMouseTo(gfx::Point(0, 0)); |
+ // Emulate the behavior of merging a tab into an inactive window: |
+ // transferring the mouse capture and activate the window. |
+ aura::Window* w1 = root_window()->GetChildById(1); |
+ aura::client::GetCaptureClient(root_window())->SetCapture(w1); |
+ aura::client::GetActivationClient(root_window())->ActivateWindow(w1); |
EXPECT_EQ(1, GetActiveWindowId()); |
EXPECT_EQ(1, GetFocusedWindowId()); |
- aura::client::GetCaptureClient(root_window())->ReleaseCapture(w2); |
+ |
+ generator.ReleaseLeftButton(); |
+ aura::client::GetCaptureClient(root_window())->ReleaseCapture(w1); |
} |
// Verifies focus change is honored while capture held. |
@@ -1256,8 +1267,7 @@ DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivation); |
DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivationDueToHide); |
DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); |
-// Clicking on a window which has capture should not result in a focus change. |
-DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); |
+FOCUS_CONTROLLER_TEST(FocusControllerApiTest, FocusChangeDuringDrag); |
FOCUS_CONTROLLER_TEST(FocusControllerApiTest, |
ChangeFocusWhenNothingFocusedAndCaptured); |