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

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

Issue 2815823003: Notify OverscrollController of gesture events in plugins. (Closed)
Patch Set: Address comments. Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm » ('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 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after
3986 guest_contents, guest_scroll_location, 3986 guest_contents, guest_scroll_location,
3987 gfx::Vector2dF(0, fling_velocity)); 3987 gfx::Vector2dF(0, fling_velocity));
3988 3988
3989 waiter.WaitForScrollChange(gfx::Vector2dF()); 3989 waiter.WaitForScrollChange(gfx::Vector2dF());
3990 } 3990 }
3991 3991
3992 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset()); 3992 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset());
3993 } 3993 }
3994 3994
3995 #if defined(USE_AURA) 3995 #if defined(USE_AURA)
3996 // This verifies the fix for crbug.com/694393 .
3997 IN_PROC_BROWSER_TEST_P(WebViewScrollGuestContentTest,
3998 OverscrollControllerSeesConsumedScrollsInGuest) {
3999 // This test is only relevant for non-OOPIF WebView as OOPIF-based WebView
4000 // uses different scroll bubbling logic.
4001 DCHECK(
4002 !base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames));
4003
4004 LoadAppWithGuest("web_view/scrollable_embedder_and_guest");
4005
4006 content::WebContents* embedder_contents = GetEmbedderWebContents();
4007
4008 std::vector<content::WebContents*> guest_web_contents_list;
4009 GetGuestViewManager()->WaitForNumGuestsCreated(1u);
4010 GetGuestViewManager()->GetGuestWebContentsList(&guest_web_contents_list);
4011 ASSERT_EQ(1u, guest_web_contents_list.size());
4012
4013 content::WebContents* guest_contents = guest_web_contents_list[0];
4014 content::RenderWidgetHostView* guest_host_view =
4015 guest_contents->GetRenderWidgetHostView();
4016
4017 gfx::Rect embedder_rect = embedder_contents->GetContainerBounds();
4018 gfx::Rect guest_rect = guest_contents->GetContainerBounds();
4019 guest_rect.set_x(guest_rect.x() - embedder_rect.x());
4020 guest_rect.set_y(guest_rect.y() - embedder_rect.y());
4021
4022 content::RenderWidgetHostView* embedder_host_view =
4023 embedder_contents->GetRenderWidgetHostView();
4024 EXPECT_EQ(gfx::Vector2dF(), guest_host_view->GetLastScrollOffset());
4025 EXPECT_EQ(gfx::Vector2dF(), embedder_host_view->GetLastScrollOffset());
4026
4027 // If we scroll the guest, the OverscrollController for the
4028 // RenderWidgetHostViewAura should see that the scroll was consumed.
4029 // If it doesn't, this test will time out indicating failure.
4030 content::MockOverscrollController* mock_overscroll_controller =
4031 content::MockOverscrollController::Create(embedder_host_view);
4032
4033 gfx::Point guest_scroll_location(guest_rect.width() / 2, 0);
4034 float gesture_distance = 15.f;
4035 // It's sufficient to scroll vertically, since all we need to test is that
4036 // the OverscrollController sees consumed scrolls.
4037 content::SimulateGestureScrollSequence(guest_contents, guest_scroll_location,
4038 gfx::Vector2dF(0, -gesture_distance));
4039
4040 mock_overscroll_controller->WaitForConsumedScroll();
4041 }
4042 #endif
4043
4044 #if defined(USE_AURA)
3996 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation 4045 // TODO(wjmaclean): when WebViewTest is re-enabled on the site-isolation
3997 // bots, then re-enable this test class as well. 4046 // bots, then re-enable this test class as well.
3998 // https://crbug.com/503751 4047 // https://crbug.com/503751
3999 class WebViewFocusTest : public WebViewTest { 4048 class WebViewFocusTest : public WebViewTest {
4000 public: 4049 public:
4001 ~WebViewFocusTest() override {} 4050 ~WebViewFocusTest() override {}
4002 4051
4003 void SetUpCommandLine(base::CommandLine* command_line) override { 4052 void SetUpCommandLine(base::CommandLine* command_line) override {
4004 WebViewTest::SetUpCommandLine(command_line); 4053 WebViewTest::SetUpCommandLine(command_line);
4005 4054
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 ClosingChromeSignInShouldNotCrash) { 4184 ClosingChromeSignInShouldNotCrash) {
4136 GURL signin_url{"chrome://chrome-signin"}; 4185 GURL signin_url{"chrome://chrome-signin"};
4137 4186
4138 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); 4187 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
4139 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); 4188 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
4140 WaitForWebViewInDom(); 4189 WaitForWebViewInDom();
4141 4190
4142 chrome::CloseTab(browser()); 4191 chrome::CloseTab(browser());
4143 } 4192 }
4144 #endif 4193 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698