Commit 8f34677d authored by W. James MacLean's avatar W. James MacLean Committed by Commit Bot

Test for adding gesture target that's not in map.

Bug: 824774
Change-Id: Ib6be40e0b6b7b215e64035f5ff4ae65531ce7198
Reviewed-on: https://chromium-review.googlesource.com/996433Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548311}
parent 94508bff
...@@ -1072,6 +1072,24 @@ RenderWidgetHostInputEventRouter::FindTouchscreenGestureEventTarget( ...@@ -1072,6 +1072,24 @@ RenderWidgetHostInputEventRouter::FindTouchscreenGestureEventTarget(
return {nullptr, false, base::nullopt}; return {nullptr, false, base::nullopt};
} }
// TODO(wjmaclean): Remove this when no longer needed. https://crbug.com/824774
void RenderWidgetHostInputEventRouter::VerifyViewInMap(
RenderWidgetHostViewBase* view,
std::string src) const {
for (const auto& entry : owner_map_) {
if (entry.second == view)
return;
}
static auto* ptr_key = base::debug::AllocateCrashKeyString(
"not-in-map-view-ptr", base::debug::CrashKeySize::Size64);
base::debug::ScopedCrashKeyString(ptr_key, base::StringPrintf("%p", view));
static auto* src_key = base::debug::AllocateCrashKeyString(
"not-in-map-view-src", base::debug::CrashKeySize::Size64);
base::debug::ScopedCrashKeyString device_key_value(src_key, src);
base::debug::DumpWithoutCrashing();
}
void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent( void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent(
RenderWidgetHostViewBase* root_view, RenderWidgetHostViewBase* root_view,
RenderWidgetHostViewBase* target, RenderWidgetHostViewBase* target,
...@@ -1139,6 +1157,7 @@ void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent( ...@@ -1139,6 +1157,7 @@ void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent(
// created by ContentView. These will use the target found by the // created by ContentView. These will use the target found by the
// RenderWidgetTargeter. These gesture events should always have a // RenderWidgetTargeter. These gesture events should always have a
// unique_touch_event_id of 0. // unique_touch_event_id of 0.
VerifyViewInMap(target, "unique_touch_event_id == 0");
touchscreen_gesture_target_.target = target; touchscreen_gesture_target_.target = target;
base::debug::SetCrashKeyString(target_source_key, "touch_id=0"); base::debug::SetCrashKeyString(target_source_key, "touch_id=0");
DCHECK(target_location.has_value()); DCHECK(target_location.has_value());
...@@ -1164,10 +1183,13 @@ void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent( ...@@ -1164,10 +1183,13 @@ void RenderWidgetHostInputEventRouter::DispatchTouchscreenGestureEvent(
// Re https://crbug.com/796656): Since we are already in an error case, // Re https://crbug.com/796656): Since we are already in an error case,
// don't worry about the fact we're ignoring |result.should_query_view|, as // don't worry about the fact we're ignoring |result.should_query_view|, as
// this is the best we can do until we fix https://crbug.com/595422. // this is the best we can do until we fix https://crbug.com/595422.
// Since we synchronously found this target, assume it's in the map.
touchscreen_gesture_target_.target = result.view; touchscreen_gesture_target_.target = result.view;
base::debug::SetCrashKeyString(target_source_key, "no_matching_id"); base::debug::SetCrashKeyString(target_source_key, "no_matching_id");
touchscreen_gesture_target_.delta = transformed_point - original_point; touchscreen_gesture_target_.delta = transformed_point - original_point;
} else if (is_gesture_start) { } else if (is_gesture_start) {
VerifyViewInMap(gesture_target_it->second.target, "is_gesture_start");
touchscreen_gesture_target_ = gesture_target_it->second; touchscreen_gesture_target_ = gesture_target_it->second;
touchscreen_gesture_target_map_.erase(gesture_target_it); touchscreen_gesture_target_map_.erase(gesture_target_it);
......
...@@ -216,6 +216,7 @@ class CONTENT_EXPORT RenderWidgetHostInputEventRouter ...@@ -216,6 +216,7 @@ class CONTENT_EXPORT RenderWidgetHostInputEventRouter
const ui::LatencyInfo& latency, const ui::LatencyInfo& latency,
const base::Optional<gfx::PointF>& target_location); const base::Optional<gfx::PointF>& target_location);
// Assumes |gesture_event| has coordinates in root view's coordinate space. // Assumes |gesture_event| has coordinates in root view's coordinate space.
void VerifyViewInMap(RenderWidgetHostViewBase* view, std::string src) const;
void DispatchTouchscreenGestureEvent( void DispatchTouchscreenGestureEvent(
RenderWidgetHostViewBase* root_view, RenderWidgetHostViewBase* root_view,
RenderWidgetHostViewBase* target, RenderWidgetHostViewBase* target,
......
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