| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <queue> | 5 #include <queue> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 // Sync changes to compositor. | 2513 // Sync changes to compositor. |
| 2514 ForceCompositorFrame(); | 2514 ForceCompositorFrame(); |
| 2515 | 2515 |
| 2516 aura_webview->RequestFocus(); | 2516 aura_webview->RequestFocus(); |
| 2517 // Verify that other_focusable_view can steal focus from aura_webview. | 2517 // Verify that other_focusable_view can steal focus from aura_webview. |
| 2518 EXPECT_TRUE(aura_webview->HasFocus()); | 2518 EXPECT_TRUE(aura_webview->HasFocus()); |
| 2519 other_focusable_view->RequestFocus(); | 2519 other_focusable_view->RequestFocus(); |
| 2520 EXPECT_TRUE(other_focusable_view->HasFocus()); | 2520 EXPECT_TRUE(other_focusable_view->HasFocus()); |
| 2521 EXPECT_FALSE(aura_webview->HasFocus()); | 2521 EXPECT_FALSE(aura_webview->HasFocus()); |
| 2522 | 2522 |
| 2523 // Compute location of guest within embedder so we can more accurately |
| 2524 // target our touch event. |
| 2525 gfx::Rect guest_rect = GetGuestWebContents()->GetContainerBounds(); |
| 2526 gfx::Point embedder_origin = |
| 2527 GetEmbedderWebContents()->GetContainerBounds().origin(); |
| 2528 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); |
| 2529 |
| 2523 // Generate and send synthetic touch event. | 2530 // Generate and send synthetic touch event. |
| 2524 // TODO(wjmaclean): This is fragile ... if anyone alters the location/size | |
| 2525 // of the webview in accept_touch_events then this may miss its target. | |
| 2526 FocusWaiter waiter(aura_webview); | 2531 FocusWaiter waiter(aura_webview); |
| 2527 content::SimulateTouchPressAt(GetEmbedderWebContents(), gfx::Point(10, 10)); | 2532 content::SimulateTouchPressAt(GetEmbedderWebContents(), |
| 2533 guest_rect.CenterPoint()); |
| 2528 | 2534 |
| 2529 // Wait for the TouchStart to propagate and restore focus. Test times out | 2535 // Wait for the TouchStart to propagate and restore focus. Test times out |
| 2530 // on failure. | 2536 // on failure. |
| 2531 waiter.Wait(); | 2537 waiter.Wait(); |
| 2532 } | 2538 } |
| 2533 #endif | 2539 #endif |
| OLD | NEW |