| 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 "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/test/event_generator.h" | 10 #include "ui/aura/test/event_generator.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 EXPECT_FALSE(w1->HasCapture()); | 94 EXPECT_FALSE(w1->HasCapture()); |
| 95 aura::WindowEventDispatcher* w1_dispatcher = | 95 aura::WindowEventDispatcher* w1_dispatcher = |
| 96 w1->GetNativeView()->GetHost()->dispatcher(); | 96 w1->GetNativeView()->GetHost()->dispatcher(); |
| 97 EXPECT_TRUE(w1_dispatcher->mouse_pressed_handler() != NULL); | 97 EXPECT_TRUE(w1_dispatcher->mouse_pressed_handler() != NULL); |
| 98 EXPECT_TRUE(w1_dispatcher->mouse_moved_handler() != NULL); | 98 EXPECT_TRUE(w1_dispatcher->mouse_moved_handler() != NULL); |
| 99 w2->SetCapture(w2->GetRootView()); | 99 w2->SetCapture(w2->GetRootView()); |
| 100 EXPECT_TRUE(w2->HasCapture()); | 100 EXPECT_TRUE(w2->HasCapture()); |
| 101 EXPECT_TRUE(w1_dispatcher->mouse_pressed_handler() == NULL); | 101 EXPECT_TRUE(w1_dispatcher->mouse_pressed_handler() == NULL); |
| 102 EXPECT_TRUE(w1_dispatcher->mouse_moved_handler() == NULL); | 102 EXPECT_TRUE(w1_dispatcher->mouse_moved_handler() == NULL); |
| 103 w2->ReleaseCapture(); | 103 w2->ReleaseCapture(); |
| 104 RunPendingMessages(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 // Tests aura::Window capture and whether gesture events are sent to the window | 107 // Tests aura::Window capture and whether gesture events are sent to the window |
| 107 // which has capture. | 108 // which has capture. |
| 108 // The test case creates two visible widgets and sets capture to the underlying | 109 // The test case creates two visible widgets and sets capture to the underlying |
| 109 // aura::Windows one by one. It then sends a gesture event and validates whether | 110 // aura::Windows one by one. It then sends a gesture event and validates whether |
| 110 // the window which had capture receives the gesture. | 111 // the window which had capture receives the gesture. |
| 111 // TODO(sky): move this test, it should be part of ScopedCaptureClient tests. | 112 // TODO(sky): move this test, it should be part of ScopedCaptureClient tests. |
| 112 TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { | 113 TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { |
| 113 scoped_ptr<aura::client::ScreenPositionClient> desktop_position_client1; | 114 scoped_ptr<aura::client::ScreenPositionClient> desktop_position_client1; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 193 |
| 193 EXPECT_TRUE(v2->received_gesture_event()); | 194 EXPECT_TRUE(v2->received_gesture_event()); |
| 194 EXPECT_FALSE(v1->received_gesture_event()); | 195 EXPECT_FALSE(v1->received_gesture_event()); |
| 195 | 196 |
| 196 widget1->CloseNow(); | 197 widget1->CloseNow(); |
| 197 widget2->CloseNow(); | 198 widget2->CloseNow(); |
| 198 RunPendingMessages(); | 199 RunPendingMessages(); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace views | 202 } // namespace views |
| OLD | NEW |