Home | History | Annotate | Download | only in test
      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 
      9 TestPendingTask::TestPendingTask() : nestability(NESTABLE) {}
     10 
     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 
     23 TimeTicks TestPendingTask::GetTimeToRun() const {
     24   return post_time + delay;
     25 }
     26 
     27 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const {
     28   if (nestability != other.nestability)
     29     return (nestability == NESTABLE);
     30   return GetTimeToRun() < other.GetTimeToRun();
     31 }
     32 
     33 TestPendingTask::~TestPendingTask() {}
     34 
     35 }  // namespace base
     36