Commit 4a2ebc8d authored by chaopeng's avatar chaopeng Committed by Commit Bot

Set TouchStartExpectedSoon only after we seen a blocking event

This issue is causing by:

1. MainThreadScheduler set TouchStartExpectedSoon based on the gesture event
   sequence when page has touchstart event handler
2. Scroll latching makes mouse wheels to gesture events.

We change it the check from page has touchstart event handler to we actually
cc blocking event. In the issue case, page has touchstart event handler but no
wheel event handler, user scroll with wheel will not cause a cc blocking event
so it would not block the network request.

We also change TouchStartExpectedSoon to BlockingInputExpectedSoon.

Bug: 828235
Change-Id: Iefff163ca091f2761542a527e2c4432bc1078f4c
Reviewed-on: https://chromium-review.googlesource.com/1075719
Commit-Queue: Jianpeng Chao <chaopeng@chromium.org>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568614}
parent 4091aa04
......@@ -24,6 +24,8 @@
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/page/launching_process_state.h"
#include "third_party/blink/public/platform/scheduler/renderer_process_type.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/blink/public/platform/web_touch_event.h"
#include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/blink_resource_coordinator_base.h"
#include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/renderer_resource_coordinator.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
......@@ -237,6 +239,22 @@ bool IsUnconditionalHighPriorityInputEnabled() {
return base::FeatureList::IsEnabled(kHighPriorityInput);
}
bool IsBlockingEvent(const blink::WebInputEvent& web_input_event) {
blink::WebInputEvent::Type type = web_input_event.GetType();
DCHECK(type == blink::WebInputEvent::kTouchStart ||
type == blink::WebInputEvent::kMouseWheel);
if (type == blink::WebInputEvent::kTouchStart) {
const WebTouchEvent& touch_event =
static_cast<const WebTouchEvent&>(web_input_event);
return touch_event.dispatch_type == blink::WebInputEvent::kBlocking;
}
const WebMouseWheelEvent& mouse_event =
static_cast<const WebMouseWheelEvent&>(web_input_event);
return mouse_event.dispatch_type == blink::WebInputEvent::kBlocking;
}
} // namespace
MainThreadSchedulerImpl::MainThreadSchedulerImpl(
......@@ -459,11 +477,12 @@ MainThreadSchedulerImpl::MainThreadOnly::MainThreadOnly(
main_thread_scheduler_impl,
&main_thread_scheduler_impl->tracing_controller_,
YesNoStateToString),
touchstart_expected_soon(false,
"Scheduler.TouchstartExpectedSoon",
main_thread_scheduler_impl,
&main_thread_scheduler_impl->tracing_controller_,
YesNoStateToString),
blocking_input_expected_soon(
false,
"Scheduler.BlockingInputExpectedSoon",
main_thread_scheduler_impl,
&main_thread_scheduler_impl->tracing_controller_,
YesNoStateToString),
have_seen_a_begin_main_frame(
false,
"Scheduler.HasSeenBeginMainFrame",
......@@ -587,9 +606,9 @@ MainThreadSchedulerImpl::AnyThread::AnyThread(
main_thread_scheduler_impl,
&main_thread_scheduler_impl->tracing_controller_,
YesNoStateToString),
have_seen_a_potentially_blocking_gesture(
have_seen_a_blocking_gesture(
false,
"Scheduler.HaveSeenPotentiallyBlockingGesture",
"Scheduler.HaveSeenBlockingGesture",
main_thread_scheduler_impl,
&main_thread_scheduler_impl->tracing_controller_,
YesNoStateToString),
......@@ -1060,6 +1079,12 @@ bool MainThreadSchedulerImpl::PolicyNeedsUpdateForTesting() {
return policy_may_need_update_.IsSet();
}
void MainThreadSchedulerImpl::SetHaveSeenABlockingGestureForTesting(
bool status) {
base::AutoLock lock(any_thread_lock_);
any_thread().have_seen_a_blocking_gesture = status;
}
// static
bool MainThreadSchedulerImpl::ShouldPrioritizeInputEvent(
const blink::WebInputEvent& web_input_event) {
......@@ -1092,7 +1117,7 @@ void MainThreadSchedulerImpl::DidHandleInputEventOnCompositorThread(
if (!ShouldPrioritizeInputEvent(web_input_event))
return;
UpdateForInputEventOnCompositorThread(web_input_event.GetType(), event_state);
UpdateForInputEventOnCompositorThread(web_input_event, event_state);
}
void MainThreadSchedulerImpl::DidAnimateForInputOnCompositorThread() {
......@@ -1105,11 +1130,13 @@ void MainThreadSchedulerImpl::DidAnimateForInputOnCompositorThread() {
}
void MainThreadSchedulerImpl::UpdateForInputEventOnCompositorThread(
blink::WebInputEvent::Type type,
const blink::WebInputEvent& web_input_event,
InputEventState input_event_state) {
base::AutoLock lock(any_thread_lock_);
base::TimeTicks now = helper_.NowTicks();
blink::WebInputEvent::Type type = web_input_event.GetType();
// TODO(alexclarke): Move WebInputEventTraits where we can access it from here
// and record the name rather than the integer representation.
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
......@@ -1136,12 +1163,13 @@ void MainThreadSchedulerImpl::UpdateForInputEventOnCompositorThread(
// |last_gesture_was_compositor_driven| to the default. We don't know
// yet where the gesture will run.
any_thread().last_gesture_was_compositor_driven = false;
any_thread().have_seen_a_potentially_blocking_gesture = true;
// Assume the default gesture is prevented until we see evidence
// otherwise.
any_thread().default_gesture_prevented = true;
break;
if (IsBlockingEvent(web_input_event))
any_thread().have_seen_a_blocking_gesture = true;
break;
case blink::WebInputEvent::kTouchMove:
// Observation of consecutive touchmoves is a strong signal that the
// page is consuming the touch sequence, in which case touchstart
......@@ -1194,13 +1222,13 @@ void MainThreadSchedulerImpl::UpdateForInputEventOnCompositorThread(
any_thread().last_gesture_was_compositor_driven =
input_event_state == InputEventState::EVENT_CONSUMED_BY_COMPOSITOR;
any_thread().awaiting_touch_start_response = false;
any_thread().have_seen_a_potentially_blocking_gesture = true;
// If the event was sent to the main thread, assume the default gesture is
// prevented until we see evidence otherwise.
any_thread().default_gesture_prevented =
!any_thread().last_gesture_was_compositor_driven;
if (IsBlockingEvent(web_input_event))
any_thread().have_seen_a_blocking_gesture = true;
break;
case blink::WebInputEvent::kUndefined:
break;
......@@ -1252,7 +1280,7 @@ bool MainThreadSchedulerImpl::IsHighPriorityWorkAnticipated() {
// The touchstart, synchronized gesture and main-thread gesture use cases
// indicate a strong likelihood of high-priority work in the near future.
UseCase use_case = main_thread_only().current_use_case;
return main_thread_only().touchstart_expected_soon ||
return main_thread_only().blocking_input_expected_soon ||
use_case == UseCase::kTouchstart ||
use_case == UseCase::kMainThreadGesture ||
use_case == UseCase::kMainThreadCustomInputHandling ||
......@@ -1273,13 +1301,13 @@ bool MainThreadSchedulerImpl::ShouldYieldForHighPriorityWork() {
switch (main_thread_only().current_use_case) {
case UseCase::kCompositorGesture:
case UseCase::kNone:
return main_thread_only().touchstart_expected_soon;
return main_thread_only().blocking_input_expected_soon;
case UseCase::kMainThreadGesture:
case UseCase::kMainThreadCustomInputHandling:
case UseCase::kSynchronizedGesture:
return compositor_task_queue_->HasTaskToRunImmediately() ||
main_thread_only().touchstart_expected_soon;
main_thread_only().blocking_input_expected_soon;
case UseCase::kTouchstart:
return true;
......@@ -1349,15 +1377,14 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
main_thread_only().current_use_case =
ComputeCurrentUseCase(now, &expected_use_case_duration);
base::TimeDelta touchstart_expected_flag_valid_for_duration;
// TODO(skyostil): Consider handlers for all types of blocking gestures (e.g.,
// mouse wheel) instead of just touchstart.
bool touchstart_expected_soon = false;
if (main_thread_only().has_visible_render_widget_with_touch_handler) {
touchstart_expected_soon = any_thread().user_model.IsGestureExpectedSoon(
now, &touchstart_expected_flag_valid_for_duration);
base::TimeDelta gesture_expected_flag_valid_for_duration;
main_thread_only().blocking_input_expected_soon = false;
if (any_thread().have_seen_a_blocking_gesture) {
main_thread_only().blocking_input_expected_soon =
any_thread().user_model.IsGestureExpectedSoon(
now, &gesture_expected_flag_valid_for_duration);
}
main_thread_only().touchstart_expected_soon = touchstart_expected_soon;
base::TimeDelta longest_jank_free_task_duration =
EstimateLongestJankFreeTaskDuration();
......@@ -1381,13 +1408,13 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
loading_tasks_seem_expensive;
// The |new_policy_duration| is the minimum of |expected_use_case_duration|
// and |touchstart_expected_flag_valid_for_duration| unless one is zero in
// and |gesture_expected_flag_valid_for_duration| unless one is zero in
// which case we choose the other.
base::TimeDelta new_policy_duration = expected_use_case_duration;
if (new_policy_duration.is_zero() ||
(touchstart_expected_flag_valid_for_duration > base::TimeDelta() &&
new_policy_duration > touchstart_expected_flag_valid_for_duration)) {
new_policy_duration = touchstart_expected_flag_valid_for_duration;
(gesture_expected_flag_valid_for_duration > base::TimeDelta() &&
new_policy_duration > gesture_expected_flag_valid_for_duration)) {
new_policy_duration = gesture_expected_flag_valid_for_duration;
}
if (new_policy_duration > base::TimeDelta()) {
......@@ -1414,7 +1441,7 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
switch (new_policy.use_case()) {
case UseCase::kCompositorGesture:
if (touchstart_expected_soon) {
if (main_thread_only().blocking_input_expected_soon) {
new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE;
expensive_task_policy = ExpensiveTaskPolicy::kBlock;
new_policy.compositor_priority() =
......@@ -1433,7 +1460,7 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
new_policy.compositor_priority() = main_thread_compositing_is_fast
? TaskQueue::kHighestPriority
: TaskQueue::kNormalPriority;
if (touchstart_expected_soon) {
if (main_thread_only().blocking_input_expected_soon) {
new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE;
expensive_task_policy = ExpensiveTaskPolicy::kBlock;
} else {
......@@ -1459,7 +1486,7 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
// handling over other tasks.
new_policy.compositor_priority() =
TaskQueue::QueuePriority::kHighestPriority;
if (touchstart_expected_soon) {
if (main_thread_only().blocking_input_expected_soon) {
new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE;
expensive_task_policy = ExpensiveTaskPolicy::kBlock;
} else {
......@@ -1480,7 +1507,7 @@ void MainThreadSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) {
case UseCase::kNone:
// It's only safe to block tasks that if we are expecting a compositor
// driven gesture.
if (touchstart_expected_soon &&
if (main_thread_only().blocking_input_expected_soon &&
any_thread().last_gesture_was_compositor_driven) {
new_policy.rail_mode() = v8::PERFORMANCE_RESPONSE;
expensive_task_policy = ExpensiveTaskPolicy::kBlock;
......@@ -2023,8 +2050,8 @@ MainThreadSchedulerImpl::AsValueLocked(base::TimeTicks optional_now) const {
state->SetBoolean(
"compositor_will_send_main_frame_not_expected",
main_thread_only().compositor_will_send_main_frame_not_expected);
state->SetBoolean("touchstart_expected_soon",
main_thread_only().touchstart_expected_soon);
state->SetBoolean("blocking_input_expected_soon",
main_thread_only().blocking_input_expected_soon);
state->SetString("idle_period_state",
IdleHelper::IdlePeriodStateToString(
idle_helper_.SchedulerIdlePeriodState()));
......@@ -2273,7 +2300,7 @@ void MainThreadSchedulerImpl::ResetForNavigationLocked() {
helper_.CheckOnValidThread();
any_thread_lock_.AssertAcquired();
any_thread().user_model.Reset(helper_.NowTicks());
any_thread().have_seen_a_potentially_blocking_gesture = false;
any_thread().have_seen_a_blocking_gesture = false;
any_thread().waiting_for_meaningful_paint = true;
any_thread().have_seen_input_since_navigation = false;
main_thread_only().loading_task_cost_estimator.Clear();
......
......@@ -343,6 +343,8 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl
main_thread_only().current_use_case = use_case;
}
void SetHaveSeenABlockingGestureForTesting(bool status);
private:
friend class WebRenderWidgetSchedulingState;
friend class MainThreadMetricsHelper;
......@@ -602,7 +604,7 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl
std::unique_ptr<base::SingleSampleMetric> CreateMaxQueueingTimeMetric();
// An input event of some sort happened, the policy may need updating.
void UpdateForInputEventOnCompositorThread(WebInputEvent::Type type,
void UpdateForInputEventOnCompositorThread(const WebInputEvent& event,
InputEventState input_event_state);
// The task cost estimators and the UserModel need to be reset upon page
......@@ -763,7 +765,8 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl
timer_task_estimated_cost;
TraceableState<bool, kTracingCategoryNameInfo> loading_tasks_seem_expensive;
TraceableState<bool, kTracingCategoryNameInfo> timer_tasks_seem_expensive;
TraceableState<bool, kTracingCategoryNameDefault> touchstart_expected_soon;
TraceableState<bool, kTracingCategoryNameDefault>
blocking_input_expected_soon;
TraceableState<bool, kTracingCategoryNameDebug>
have_seen_a_begin_main_frame;
TraceableState<bool, kTracingCategoryNameDebug>
......@@ -837,8 +840,7 @@ class PLATFORM_EXPORT MainThreadSchedulerImpl
TraceableState<bool, kTracingCategoryNameInfo>
last_gesture_was_compositor_driven;
TraceableState<bool, kTracingCategoryNameInfo> default_gesture_prevented;
TraceableState<bool, kTracingCategoryNameInfo>
have_seen_a_potentially_blocking_gesture;
TraceableState<bool, kTracingCategoryNameInfo> have_seen_a_blocking_gesture;
TraceableState<bool, kTracingCategoryNameInfo> waiting_for_meaningful_paint;
TraceableState<bool, kTracingCategoryNameInfo>
have_seen_input_since_navigation;
......
......@@ -21,6 +21,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/page/launching_process_state.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/blink/public/platform/web_touch_event.h"
#include "third_party/blink/renderer/platform/scheduler/base/real_time_domain.h"
#include "third_party/blink/renderer/platform/scheduler/base/test/task_queue_manager_for_test.h"
#include "third_party/blink/renderer/platform/scheduler/child/features.h"
......@@ -49,6 +51,30 @@ class FakeInputEvent : public blink::WebInputEvent {
WebInputEvent::GetStaticTimeStampForTests()) {}
};
class FakeTouchEvent : public blink::WebTouchEvent {
public:
explicit FakeTouchEvent(
blink::WebInputEvent::Type event_type,
DispatchType dispatch_type = blink::WebInputEvent::kBlocking)
: WebTouchEvent(event_type,
WebInputEvent::kNoModifiers,
WebInputEvent::GetStaticTimeStampForTests()) {
this->dispatch_type = dispatch_type;
}
};
class FakeMouseWheelEvent : public blink::WebMouseWheelEvent {
public:
explicit FakeMouseWheelEvent(
blink::WebInputEvent::Type event_type,
DispatchType dispatch_type = blink::WebInputEvent::kBlocking)
: WebMouseWheelEvent(event_type,
WebInputEvent::kNoModifiers,
WebInputEvent::GetStaticTimeStampForTests()) {
this->dispatch_type = dispatch_type;
}
};
void AppendToVectorTestTask(std::vector<std::string>* vector,
std::string value) {
vector->push_back(value);
......@@ -167,7 +193,7 @@ void AnticipationTestTask(MainThreadSchedulerImpl* scheduler,
case SimulateInputType::kTouchStart:
scheduler->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
break;
......@@ -204,6 +230,7 @@ class MainThreadSchedulerImplForTest : public MainThreadSchedulerImpl {
using MainThreadSchedulerImpl::OnPendingTasksChanged;
using MainThreadSchedulerImpl::V8TaskQueue;
using MainThreadSchedulerImpl::VirtualTimeControlTaskQueue;
using MainThreadSchedulerImpl::SetHaveSeenABlockingGestureForTesting;
MainThreadSchedulerImplForTest(
std::unique_ptr<base::sequence_manager::SequenceManager> manager,
......@@ -217,8 +244,8 @@ class MainThreadSchedulerImplForTest : public MainThreadSchedulerImpl {
std::string use_case = MainThreadSchedulerImpl::UseCaseToString(
main_thread_only().current_use_case);
if (main_thread_only().touchstart_expected_soon) {
use_cases_.push_back(use_case + " touchstart expected");
if (main_thread_only().blocking_input_expected_soon) {
use_cases_.push_back(use_case + " blocking input expected");
} else {
use_cases_.push_back(use_case);
}
......@@ -348,7 +375,7 @@ class MainThreadSchedulerImplTest : public testing::Test {
scheduler_->WillBeginFrame(begin_frame_args);
}
void ForceTouchStartToBeExpectedSoon() {
void ForceBlockingInputToBeExpectedSoon() {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kGestureScrollUpdate),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
......@@ -381,7 +408,7 @@ class MainThreadSchedulerImplTest : public testing::Test {
void SimulateCompositorGestureStart(TouchEventPolicy touch_event_policy) {
if (touch_event_policy == TouchEventPolicy::kSendTouchStart) {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchMove),
......@@ -404,7 +431,7 @@ class MainThreadSchedulerImplTest : public testing::Test {
// driven gesture.
void SimulateMainThreadGestureWithoutScrollUpdates() {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchMove),
......@@ -423,7 +450,7 @@ class MainThreadSchedulerImplTest : public testing::Test {
// scheduled.
void SimulateMainThreadGestureWithoutPreventDefault() {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
// Touchstart policy update.
......@@ -468,10 +495,10 @@ class MainThreadSchedulerImplTest : public testing::Test {
blink::WebInputEvent::Type gesture_type) {
if (touch_event_policy == TouchEventPolicy::kSendTouchStart) {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
scheduler_->DidHandleInputEventOnCompositorThread(
......@@ -545,8 +572,8 @@ class MainThreadSchedulerImplTest : public testing::Test {
return scheduler_->main_thread_only().begin_frame_not_expected_soon;
}
bool TouchStartExpectedSoon() {
return scheduler_->main_thread_only().touchstart_expected_soon;
bool BlockingInputExpectedSoon() {
return scheduler_->main_thread_only().blocking_input_expected_soon;
}
bool HaveSeenABeginMainframe() {
......@@ -565,6 +592,11 @@ class MainThreadSchedulerImplTest : public testing::Test {
return scheduler_->main_thread_only().estimated_next_frame_begin;
}
bool HaveSeenABlockingGesture() {
base::AutoLock lock(scheduler_->any_thread_lock_);
return scheduler_->any_thread().have_seen_a_blocking_gesture;
}
void AdvanceTimeWithTask(double duration) {
scoped_refptr<MainThreadTaskQueue> fake_queue =
scheduler_->NewLoadingTaskQueue(
......@@ -957,7 +989,6 @@ TEST_F(MainThreadSchedulerImplTest,
TEST_F(MainThreadSchedulerImplTest,
TestCompositorPolicy_CompositorHandlesInput_LongGestureDuration) {
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
EnableIdleTasks();
SimulateCompositorGestureStart(TouchEventPolicy::kSendTouchStart);
......@@ -1051,10 +1082,10 @@ TEST_F(MainThreadSchedulerImplTest,
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledApplication);
base::RunLoop().RunUntilIdle();
// Because the main thread is performing custom input handling, we let all
......@@ -1075,10 +1106,10 @@ TEST_F(
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
base::RunLoop().RunUntilIdle();
// Because we are still waiting for the touchstart to be processed,
......@@ -1142,7 +1173,7 @@ TEST_F(MainThreadSchedulerImplTest,
PostTestTasks(&run_order, "C1 T1");
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_EQ(UseCase::kMainThreadGesture, CurrentUseCase());
EXPECT_THAT(run_order, testing::ElementsAre(std::string("C1")));
......@@ -1161,7 +1192,7 @@ TEST_F(MainThreadSchedulerImplTest,
PostTestTasks(&run_order, "C1 T1");
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase());
EXPECT_THAT(run_order,
......@@ -1181,7 +1212,7 @@ TEST_F(MainThreadSchedulerImplTest,
PostTestTasks(&run_order, "C1 T1");
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_EQ(UseCase::kMainThreadCustomInputHandling, CurrentUseCase());
EXPECT_THAT(run_order,
......@@ -1195,7 +1226,7 @@ TEST_F(MainThreadSchedulerImplTest, TestTouchstartPolicy_Compositor) {
// Observation of touchstart should defer execution of timer, idle and loading
// tasks.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
EnableIdleTasks();
base::RunLoop().RunUntilIdle();
......@@ -1236,10 +1267,10 @@ TEST_F(MainThreadSchedulerImplTest, TestTouchstartPolicy_MainThread) {
// Observation of touchstart should defer execution of timer, idle and loading
// tasks.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
EnableIdleTasks();
base::RunLoop().RunUntilIdle();
......@@ -1405,7 +1436,7 @@ TEST_F(MainThreadSchedulerImplTest,
SimulateMainThreadGestureStart(TouchEventPolicy::kSendTouchStart,
blink::WebInputEvent::kGestureScrollUpdate);
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_EQ(UseCase::kMainThreadGesture, CurrentUseCase());
// Now start a main thread mouse touch gesture. It should be detected as main
......@@ -1467,7 +1498,7 @@ TEST_F(MainThreadSchedulerImplTest,
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kMouseWheel),
FakeMouseWheelEvent(blink::WebInputEvent::kMouseWheel),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
base::RunLoop().RunUntilIdle();
// Note compositor tasks are not prioritized.
......@@ -1485,7 +1516,7 @@ TEST_F(MainThreadSchedulerImplTest,
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kMouseWheel),
FakeMouseWheelEvent(blink::WebInputEvent::kMouseWheel),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
base::RunLoop().RunUntilIdle();
// Note compositor tasks are prioritized (since they are fast).
......@@ -1503,7 +1534,7 @@ TEST_F(MainThreadSchedulerImplTest,
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kMouseWheel),
FakeMouseWheelEvent(blink::WebInputEvent::kMouseWheel),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kGestureScrollBegin),
......@@ -1531,7 +1562,7 @@ TEST_F(
EnableIdleTasks();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kMouseWheel),
FakeMouseWheelEvent(blink::WebInputEvent::kMouseWheel),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kGestureScrollBegin),
......@@ -1646,7 +1677,7 @@ TEST_F(MainThreadSchedulerImplTest, TestTouchstartPolicyEndsAfterTimeout) {
PostTestTasks(&run_order, "L1 D1 C1 D2 C2");
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
base::RunLoop().RunUntilIdle();
EXPECT_THAT(run_order,
......@@ -1674,7 +1705,7 @@ TEST_F(MainThreadSchedulerImplTest,
// Observation of touchstart should defer execution of idle and loading tasks.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
base::RunLoop().RunUntilIdle();
EXPECT_THAT(run_order,
......@@ -1702,7 +1733,7 @@ TEST_F(MainThreadSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
bool is_anticipated_before = false;
bool is_anticipated_after = false;
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
default_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&AnticipationTestTask, scheduler_.get(),
SimulateInputType::kNone,
......@@ -1747,7 +1778,7 @@ TEST_F(MainThreadSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
// use case but with scrolling expected where high-priority work is still
// anticipated.
EXPECT_EQ(UseCase::kNone, CurrentUseCase());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_TRUE(is_anticipated_before);
EXPECT_TRUE(is_anticipated_after);
......@@ -1761,7 +1792,7 @@ TEST_F(MainThreadSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
// Eventually the scheduler should go into the default use case where
// high-priority work is no longer anticipated.
EXPECT_EQ(UseCase::kNone, CurrentUseCase());
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_FALSE(is_anticipated_before);
EXPECT_FALSE(is_anticipated_after);
}
......@@ -1805,7 +1836,7 @@ TEST_F(MainThreadSchedulerImplTest, TestShouldYield_TouchStart) {
// there's no immediately pending work in the compositor queue.
EXPECT_FALSE(scheduler_->ShouldYieldForHighPriorityWork());
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
EXPECT_TRUE(scheduler_->ShouldYieldForHighPriorityWork());
base::RunLoop().RunUntilIdle();
......@@ -1872,14 +1903,14 @@ TEST_F(MainThreadSchedulerImplTest, UpdatePolicyCountTriggeredByOneInputEvent) {
// We expect DidHandleInputEventOnCompositorThread to post an urgent policy
// update.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
EXPECT_EQ(0, scheduler_->update_policy_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, scheduler_->update_policy_count_);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
EXPECT_EQ(1, scheduler_->update_policy_count_);
......@@ -1894,14 +1925,15 @@ TEST_F(MainThreadSchedulerImplTest,
// We expect DidHandleInputEventOnCompositorThread to post
// an urgent policy update.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart,
blink::WebInputEvent::kEventNonBlocking),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
EXPECT_EQ(0, scheduler_->update_policy_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, scheduler_->update_policy_count_);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
EXPECT_EQ(1, scheduler_->update_policy_count_);
......@@ -1943,14 +1975,15 @@ TEST_F(MainThreadSchedulerImplTest,
// We expect DidHandleInputEventOnCompositorThread to post an urgent policy
// update.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart,
blink::WebInputEvent::kEventNonBlocking),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
EXPECT_EQ(0, scheduler_->update_policy_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, scheduler_->update_policy_count_);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
EXPECT_EQ(1, scheduler_->update_policy_count_);
test_task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(1));
......@@ -2005,7 +2038,7 @@ TEST_F(MainThreadSchedulerImplTest, EnsureUpdatePolicyNotTriggeredTooOften) {
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
WebInputEventResult::kHandledSystem);
scheduler_->DidHandleInputEventOnMainThread(
FakeInputEvent(blink::WebInputEvent::kTouchMove),
......@@ -2027,8 +2060,24 @@ TEST_F(MainThreadSchedulerImplTest, EnsureUpdatePolicyNotTriggeredTooOften) {
scheduler_->use_cases_,
testing::ElementsAre(
std::string("none"), std::string("compositor_gesture"),
std::string("compositor_gesture touchstart expected"),
std::string("none touchstart expected"), std::string("none")));
std::string("compositor_gesture blocking input expected"),
std::string("none blocking input expected"), std::string("none")));
}
TEST_F(MainThreadSchedulerImplTest,
BlockingInputExpectedSoonWhenBlockInputEventSeen) {
SimulateCompositorGestureStart(TouchEventPolicy::kSendTouchStart);
EXPECT_TRUE(HaveSeenABlockingGesture());
ForceBlockingInputToBeExpectedSoon();
EXPECT_TRUE(BlockingInputExpectedSoon());
}
TEST_F(MainThreadSchedulerImplTest,
BlockingInputNotExpectedSoonWhenNoBlockInputEventSeen) {
SimulateCompositorGestureStart(TouchEventPolicy::kDontSendTouchStart);
EXPECT_FALSE(HaveSeenABlockingGesture());
ForceBlockingInputToBeExpectedSoon();
EXPECT_FALSE(BlockingInputExpectedSoon());
}
class MainThreadSchedulerImplWithMessageLoopTest
......@@ -2239,7 +2288,7 @@ TEST_F(MainThreadSchedulerImplTest, TestLongIdlePeriodInTouchStartPolicy) {
// Observation of touchstart should defer the start of the long idle period.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
scheduler_->BeginFrameNotExpectedSoon();
base::RunLoop().RunUntilIdle();
......@@ -2472,9 +2521,9 @@ TEST_F(MainThreadSchedulerImplTest,
ExpensiveLoadingTasksNotBlockedTillFirstBeginMainFrame) {
std::vector<std::string> run_order;
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
SimulateExpensiveTasks(loading_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
PostTestTasks(&run_order, "L1 D1");
base::RunLoop().RunUntilIdle();
......@@ -2482,7 +2531,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_FALSE(HaveSeenABeginMainframe());
EXPECT_TRUE(LoadingTasksSeemExpensive());
EXPECT_FALSE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order,
testing::ElementsAre(std::string("L1"), std::string("D1")));
......@@ -2497,7 +2546,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_TRUE(LoadingTasksSeemExpensive());
EXPECT_FALSE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode());
}
......@@ -2509,7 +2558,7 @@ TEST_F(MainThreadSchedulerImplTest,
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(false);
DoMainFrame();
SimulateExpensiveTasks(loading_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
PostTestTasks(&run_order, "L1 D1");
base::RunLoop().RunUntilIdle();
......@@ -2517,7 +2566,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_TRUE(LoadingTasksSeemExpensive());
EXPECT_FALSE(TimerTasksSeemExpensive());
EXPECT_FALSE(TouchStartExpectedSoon());
EXPECT_FALSE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order,
testing::ElementsAre(std::string("L1"), std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_ANIMATION, GetRAILMode());
......@@ -2527,10 +2576,10 @@ TEST_F(MainThreadSchedulerImplTest,
ExpensiveTimerTaskBlocked_UseCase_NONE_PreviousCompositorGesture) {
std::vector<std::string> run_order;
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
DoMainFrame();
SimulateExpensiveTasks(timer_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
PostTestTasks(&run_order, "T1 D1");
base::RunLoop().RunUntilIdle();
......@@ -2539,7 +2588,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_FALSE(LoadingTasksSeemExpensive());
EXPECT_TRUE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode());
}
......@@ -2575,7 +2624,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_FALSE(LoadingTasksSeemExpensive());
EXPECT_TRUE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order,
testing::ElementsAre(std::string("T1"), std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_ANIMATION, GetRAILMode());
......@@ -2585,10 +2634,10 @@ TEST_F(MainThreadSchedulerImplTest,
ExpensiveTimerTaskBlocked_UseCase_kCompositorGesture) {
std::vector<std::string> run_order;
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
DoMainFrame();
SimulateExpensiveTasks(timer_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
scheduler_->DidAnimateForInputOnCompositorThread();
PostTestTasks(&run_order, "T1 D1");
......@@ -2599,7 +2648,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_FALSE(LoadingTasksSeemExpensive());
EXPECT_TRUE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode());
}
......@@ -2608,10 +2657,10 @@ TEST_F(MainThreadSchedulerImplTest,
ExpensiveTimerTaskBlocked_EvenIfBeginMainFrameNotExpectedSoon) {
std::vector<std::string> run_order;
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
DoMainFrame();
SimulateExpensiveTasks(timer_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
scheduler_->BeginFrameNotExpectedSoon();
PostTestTasks(&run_order, "T1 D1");
......@@ -2621,7 +2670,7 @@ TEST_F(MainThreadSchedulerImplTest,
EXPECT_TRUE(HaveSeenABeginMainframe());
EXPECT_FALSE(LoadingTasksSeemExpensive());
EXPECT_TRUE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_THAT(run_order, testing::ElementsAre(std::string("D1")));
EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode());
}
......@@ -2631,9 +2680,9 @@ TEST_F(MainThreadSchedulerImplTest,
std::vector<std::string> run_order;
DoMainFrame();
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
SimulateExpensiveTasks(loading_task_runner_);
ForceTouchStartToBeExpectedSoon();
ForceBlockingInputToBeExpectedSoon();
PostTestTasks(&run_order, "L1 D1");
base::RunLoop().RunUntilIdle();
......@@ -2929,7 +2978,7 @@ void SlowCountingTask(size_t* count,
TEST_F(MainThreadSchedulerImplTest,
SYNCHRONIZED_GESTURE_TimerTaskThrottling_task_expensive) {
SimulateCompositorGestureStart(TouchEventPolicy::kSendTouchStart);
SimulateCompositorGestureStart(TouchEventPolicy::kDontSendTouchStart);
base::TimeTicks first_throttled_run_time =
TaskQueueThrottler::AlignedThrottledRunTime(Now());
......@@ -3084,11 +3133,12 @@ TEST_F(MainThreadSchedulerImplTest,
}
TEST_F(MainThreadSchedulerImplTest,
ExpensiveTimerTaskBlocked_SYNCHRONIZED_GESTURE_TouchStartExpected) {
ExpensiveTimerTaskBlocked_SYNCHRONIZED_GESTURE_GestureExpected) {
SimulateExpensiveTasks(timer_task_runner_);
SimulateCompositorGestureStart(TouchEventPolicy::kSendTouchStart);
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
ForceTouchStartToBeExpectedSoon();
scheduler_->DidHandleInputEventOnCompositorThread(
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
ForceBlockingInputToBeExpectedSoon();
// Bump us into SYNCHRONIZED_GESTURE.
scheduler_->DidHandleInputEventOnCompositorThread(
......@@ -3106,13 +3156,13 @@ TEST_F(MainThreadSchedulerImplTest,
ForceUpdatePolicyAndGetCurrentUseCase());
EXPECT_TRUE(TimerTasksSeemExpensive());
EXPECT_TRUE(TouchStartExpectedSoon());
EXPECT_TRUE(BlockingInputExpectedSoon());
EXPECT_FALSE(timer_task_runner_->IsQueueEnabled());
}
TEST_F(MainThreadSchedulerImplTest, DenyLongIdleDuringTouchStart) {
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
EXPECT_EQ(UseCase::kTouchstart, ForceUpdatePolicyAndGetCurrentUseCase());
......@@ -3141,7 +3191,7 @@ TEST_F(MainThreadSchedulerImplTest,
// Make sure TouchStart causes a policy change.
scheduler_->DidHandleInputEventOnCompositorThread(
FakeInputEvent(blink::WebInputEvent::kTouchStart),
FakeTouchEvent(blink::WebInputEvent::kTouchStart),
InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
EXPECT_EQ(UseCase::kTouchstart, ForceUpdatePolicyAndGetCurrentUseCase());
}
......@@ -3275,8 +3325,8 @@ TEST_F(MainThreadSchedulerImplTest, TestResponseRAILMode) {
scheduler_->SetRAILModeObserver(&observer);
EXPECT_CALL(observer, OnRAILModeChanged(v8::PERFORMANCE_RESPONSE));
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
ForceTouchStartToBeExpectedSoon();
scheduler_->SetHaveSeenABlockingGestureForTesting(true);
ForceBlockingInputToBeExpectedSoon();
EXPECT_EQ(UseCase::kNone, ForceUpdatePolicyAndGetCurrentUseCase());
EXPECT_EQ(v8::PERFORMANCE_RESPONSE, GetRAILMode());
scheduler_->SetRAILModeObserver(nullptr);
......
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