Commit 1968073e authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Make RenderViewTest not be dependent on RenderWidget.

The WebFrameWidget can be retrieved via the WebView. Move
one test that was accessing the LayerTreeHost to blink.

BUG=1097816

Change-Id: I373d6ed7ff97a3669a7d303b86944c001f5e9eac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464027
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816753}
parent 47c81eeb
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/public/web/web_view.h" #include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_widget.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
namespace autofill { namespace autofill {
...@@ -35,8 +35,8 @@ class FormControlClickDetectionTest : public ChromeRenderViewTest { ...@@ -35,8 +35,8 @@ class FormControlClickDetectionTest : public ChromeRenderViewTest {
" <input type='button' id='button'></input><br>" " <input type='button' id='button'></input><br>"
" <input type='button' id='button_2' disabled></input><br>" " <input type='button' id='button_2' disabled></input><br>"
"</form>"); "</form>");
GetWebWidget()->Resize(blink::WebSize(500, 500)); GetWebFrameWidget()->Resize(blink::WebSize(500, 500));
GetWebWidget()->SetFocus(true); GetWebFrameWidget()->SetFocus(true);
blink::WebDocument document = GetMainFrame()->GetDocument(); blink::WebDocument document = GetMainFrame()->GetDocument();
text_ = document.GetElementById("text_1"); text_ = document.GetElementById("text_1");
textarea_ = document.GetElementById("textarea_1"); textarea_ = document.GetElementById("textarea_1");
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_form_element.h" #include "third_party/blink/public/web/web_form_element.h"
#include "third_party/blink/public/web/web_widget.h" #include "third_party/blink/public/web/web_frame_widget.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -388,8 +388,8 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest { ...@@ -388,8 +388,8 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest {
LoadHTML(kFormHTML); LoadHTML(kFormHTML);
// Necessary for SimulateElementClick() to work correctly. // Necessary for SimulateElementClick() to work correctly.
GetWebWidget()->Resize(blink::WebSize(500, 500)); GetWebFrameWidget()->Resize(blink::WebSize(500, 500));
GetWebWidget()->SetFocus(true); GetWebFrameWidget()->SetFocus(true);
// Now retrieve the input elements so the test can access them. // Now retrieve the input elements so the test can access them.
UpdateUsernameAndPasswordElements(); UpdateUsernameAndPasswordElements();
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_widget.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
using autofill::mojom::FocusedFieldType; using autofill::mojom::FocusedFieldType;
...@@ -225,7 +225,7 @@ void PasswordGenerationAgentTest::SetUp() { ...@@ -225,7 +225,7 @@ void PasswordGenerationAgentTest::SetUp() {
// Necessary for focus changes to work correctly and dispatch blur events // Necessary for focus changes to work correctly and dispatch blur events
// when a field was previously focused. // when a field was previously focused.
GetWebWidget()->SetFocus(true); GetWebFrameWidget()->SetFocus(true);
} }
void PasswordGenerationAgentTest::TearDown() { void PasswordGenerationAgentTest::TearDown() {
......
...@@ -605,9 +605,7 @@ void RenderViewTest::SendNativeKeyEvent( ...@@ -605,9 +605,7 @@ void RenderViewTest::SendNativeKeyEvent(
} }
void RenderViewTest::SendInputEvent(const blink::WebInputEvent& input_event) { void RenderViewTest::SendInputEvent(const blink::WebInputEvent& input_event) {
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
RenderWidget* widget = view->GetMainRenderFrame()->GetLocalRootRenderWidget();
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(input_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(input_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
} }
...@@ -690,13 +688,11 @@ void RenderViewTest::SimulatePointClick(const gfx::Point& point) { ...@@ -690,13 +688,11 @@ void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
mouse_event.button = WebMouseEvent::Button::kLeft; mouse_event.button = WebMouseEvent::Button::kLeft;
mouse_event.SetPositionInWidget(point.x(), point.y()); mouse_event.SetPositionInWidget(point.x(), point.y());
mouse_event.click_count = 1; mouse_event.click_count = 1;
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
RenderWidget* widget = view->GetMainRenderFrame()->GetLocalRootRenderWidget();
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
mouse_event.SetType(WebInputEvent::Type::kMouseUp); mouse_event.SetType(WebInputEvent::Type::kMouseUp);
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting( GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
} }
...@@ -716,13 +712,11 @@ void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { ...@@ -716,13 +712,11 @@ void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) {
mouse_event.button = WebMouseEvent::Button::kRight; mouse_event.button = WebMouseEvent::Button::kRight;
mouse_event.SetPositionInWidget(point.x(), point.y()); mouse_event.SetPositionInWidget(point.x(), point.y());
mouse_event.click_count = 1; mouse_event.click_count = 1;
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
RenderWidget* widget = view->GetMainRenderFrame()->GetLocalRootRenderWidget();
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
mouse_event.SetType(WebInputEvent::Type::kMouseUp); mouse_event.SetType(WebInputEvent::Type::kMouseUp);
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting( GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(mouse_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
} }
...@@ -735,9 +729,7 @@ void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { ...@@ -735,9 +729,7 @@ void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) {
gesture_event.data.tap.tap_count = 1; gesture_event.data.tap.tap_count = 1;
gesture_event.data.tap.width = rect.width(); gesture_event.data.tap.width = rect.width();
gesture_event.data.tap.height = rect.height(); gesture_event.data.tap.height = rect.height();
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); GetWebFrameWidget()->ProcessInputEventSynchronouslyForTesting(
RenderWidget* widget = view->GetMainRenderFrame()->GetLocalRootRenderWidget();
widget->GetWebWidget()->ProcessInputEventSynchronouslyForTesting(
blink::WebCoalescedInputEvent(gesture_event, ui::LatencyInfo()), blink::WebCoalescedInputEvent(gesture_event, ui::LatencyInfo()),
base::DoNothing()); base::DoNothing());
} }
...@@ -772,10 +764,6 @@ void RenderViewTest::Reload(const GURL& url) { ...@@ -772,10 +764,6 @@ void RenderViewTest::Reload(const GURL& url) {
void RenderViewTest::Resize(gfx::Size new_size, void RenderViewTest::Resize(gfx::Size new_size,
bool is_fullscreen_granted) { bool is_fullscreen_granted) {
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_);
RenderWidget* render_widget =
view->GetMainRenderFrame()->GetLocalRootRenderWidget();
blink::VisualProperties visual_properties; blink::VisualProperties visual_properties;
visual_properties.screen_info = blink::ScreenInfo(); visual_properties.screen_info = blink::ScreenInfo();
visual_properties.new_size = new_size; visual_properties.new_size = new_size;
...@@ -783,7 +771,7 @@ void RenderViewTest::Resize(gfx::Size new_size, ...@@ -783,7 +771,7 @@ void RenderViewTest::Resize(gfx::Size new_size,
visual_properties.is_fullscreen_granted = is_fullscreen_granted; visual_properties.is_fullscreen_granted = is_fullscreen_granted;
visual_properties.display_mode = blink::mojom::DisplayMode::kBrowser; visual_properties.display_mode = blink::mojom::DisplayMode::kBrowser;
render_widget->GetWebWidget()->ApplyVisualProperties(visual_properties); GetWebFrameWidget()->ApplyVisualProperties(visual_properties);
} }
void RenderViewTest::SimulateUserTypingASCIICharacter(char ascii_character, void RenderViewTest::SimulateUserTypingASCIICharacter(char ascii_character,
...@@ -859,9 +847,8 @@ void RenderViewTest::SetUseZoomForDSFEnabled(bool enabled) { ...@@ -859,9 +847,8 @@ void RenderViewTest::SetUseZoomForDSFEnabled(bool enabled) {
render_thread_->SetUseZoomForDSFEnabled(enabled); render_thread_->SetUseZoomForDSFEnabled(enabled);
} }
blink::WebWidget* RenderViewTest::GetWebWidget() { blink::WebFrameWidget* RenderViewTest::GetWebFrameWidget() {
RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); return view_->GetWebView()->MainFrameWidget();
return view->GetMainRenderFrame()->GetLocalRootRenderWidget()->GetWebWidget();
} }
ContentClient* RenderViewTest::CreateContentClient() { ContentClient* RenderViewTest::CreateContentClient() {
......
...@@ -31,10 +31,10 @@ namespace scheduler { ...@@ -31,10 +31,10 @@ namespace scheduler {
class WebThreadScheduler; class WebThreadScheduler;
} }
struct VisualProperties; struct VisualProperties;
class WebFrameWidget;
class WebGestureEvent; class WebGestureEvent;
class WebInputElement; class WebInputElement;
class WebMouseEvent; class WebMouseEvent;
class WebWidget;
} }
namespace gfx { namespace gfx {
...@@ -187,7 +187,7 @@ class RenderViewTest : public testing::Test { ...@@ -187,7 +187,7 @@ class RenderViewTest : public testing::Test {
// Enables to use zoom for device scale. // Enables to use zoom for device scale.
void SetUseZoomForDSFEnabled(bool zoom_for_dsf); void SetUseZoomForDSFEnabled(bool zoom_for_dsf);
blink::WebWidget* GetWebWidget(); blink::WebFrameWidget* GetWebFrameWidget();
// Allows a subclass to override the various content client implementations. // Allows a subclass to override the various content client implementations.
virtual ContentClient* CreateContentClient(); virtual ContentClient* CreateContentClient();
......
...@@ -717,14 +717,6 @@ void RenderWidget::DidNavigate(ukm::SourceId source_id, const GURL& url) { ...@@ -717,14 +717,6 @@ void RenderWidget::DidNavigate(ukm::SourceId source_id, const GURL& url) {
} }
} }
blink::WebInputMethodController* RenderWidget::GetInputMethodController()
const {
if (auto* frame_widget = GetFrameWidget())
return frame_widget->GetActiveWebInputMethodController();
return nullptr;
}
#if BUILDFLAG(ENABLE_PLUGINS) #if BUILDFLAG(ENABLE_PLUGINS)
PepperPluginInstanceImpl* RenderWidget::GetFocusedPepperPluginInsideWidget() { PepperPluginInstanceImpl* RenderWidget::GetFocusedPepperPluginInsideWidget() {
blink::WebFrameWidget* frame_widget = GetFrameWidget(); blink::WebFrameWidget* frame_widget = GetFrameWidget();
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
namespace blink { namespace blink {
class WebFrameWidget; class WebFrameWidget;
class WebInputMethodController;
class WebLocalFrame; class WebLocalFrame;
class WebMouseEvent; class WebMouseEvent;
class WebPagePopup; class WebPagePopup;
...@@ -187,11 +186,6 @@ class CONTENT_EXPORT RenderWidget ...@@ -187,11 +186,6 @@ class CONTENT_EXPORT RenderWidget
// is true, the widget returned is a blink::WebFrameWidget. // is true, the widget returned is a blink::WebFrameWidget.
blink::WebWidget* GetWebWidget() const { return webwidget_; } blink::WebWidget* GetWebWidget() const { return webwidget_; }
// Returns the current instance of WebInputMethodController which is to be
// used for IME related tasks. This instance corresponds to the one from
// focused frame and can be nullptr.
blink::WebInputMethodController* GetInputMethodController() const;
// A main frame RenderWidget is destroyed and recreated using the same routing // A main frame RenderWidget is destroyed and recreated using the same routing
// id. So messages en route to a destroyed RenderWidget may end up being // id. So messages en route to a destroyed RenderWidget may end up being
// received by a provisional RenderWidget, even though we don't normally // received by a provisional RenderWidget, even though we don't normally
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_thread_impl.h" #include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
#include "content/renderer/render_widget.h"
#include "third_party/blink/public/common/widget/visual_properties.h" #include "third_party/blink/public/common/widget/visual_properties.h"
#include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_frame_widget.h"
...@@ -26,11 +25,6 @@ namespace content { ...@@ -26,11 +25,6 @@ namespace content {
class RenderWidgetTest : public RenderViewTest { class RenderWidgetTest : public RenderViewTest {
protected: protected:
RenderWidget* widget() {
auto* view_impl = static_cast<RenderViewImpl*>(view_);
return view_impl->GetMainRenderFrame()->GetLocalRootRenderWidget();
}
gfx::Range LastCompositionRange() { gfx::Range LastCompositionRange() {
render_widget_host_->GetWidgetInputHandler()->RequestCompositionUpdates( render_widget_host_->GetWidgetInputHandler()->RequestCompositionUpdates(
true, false); true, false);
...@@ -39,7 +33,7 @@ class RenderWidgetTest : public RenderViewTest { ...@@ -39,7 +33,7 @@ class RenderWidgetTest : public RenderViewTest {
} }
blink::WebInputMethodController* GetInputMethodController() { blink::WebInputMethodController* GetInputMethodController() {
return widget()->GetInputMethodController(); return GetWebFrameWidget()->GetActiveWebInputMethodController();
} }
void CommitText(std::string text) { void CommitText(std::string text) {
...@@ -49,7 +43,7 @@ class RenderWidgetTest : public RenderViewTest { ...@@ -49,7 +43,7 @@ class RenderWidgetTest : public RenderViewTest {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
void SetFocus(bool focused) { GetWebWidget()->SetFocus(focused); } void SetFocus(bool focused) { GetWebFrameWidget()->SetFocus(focused); }
gfx::PointF GetCenterPointOfElement(const blink::WebString& id) { gfx::PointF GetCenterPointOfElement(const blink::WebString& id) {
auto rect = auto rect =
...@@ -123,43 +117,37 @@ TEST_F(RenderWidgetTest, CompositorIdHitTestAPI) { ...@@ -123,43 +117,37 @@ TEST_F(RenderWidgetTest, CompositorIdHitTestAPI) {
// Hit the root // Hit the root
EXPECT_EQ(GetCompositorElementId(), EXPECT_EQ(GetCompositorElementId(),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(gfx::PointF(10, 10)) ->HitTestResultAt(gfx::PointF(10, 10))
.GetScrollableContainerId()); .GetScrollableContainerId());
// Hit non-scrollable div // Hit non-scrollable div
EXPECT_EQ(GetCompositorElementId(), EXPECT_EQ(GetCompositorElementId(),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("green")) ->HitTestResultAt(GetCenterPointOfElement("green"))
.GetScrollableContainerId()); .GetScrollableContainerId());
// Hit scrollable div // Hit scrollable div
EXPECT_EQ(GetCompositorElementId("red"), EXPECT_EQ(GetCompositorElementId("red"),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("red")) ->HitTestResultAt(GetCenterPointOfElement("red"))
.GetScrollableContainerId()); .GetScrollableContainerId());
// Hit overflow:hidden div // Hit overflow:hidden div
EXPECT_EQ(GetCompositorElementId(), EXPECT_EQ(GetCompositorElementId(),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("blue")) ->HitTestResultAt(GetCenterPointOfElement("blue"))
.GetScrollableContainerId()); .GetScrollableContainerId());
// Hit position fixed div // Hit position fixed div
EXPECT_EQ(GetCompositorElementId(), EXPECT_EQ(GetCompositorElementId(),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("yellow")) ->HitTestResultAt(GetCenterPointOfElement("yellow"))
.GetScrollableContainerId()); .GetScrollableContainerId());
// Hit inner scroller inside another scroller // Hit inner scroller inside another scroller
EXPECT_EQ(GetCompositorElementId("cyan"), EXPECT_EQ(GetCompositorElementId("cyan"),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("cyan-parent")) ->HitTestResultAt(GetCenterPointOfElement("cyan-parent"))
.GetScrollableContainerId()); .GetScrollableContainerId());
} }
...@@ -194,8 +182,7 @@ TEST_F(RenderWidgetTest, CompositorIdHitTestAPIWithImplicitRootScroller) { ...@@ -194,8 +182,7 @@ TEST_F(RenderWidgetTest, CompositorIdHitTestAPIWithImplicitRootScroller) {
EXPECT_EQ(GetMainFrame() EXPECT_EQ(GetMainFrame()
->GetDocument() ->GetDocument()
.GetVisualViewportScrollingElementIdForTesting(), .GetVisualViewportScrollingElementIdForTesting(),
widget() GetWebFrameWidget()
->GetWebWidget()
->HitTestResultAt(GetCenterPointOfElement("white")) ->HitTestResultAt(GetCenterPointOfElement("white"))
.GetScrollableContainerId()); .GetScrollableContainerId());
} }
...@@ -207,9 +194,9 @@ TEST_F(RenderWidgetTest, GetCompositionRangeValidComposition) { ...@@ -207,9 +194,9 @@ TEST_F(RenderWidgetTest, GetCompositionRangeValidComposition) {
gfx::Range range = LastCompositionRange(); gfx::Range range = LastCompositionRange();
EXPECT_FALSE(range.IsValid()); EXPECT_FALSE(range.IsValid());
blink::WebVector<ui::ImeTextSpan> empty_ime_text_spans; blink::WebVector<ui::ImeTextSpan> empty_ime_text_spans;
DCHECK(widget()->GetInputMethodController()); DCHECK(GetInputMethodController());
widget()->GetInputMethodController()->SetComposition( GetInputMethodController()->SetComposition("hello", empty_ime_text_spans,
"hello", empty_ime_text_spans, blink::WebRange(), 3, 3); blink::WebRange(), 3, 3);
range = LastCompositionRange(); range = LastCompositionRange();
EXPECT_TRUE(range.IsValid()); EXPECT_TRUE(range.IsValid());
EXPECT_EQ(0U, range.start()); EXPECT_EQ(0U, range.start());
...@@ -283,23 +270,4 @@ TEST_F(RenderWidgetTest, PageFocusIme) { ...@@ -283,23 +270,4 @@ TEST_F(RenderWidgetTest, PageFocusIme) {
GetInputMethodController()->TextInputInfo().value.Utf8()); GetInputMethodController()->TextInputInfo().value.Utf8());
} }
// Tests that the value of VisualProperties::is_pinch_gesture_active is
// not propagated to the LayerTreeHost when properties are synced for main
// frame.
TEST_F(RenderWidgetTest, ActivePinchGestureUpdatesLayerTreeHost) {
auto* layer_tree_host = widget()->layer_tree_host();
EXPECT_FALSE(layer_tree_host->is_external_pinch_gesture_active_for_testing());
blink::VisualProperties visual_properties;
// Sync visual properties on a mainframe RenderWidget.
visual_properties.is_pinch_gesture_active = true;
widget()->GetWebWidget()->ApplyVisualProperties(visual_properties);
// We do not expect the |is_pinch_gesture_active| value to propagate to the
// LayerTreeHost for the main-frame. Since GesturePinch events are handled
// directly by the layer tree for the main frame, it already knows whether or
// not a pinch gesture is active, and so we shouldn't propagate this
// information to the layer tree for a main-frame's widget.
EXPECT_FALSE(layer_tree_host->is_external_pinch_gesture_active_for_testing());
}
} // namespace content } // namespace content
...@@ -502,4 +502,23 @@ TEST_F(NotifySwapTimesWebFrameWidgetTest, ...@@ -502,4 +502,23 @@ TEST_F(NotifySwapTimesWebFrameWidgetTest,
testing::IsEmpty()); testing::IsEmpty());
} }
// Tests that the value of VisualProperties::is_pinch_gesture_active is
// not propagated to the LayerTreeHost when properties are synced for main
// frame.
TEST_F(WebFrameWidgetSimTest, ActivePinchGestureUpdatesLayerTreeHost) {
auto* layer_tree_host = WebView().MainFrameViewWidget()->LayerTreeHost();
EXPECT_FALSE(layer_tree_host->is_external_pinch_gesture_active_for_testing());
blink::VisualProperties visual_properties;
// Sync visual properties on a mainframe RenderWidget.
visual_properties.is_pinch_gesture_active = true;
WebView().MainFrameViewWidget()->ApplyVisualProperties(visual_properties);
// We do not expect the |is_pinch_gesture_active| value to propagate to the
// LayerTreeHost for the main-frame. Since GesturePinch events are handled
// directly by the layer tree for the main frame, it already knows whether or
// not a pinch gesture is active, and so we shouldn't propagate this
// information to the layer tree for a main-frame's widget.
EXPECT_FALSE(layer_tree_host->is_external_pinch_gesture_active_for_testing());
}
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment