| 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/views/corewm/capture_controller.h" | 5 #include "ui/views/corewm/capture_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Makes sure that internal details that are set on mouse down (such as | 96 // Makes sure that internal details that are set on mouse down (such as |
| 97 // mouse_pressed_handler()) are cleared when another root window takes capture. | 97 // mouse_pressed_handler()) are cleared when another root window takes capture. |
| 98 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { | 98 TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { |
| 99 // Create a window inside the RootWindow. | 99 // Create a window inside the RootWindow. |
| 100 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL)); | 100 scoped_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL)); |
| 101 | 101 |
| 102 // Make a synthesized mouse down event. Ensure that the RootWindow will | 102 // Make a synthesized mouse down event. Ensure that the RootWindow will |
| 103 // dispatch further mouse events to |w1|. | 103 // dispatch further mouse events to |w1|. |
| 104 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), | 104 ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), |
| 105 gfx::Point(5, 5), 0); | 105 gfx::Point(5, 5), 0); |
| 106 dispatcher()->AsWindowTreeHostDelegate()->OnHostMouseEvent( | 106 dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( |
| 107 &mouse_pressed_event); | 107 &mouse_pressed_event); |
| 108 EXPECT_EQ(w1.get(), dispatcher()->mouse_pressed_handler()); | 108 EXPECT_EQ(w1.get(), dispatcher()->mouse_pressed_handler()); |
| 109 | 109 |
| 110 // Build a window in the second RootWindow. | 110 // Build a window in the second RootWindow. |
| 111 scoped_ptr<aura::Window> w2( | 111 scoped_ptr<aura::Window> w2( |
| 112 CreateNormalWindow(2, second_root_->window(), NULL)); | 112 CreateNormalWindow(2, second_root_->window(), NULL)); |
| 113 | 113 |
| 114 // The act of having the second window take capture should clear out mouse | 114 // The act of having the second window take capture should clear out mouse |
| 115 // pressed handler in the first RootWindow. | 115 // pressed handler in the first RootWindow. |
| 116 w2->SetCapture(); | 116 w2->SetCapture(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 EXPECT_EQ(static_cast<aura::Window*>(NULL), GetSecondCaptureWindow()); | 164 EXPECT_EQ(static_cast<aura::Window*>(NULL), GetSecondCaptureWindow()); |
| 165 ui::TouchEvent touch_event( | 165 ui::TouchEvent touch_event( |
| 166 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, 0, ui::EventTimeForNow(), 1.0f, | 166 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, 0, ui::EventTimeForNow(), 1.0f, |
| 167 1.0f, 1.0f, 1.0f); | 167 1.0f, 1.0f, 1.0f); |
| 168 EXPECT_EQ(static_cast<ui::GestureConsumer*>(w2.get()), | 168 EXPECT_EQ(static_cast<ui::GestureConsumer*>(w2.get()), |
| 169 ui::GestureRecognizer::Get()->GetTouchLockedTarget( | 169 ui::GestureRecognizer::Get()->GetTouchLockedTarget( |
| 170 &touch_event)); | 170 &touch_event)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace views | 173 } // namespace views |
| OLD | NEW |