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

Unified Diff: content/renderer/scheduler/renderer_scheduler_impl_unittest.cc

Issue 692483002: Hook up DidReceiveInputEvent to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding some input event filter logic Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/scheduler/renderer_scheduler_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
diff --git a/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc b/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
index 701a222c71ed724c974382bfff62e9509a68bfe9..c1fcd5a431f09986f0fb1539362a78e2814fcccb 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
+++ b/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
@@ -137,7 +137,8 @@ void PostingYieldingTestTask(
*should_yield_before = scheduler->ShouldYieldForHighPriorityWork();
task_runner->PostTask(FROM_HERE, base::Bind(NullTask));
if (simulate_input) {
- scheduler->DidReceiveInputEventOnCompositorThread();
+ scheduler->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::GestureFlingStart);
}
*should_yield_after = scheduler->ShouldYieldForHighPriorityWork();
}
@@ -298,7 +299,8 @@ TEST_F(RendererSchedulerImplTest, TestCompositorPolicy) {
FROM_HERE,
base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
- scheduler_->DidReceiveInputEventOnCompositorThread();
+ scheduler_->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::GestureFlingStart);
EnableIdleTasks();
RunUntilIdle();
EXPECT_THAT(order, testing::ElementsAre(std::string("C1"), std::string("C2"),
@@ -306,6 +308,93 @@ TEST_F(RendererSchedulerImplTest, TestCompositorPolicy) {
std::string("I1")));
}
+TEST_F(RendererSchedulerImplTest, TestCompositorPolicy_DidAnimateForInput) {
+ std::vector<std::string> order;
+
+ idle_task_runner_->PostIdleTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorIdleTestTask, &order, std::string("I1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D1")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D2")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
+
+ scheduler_->DidAnimateForInputOnCompositorThread();
+ EnableIdleTasks();
+ RunUntilIdle();
+ EXPECT_THAT(order, testing::ElementsAre(std::string("C1"), std::string("C2"),
+ std::string("D1"), std::string("D2"),
+ std::string("I1")));
+}
+
+TEST_F(RendererSchedulerImplTest,
+ DidReceiveInputEventOnCompositorThread_IgnoresMouseEvents) {
+ std::vector<std::string> order;
+
+ idle_task_runner_->PostIdleTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorIdleTestTask, &order, std::string("I1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D1")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D2")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
+
+ scheduler_->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::MouseMove);
+ EnableIdleTasks();
+ RunUntilIdle();
+ // Note compositor tasks are not prioritized.
+ EXPECT_THAT(order, testing::ElementsAre(std::string("D1"), std::string("C1"),
+ std::string("D2"), std::string("C2"),
+ std::string("I1")));
+}
+
+TEST_F(RendererSchedulerImplTest,
+ DidReceiveInputEventOnCompositorThread_IgnoresKeyboardEvents) {
+ std::vector<std::string> order;
+
+ idle_task_runner_->PostIdleTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorIdleTestTask, &order, std::string("I1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D1")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C1")));
+ default_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("D2")));
+ compositor_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
+
+ scheduler_->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::KeyDown);
+ EnableIdleTasks();
+ RunUntilIdle();
+ // Note compositor tasks are not prioritized.
+ EXPECT_THAT(order, testing::ElementsAre(std::string("D1"), std::string("C1"),
+ std::string("D2"), std::string("C2"),
+ std::string("I1")));
+}
+
TEST_F(RendererSchedulerImplTest,
TestCompositorPolicyDoesNotStarveDefaultTasks) {
std::vector<std::string> order;
@@ -323,7 +412,8 @@ TEST_F(RendererSchedulerImplTest,
FROM_HERE,
base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
- scheduler_->DidReceiveInputEventOnCompositorThread();
+ scheduler_->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::GestureFlingStart);
RunUntilIdle();
// Ensure that the default D1 task gets to run at some point before the final
// C2 compositor task.
@@ -347,7 +437,8 @@ TEST_F(RendererSchedulerImplTest, TestCompositorPolicyEnds) {
FROM_HERE,
base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
- scheduler_->DidReceiveInputEventOnCompositorThread();
+ scheduler_->DidReceiveInputEventOnCompositorThread(
+ blink::WebInputEvent::GestureFlingStart);
RunUntilIdle();
EXPECT_THAT(order,
testing::ElementsAre(std::string("C1"), std::string("C2"),
« no previous file with comments | « content/renderer/scheduler/renderer_scheduler_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698