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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 2123523002: Send synthetic GestureTapDown to focus BrowserPlugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 3300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3311 } 3311 }
3312 3312
3313 content::RenderWidgetHostView* guest_host_view = 3313 content::RenderWidgetHostView* guest_host_view =
3314 guest_contents->GetRenderWidgetHostView(); 3314 guest_contents->GetRenderWidgetHostView();
3315 EXPECT_EQ(gfx::Vector2dF(), guest_host_view->GetLastScrollOffset()); 3315 EXPECT_EQ(gfx::Vector2dF(), guest_host_view->GetLastScrollOffset());
3316 3316
3317 // Send scroll gesture to guest and verify embedder scrolls. 3317 // Send scroll gesture to guest and verify embedder scrolls.
3318 // Perform a scroll gesture of the same magnitude, but in the opposite 3318 // Perform a scroll gesture of the same magnitude, but in the opposite
3319 // direction and centered over the GuestView this time. 3319 // direction and centered over the GuestView this time.
3320 guest_rect = guest_contents->GetContainerBounds(); 3320 guest_rect = guest_contents->GetContainerBounds();
3321 embedder_rect = embedder_contents->GetContainerBounds();
3322 guest_rect.set_x(guest_rect.x() - embedder_rect.x());
3323 guest_rect.set_y(guest_rect.y() - embedder_rect.y());
3324 { 3321 {
3325 gfx::Point guest_scroll_location(guest_rect.x() + guest_rect.width() / 2, 3322 gfx::Point guest_scroll_location(guest_rect.width() / 2,
3326 guest_rect.y()); 3323 guest_rect.height() / 2);
3327 3324
3328 ScrollWaiter waiter(embedder_host_view); 3325 ScrollWaiter waiter(embedder_host_view);
3329 3326
3330 content::SimulateGestureScrollSequence(embedder_contents, 3327 content::SimulateGestureScrollSequence(guest_contents,
3331 guest_scroll_location, 3328 guest_scroll_location,
3332 gfx::Vector2dF(0, gesture_distance)); 3329 gfx::Vector2dF(0, gesture_distance));
3333 3330
3334 waiter.WaitForScrollChange(gfx::Vector2dF()); 3331 waiter.WaitForScrollChange(gfx::Vector2dF());
3335 } 3332 }
3336 } 3333 }
3337 3334
3338 class WebViewScrollGuestContentTest : public WebViewTest { 3335 class WebViewScrollGuestContentTest : public WebViewTest {
3339 public: 3336 public:
3340 ~WebViewScrollGuestContentTest() override {} 3337 ~WebViewScrollGuestContentTest() override {}
(...skipping 27 matching lines...) Expand all
3368 gfx::Rect embedder_rect = embedder_contents->GetContainerBounds(); 3365 gfx::Rect embedder_rect = embedder_contents->GetContainerBounds();
3369 gfx::Rect guest_rect = guest_contents->GetContainerBounds(); 3366 gfx::Rect guest_rect = guest_contents->GetContainerBounds();
3370 guest_rect.set_x(guest_rect.x() - embedder_rect.x()); 3367 guest_rect.set_x(guest_rect.x() - embedder_rect.x());
3371 guest_rect.set_y(guest_rect.y() - embedder_rect.y()); 3368 guest_rect.set_y(guest_rect.y() - embedder_rect.y());
3372 3369
3373 content::RenderWidgetHostView* embedder_host_view = 3370 content::RenderWidgetHostView* embedder_host_view =
3374 embedder_contents->GetRenderWidgetHostView(); 3371 embedder_contents->GetRenderWidgetHostView();
3375 EXPECT_EQ(gfx::Vector2dF(), guest_host_view->GetLastScrollOffset()); 3372 EXPECT_EQ(gfx::Vector2dF(), guest_host_view->GetLastScrollOffset());
3376 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset()); 3373 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset());
3377 3374
3378 gfx::Point guest_scroll_location(guest_rect.x() + guest_rect.width() / 2, 3375 gfx::Point guest_scroll_location(guest_rect.width() / 2, 0);
3379 guest_rect.y());
3380 3376
3381 float gesture_distance = 15.f; 3377 float gesture_distance = 15.f;
3382 { 3378 {
3383 gfx::Vector2dF expected_offset(0.f, gesture_distance); 3379 gfx::Vector2dF expected_offset(0.f, gesture_distance);
3384 3380
3385 ScrollWaiter waiter(guest_host_view); 3381 ScrollWaiter waiter(guest_host_view);
3386 3382
3387 content::SimulateGestureScrollSequence( 3383 content::SimulateGestureScrollSequence(
3388 embedder_contents, guest_scroll_location, 3384 guest_contents, guest_scroll_location,
3389 gfx::Vector2dF(0, -gesture_distance)); 3385 gfx::Vector2dF(0, -gesture_distance));
3390 3386
3391 waiter.WaitForScrollChange(expected_offset); 3387 waiter.WaitForScrollChange(expected_offset);
3392 } 3388 }
3393 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset()); 3389 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset());
3394 3390
3395 // Use fling gesture to scroll back, velocity should be big enough to scroll 3391 // Use fling gesture to scroll back, velocity should be big enough to scroll
3396 // content back. 3392 // content back.
3397 float fling_velocity = 300.f; 3393 float fling_velocity = 300.f;
3398 { 3394 {
3399 ScrollWaiter waiter(guest_host_view); 3395 ScrollWaiter waiter(guest_host_view);
3400 3396
3401 content::SimulateGestureFlingSequence( 3397 content::SimulateGestureFlingSequence(
3402 embedder_contents, guest_scroll_location, 3398 guest_contents, guest_scroll_location,
3403 gfx::Vector2dF(0, fling_velocity)); 3399 gfx::Vector2dF(0, fling_velocity));
3404 3400
3405 waiter.WaitForScrollChange(gfx::Vector2dF()); 3401 waiter.WaitForScrollChange(gfx::Vector2dF());
3406 } 3402 }
3407 3403
3408 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset()); 3404 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset());
3409 } 3405 }
3410 3406
3411 #if defined(USE_AURA) 3407 #if defined(USE_AURA)
3412 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation 3408 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 gfx::Point embedder_origin = 3499 gfx::Point embedder_origin =
3504 GetEmbedderWebContents()->GetContainerBounds().origin(); 3500 GetEmbedderWebContents()->GetContainerBounds().origin();
3505 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); 3501 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y());
3506 3502
3507 // Generate and send synthetic touch event. 3503 // Generate and send synthetic touch event.
3508 content::SimulateTouchPressAt(GetEmbedderWebContents(), 3504 content::SimulateTouchPressAt(GetEmbedderWebContents(),
3509 guest_rect.CenterPoint()); 3505 guest_rect.CenterPoint());
3510 EXPECT_TRUE(aura_webview->HasFocus()); 3506 EXPECT_TRUE(aura_webview->HasFocus());
3511 } 3507 }
3512 #endif 3508 #endif
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698