| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/wm/core/capture_controller.h" | 5 #include "ui/wm/core/capture_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/client/capture_delegate.h" | 8 #include "ui/aura/client/capture_delegate.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // Makes sure that internal details that are set on mouse down (such as | 93 // Makes sure that internal details that are set on mouse down (such as |
| 94 // mouse_pressed_handler()) are cleared when another root window takes capture. | 94 // mouse_pressed_handler()) are cleared when another root window takes capture. |
| 95 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { | 95 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { |
| 96 // Create a window inside the WindowEventDispatcher. | 96 // Create a window inside the WindowEventDispatcher. |
| 97 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL)); | 97 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL)); |
| 98 | 98 |
| 99 // Make a synthesized mouse down event. Ensure that the WindowEventDispatcher | 99 // Make a synthesized mouse down event. Ensure that the WindowEventDispatcher |
| 100 // will dispatch further mouse events to |w1|. | 100 // will dispatch further mouse events to |w1|. |
| 101 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), | 101 ui::MouseEvent mouse_pressed_event( |
| 102 gfx::Point(5, 5), ui::EventTimeForNow(), 0, | 102 ui::ET_MOUSE_PRESSED, gfx::PointF(5.f, 5.f), gfx::PointF(5.f, 5.f), |
| 103 0); | 103 ui::EventTimeForNow(), 0, 0); |
| 104 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); | 104 DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
| 105 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_pressed_handler()); | 105 EXPECT_EQ(w1.get(), host()->dispatcher()->mouse_pressed_handler()); |
| 106 | 106 |
| 107 // Build a window in the second WindowEventDispatcher. | 107 // Build a window in the second WindowEventDispatcher. |
| 108 scoped_ptr<aura::Window> w2( | 108 scoped_ptr<aura::Window> w2( |
| 109 CreateNormalWindow(2, second_host_->window(), NULL)); | 109 CreateNormalWindow(2, second_host_->window(), NULL)); |
| 110 | 110 |
| 111 // The act of having the second window take capture should clear out mouse | 111 // The act of having the second window take capture should clear out mouse |
| 112 // pressed handler in the first WindowEventDispatcher. | 112 // pressed handler in the first WindowEventDispatcher. |
| 113 w2->SetCapture(); | 113 w2->SetCapture(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 EXPECT_FALSE(delegate2->HasNativeCapture()); | 186 EXPECT_FALSE(delegate2->HasNativeCapture()); |
| 187 | 187 |
| 188 w->ReleaseCapture(); | 188 w->ReleaseCapture(); |
| 189 EXPECT_EQ(nullptr, GetCaptureWindow()); | 189 EXPECT_EQ(nullptr, GetCaptureWindow()); |
| 190 EXPECT_EQ(nullptr, GetSecondCaptureWindow()); | 190 EXPECT_EQ(nullptr, GetSecondCaptureWindow()); |
| 191 EXPECT_FALSE(delegate->HasNativeCapture()); | 191 EXPECT_FALSE(delegate->HasNativeCapture()); |
| 192 EXPECT_FALSE(delegate2->HasNativeCapture()); | 192 EXPECT_FALSE(delegate2->HasNativeCapture()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace wm | 195 } // namespace wm |
| OLD | NEW |