8#include "flutter/fml/macros.h"
9#include "flutter/fml/task_source.h"
10#include "flutter/fml/time/chrono_timestamp_provider.h"
11#include "flutter/fml/time/time_delta.h"
12#include "flutter/fml/time/time_point.h"
13#include "gtest/gtest.h"
18TEST(TaskSourceTests, SimpleInitialization) {
25TEST(TaskSourceTests, MultipleTaskGrades) {
36TEST(TaskSourceTests, SimpleOrdering) {
53TEST(TaskSourceTests, SimpleOrderingMultiTaskHeaps) {
62 auto top_task = task_source.
Top();
64 task_source.
PopTask(top_task.task.GetTaskSourceGrade());
67 auto second_task = task_source.
Top();
69 task_source.
PopTask(second_task.task.GetTaskSourceGrade());
73TEST(TaskSourceTests, OrderingMultiTaskHeapsSecondaryPaused) {
85 auto top_task = task_source.
Top();
87 task_source.
PopTask(top_task.task.GetTaskSourceGrade());
90 ASSERT_TRUE(task_source.
IsEmpty());
94 auto second_task = task_source.
Top();
96 task_source.
PopTask(second_task.task.GetTaskSourceGrade());
const fml::closure & GetTask() const
bool IsEmpty() const
Returns true if GetNumPendingTasks is zero.
void RegisterTask(const DelayedTask &task)
void ResumeSecondary()
Resume providing tasks from secondary task heap.
void PauseSecondary()
Pause providing tasks from secondary task heap.
void PopTask(TaskSourceGrade grade)
Pops the task heap corresponding to the TaskSourceGrade.
size_t GetNumPendingTasks() const
static constexpr TimeDelta FromMilliseconds(int64_t millis)
TEST(BacktraceTest, CanGatherBacktrace)
fml::TimePoint ChronoTicksSinceEpoch()
@ kUnspecified
The absence of a specialized TaskSourceGrade.