| 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/event_generator.h" | 10 #include "ui/aura/test/event_generator.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 generator1.MoveMouseToCenterOf(w1->GetNativeView()); | 72 generator1.MoveMouseToCenterOf(w1->GetNativeView()); |
| 73 generator1.PressLeftButton(); | 73 generator1.PressLeftButton(); |
| 74 EXPECT_FALSE(w1->HasCapture()); | 74 EXPECT_FALSE(w1->HasCapture()); |
| 75 aura::RootWindow* w1_root = w1->GetNativeView()->GetDispatcher(); | 75 aura::RootWindow* w1_root = w1->GetNativeView()->GetDispatcher(); |
| 76 EXPECT_TRUE(w1_root->mouse_pressed_handler() != NULL); | 76 EXPECT_TRUE(w1_root->mouse_pressed_handler() != NULL); |
| 77 EXPECT_TRUE(w1_root->mouse_moved_handler() != NULL); | 77 EXPECT_TRUE(w1_root->mouse_moved_handler() != NULL); |
| 78 w2->SetCapture(w2->GetRootView()); | 78 w2->SetCapture(w2->GetRootView()); |
| 79 EXPECT_TRUE(w2->HasCapture()); | 79 EXPECT_TRUE(w2->HasCapture()); |
| 80 EXPECT_TRUE(w1_root->mouse_pressed_handler() == NULL); | 80 EXPECT_TRUE(w1_root->mouse_pressed_handler() == NULL); |
| 81 EXPECT_TRUE(w1_root->mouse_moved_handler() == NULL); | 81 EXPECT_TRUE(w1_root->mouse_moved_handler() == NULL); |
| 82 w2->ReleaseCapture(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 // Tests aura::Window capture and whether gesture events are sent to the window | 85 // Tests aura::Window capture and whether gesture events are sent to the window |
| 85 // which has capture. | 86 // which has capture. |
| 86 // The test case creates two visible widgets and sets capture to the underlying | 87 // The test case creates two visible widgets and sets capture to the underlying |
| 87 // aura::Windows one by one. It then sends a gesture event and validates whether | 88 // aura::Windows one by one. It then sends a gesture event and validates whether |
| 88 // the window which had capture receives the gesture. | 89 // the window which had capture receives the gesture. |
| 89 // TODO(sky): move this test, it should be part of ScopedCaptureClient tests. | 90 // TODO(sky): move this test, it should be part of ScopedCaptureClient tests. |
| 90 TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { | 91 TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { |
| 91 scoped_ptr<aura::client::ScreenPositionClient> desktop_position_client1; | 92 scoped_ptr<aura::client::ScreenPositionClient> desktop_position_client1; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 root2->DispatchGestureEvent(&g1); | 162 root2->DispatchGestureEvent(&g1); |
| 162 EXPECT_TRUE(v2->received_gesture_event()); | 163 EXPECT_TRUE(v2->received_gesture_event()); |
| 163 EXPECT_FALSE(v1->received_gesture_event()); | 164 EXPECT_FALSE(v1->received_gesture_event()); |
| 164 | 165 |
| 165 widget1->CloseNow(); | 166 widget1->CloseNow(); |
| 166 widget2->CloseNow(); | 167 widget2->CloseNow(); |
| 167 RunPendingMessages(); | 168 RunPendingMessages(); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace views | 171 } // namespace views |
| OLD | NEW |