Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1199313002: Instead of guessing, compute center point of Guest View for test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/guest_view/web_view_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 84d41e652f5cfb48b1dfe23b3af5658a2605778a..a134257cd50070390bb7e2fe286d6f8de3ba57e8 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -2520,11 +2520,17 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusTest, TouchFocusesEmbedder) {
EXPECT_TRUE(other_focusable_view->HasFocus());
EXPECT_FALSE(aura_webview->HasFocus());
+ // Compute location of guest within embedder so we can more accurately
+ // target our touch event.
+ gfx::Rect guest_rect = GetGuestWebContents()->GetContainerBounds();
+ gfx::Point embedder_origin =
+ GetEmbedderWebContents()->GetContainerBounds().origin();
+ guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y());
+
// Generate and send synthetic touch event.
- // TODO(wjmaclean): This is fragile ... if anyone alters the location/size
- // of the webview in accept_touch_events then this may miss its target.
FocusWaiter waiter(aura_webview);
- content::SimulateTouchPressAt(GetEmbedderWebContents(), gfx::Point(10, 10));
+ content::SimulateTouchPressAt(GetEmbedderWebContents(),
+ guest_rect.CenterPoint());
// Wait for the TouchStart to propagate and restore focus. Test times out
// on failure.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698