1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/test_pending_task.h"
6
7 namespace base {
8
TestPendingTask()9 TestPendingTask::TestPendingTask() : nestability(NESTABLE) {}
10
TestPendingTask(const tracked_objects::Location & location,const Closure & task,TimeTicks post_time,TimeDelta delay,TestNestability nestability)11 TestPendingTask::TestPendingTask(
12 const tracked_objects::Location& location,
13 const Closure& task,
14 TimeTicks post_time,
15 TimeDelta delay,
16 TestNestability nestability)
17 : location(location),
18 task(task),
19 post_time(post_time),
20 delay(delay),
21 nestability(nestability) {}
22
GetTimeToRun() const23 TimeTicks TestPendingTask::GetTimeToRun() const {
24 return post_time + delay;
25 }
26
ShouldRunBefore(const TestPendingTask & other) const27 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const {
28 if (nestability != other.nestability)
29 return (nestability == NESTABLE);
30 return GetTimeToRun() < other.GetTimeToRun();
31 }
32
~TestPendingTask()33 TestPendingTask::~TestPendingTask() {}
34
35 } // namespace base
36