blob: bb81eaa38ea7ed9a4d2edb45aa50daf2eb04da06 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/test/test_pending_task.h"
#include <string>
#include <utility>
namespace base {
TestPendingTask::TestPendingTask() : nestability(NESTABLE) {}
TestPendingTask::TestPendingTask(const Location& location,
OnceClosure task,
TimeTicks post_time,
TimeDelta delay,
TestNestability nestability)
: location(location),
task(std::move(task)),
post_time(post_time),
delay(delay),
nestability(nestability) {}
TestPendingTask::TestPendingTask(TestPendingTask&& other) = default;
TestPendingTask& TestPendingTask::operator=(TestPendingTask&& other) = default;
TimeTicks TestPendingTask::GetTimeToRun() const {
return post_time + delay;
}
bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const {
if (nestability != other.nestability)
return (nestability == NESTABLE);
return GetTimeToRun() < other.GetTimeToRun();
}
TestPendingTask::~TestPendingTask() = default;
} // namespace base