Commit e7bc88c2 authored by James Cook's avatar James Cook Committed by Commit Bot

Remove SystemEventRewriter::ScopedAllow from site-per-process tests

This was added to support the mash/mustash project, which was shut down
over a year ago. This CL is a partial revert of:

https://chromium-review.googlesource.com/c/chromium/src/+/1292400

Bug: none
Change-Id: I0306b48d8b8d0c0229238481fb9e8b20f5eb60d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210733
Commit-Queue: Ken Buchanan <kenrb@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771627}
parent 4768f51d
...@@ -650,28 +650,6 @@ class SetMouseCaptureInterceptor ...@@ -650,28 +650,6 @@ class SetMouseCaptureInterceptor
// that might otherwise cause unpredictable behaviour in tests. // that might otherwise cause unpredictable behaviour in tests.
class SystemEventRewriter : public ui::EventRewriter { class SystemEventRewriter : public ui::EventRewriter {
public: public:
// Helper class to allow events to pass through for the lifetime of the
// object. Use this when tests generate events. This is needed under mash
// because the generate events reach SystemEventRewriter and will be dropped
// if there is no ScopedAllow instance.
// Note that allowing system events can cause flakiness in browser tests that
// don't expect them.
class ScopedAllow {
public:
explicit ScopedAllow(SystemEventRewriter* rewriter) : rewriter_(rewriter) {
++rewriter_->num_of_scoped_allows_;
}
~ScopedAllow() {
DCHECK_GT(rewriter_->num_of_scoped_allows_, 0);
--rewriter_->num_of_scoped_allows_;
}
private:
SystemEventRewriter* const rewriter_;
DISALLOW_COPY_AND_ASSIGN(ScopedAllow);
};
SystemEventRewriter() = default; SystemEventRewriter() = default;
~SystemEventRewriter() override = default; ~SystemEventRewriter() override = default;
...@@ -679,14 +657,9 @@ class SystemEventRewriter : public ui::EventRewriter { ...@@ -679,14 +657,9 @@ class SystemEventRewriter : public ui::EventRewriter {
ui::EventDispatchDetails RewriteEvent( ui::EventDispatchDetails RewriteEvent(
const ui::Event& event, const ui::Event& event,
const Continuation continuation) override { const Continuation continuation) override {
return num_of_scoped_allows_ ? SendEvent(continuation, &event) return DiscardEvent(continuation);
: DiscardEvent(continuation);
} }
// Count of ScopedAllow objects. When it is greater than 0, events are allowed
// to pass. Otherwise, they are discarded.
int num_of_scoped_allows_ = 0;
DISALLOW_COPY_AND_ASSIGN(SystemEventRewriter); DISALLOW_COPY_AND_ASSIGN(SystemEventRewriter);
}; };
#endif #endif
...@@ -4846,10 +4819,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest, ...@@ -4846,10 +4819,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest,
InputEventAckWaiter ack_waiter(child_frame_host->GetRenderWidgetHost(), InputEventAckWaiter ack_waiter(child_frame_host->GetRenderWidgetHost(),
blink::WebInputEvent::Type::kGestureTap); blink::WebInputEvent::Type::kGestureTap);
#if defined(USE_AURA)
// Allows the gesture events to go through under mash.
SystemEventRewriter::ScopedAllow scoped_allow(&event_rewriter_);
#endif
render_widget_host->QueueSyntheticGesture( render_widget_host->QueueSyntheticGesture(
std::move(gesture), base::BindOnce([](SyntheticGesture::Result result) { std::move(gesture), base::BindOnce([](SyntheticGesture::Result result) {
EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result); EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result);
......
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