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

Unified Diff: Source/platform/scheduler/SchedulerTest.cpp

Issue 621363002: scheduler: Post high priority tasks directly to the message loop (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test tweak. Created 6 years, 2 months 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 | « Source/platform/scheduler/Scheduler.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scheduler/SchedulerTest.cpp
diff --git a/Source/platform/scheduler/SchedulerTest.cpp b/Source/platform/scheduler/SchedulerTest.cpp
index 75789407a196a6030bd9164a5e2ecf4d62205cf9..ccf12e19dfc3b456bffe6c09ad8237aada9b8e91 100644
--- a/Source/platform/scheduler/SchedulerTest.cpp
+++ b/Source/platform/scheduler/SchedulerTest.cpp
@@ -319,23 +319,6 @@ TEST_F(SchedulerTest, TestTaskPrioritization_normalPolicy)
std::string("IPC")));
}
-TEST_F(SchedulerTest, TestTaskPrioritization_compositorPriorityPolicy)
-{
- m_scheduler->enterSchedulerPolicy(SchedulerForTest::CompositorPriority);
- m_scheduler->postTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("L1")));
- m_scheduler->postTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("L2")));
- m_scheduler->postInputTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("I1")));
- m_scheduler->postCompositorTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("C1")));
- m_scheduler->postInputTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("I2")));
- m_scheduler->postCompositorTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("C2")));
- m_scheduler->postIpcTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("IPC")));
-
- runPendingTasks();
- EXPECT_THAT(m_order, testing::ElementsAre(
- std::string("I1"), std::string("C1"), std::string("I2"), std::string("C2"), std::string("L1"), std::string("L2"),
- std::string("IPC")));
-}
-
TEST_F(SchedulerTest, TestRentrantTask)
{
m_scheduler->postTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVectorReentrantTask, this));
@@ -344,21 +327,19 @@ TEST_F(SchedulerTest, TestRentrantTask)
EXPECT_THAT(m_reentrantOrder, testing::ElementsAre(0, 1, 2, 3, 4));
}
-
-TEST_F(SchedulerTest, TestRentrantInputTaskDuringShutdown)
+TEST_F(SchedulerTest, TestTasksRunAfterShutdown)
{
- m_scheduler->postInputTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVectorReentrantInputTask, this));
- Scheduler::shutdown();
-
- EXPECT_THAT(m_reentrantOrder, testing::ElementsAre(0, 1, 2, 3, 4));
-}
+ m_scheduler->postTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("1")));
+ m_scheduler->postInputTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("2")));
+ m_scheduler->postCompositorTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("3")));
+ m_scheduler->postIpcTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVector, this, std::string("4")));
-TEST_F(SchedulerTest, TestRentrantCompositorTaskDuringShutdown)
-{
- m_scheduler->postCompositorTask(FROM_HERE, WTF::bind(&SchedulerTest::appendToVectorReentrantCompositorTask, this));
Scheduler::shutdown();
+ EXPECT_TRUE(m_order.empty());
- EXPECT_THAT(m_reentrantOrder, testing::ElementsAre(0, 1, 2, 3, 4));
+ runPendingTasks();
+ EXPECT_THAT(m_order, testing::ElementsAre(
+ std::string("1"), std::string("2"), std::string("3"), std::string("4")));
}
bool s_shouldContinue;
@@ -405,18 +386,6 @@ void dummyTask()
s_dummyTaskCount++;
}
-TEST_F(SchedulerTest, TestMultipleCallsToPostInputOrCompositorTaskResultsInOnlyOneMainThreadTask)
-{
- EXPECT_EQ(0U, m_platformSupport.numPendingMainThreadTasks());
-
- for (int i = 0; i < 10; i++) {
- m_scheduler->postInputTask(FROM_HERE, WTF::bind(&dummyTask));
- m_scheduler->postCompositorTask(FROM_HERE, WTF::bind(&dummyTask));
- }
-
- EXPECT_EQ(1U, m_platformSupport.numPendingMainThreadTasks());
-}
-
TEST_F(SchedulerTest, TestMainThreadTaskLifeCycle)
{
EXPECT_EQ(0U, m_platformSupport.numPendingMainThreadTasks());
@@ -455,23 +424,6 @@ TEST_F(SchedulerTest, HighPriorityTasksOnlyDontRunBecauseOfSharedTimerFiring_InN
m_scheduler->setSharedTimerFiredFunction(nullptr);
}
-TEST_F(SchedulerTest, HighPriorityTasksOnlyRunOncePerSharedTimerFiring_InLowSchedulerPolicy)
-{
- s_dummyTaskCount = 0;
- m_scheduler->enterSchedulerPolicy(SchedulerForTest::CompositorPriority);
- m_scheduler->postInputTask(FROM_HERE, WTF::bind(&dummyTask));
- // Trigger the posting of an input task during execution of the shared timer function.
- m_scheduler->setSharedTimerFiredFunction(&postDummyInputTask);
- m_scheduler->setSharedTimerFireInterval(0);
- m_platformSupport.triggerSharedTimer();
-
- EXPECT_EQ(1, s_dummyTaskCount);
-
- // Clean up.
- m_scheduler->stopSharedTimer();
- m_scheduler->setSharedTimerFiredFunction(nullptr);
-}
-
TEST_F(SchedulerTest, TestInputEventDoesNotTriggerShouldYield_InNormalMode)
{
m_scheduler->postInputTask(FROM_HERE, WTF::bind(&dummyTask));
« no previous file with comments | « Source/platform/scheduler/Scheduler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698