Index: mojo/system/test_utils.h |
diff --git a/mojo/system/test_utils.h b/mojo/system/test_utils.h |
index 469edaf25833d65af85f1450893d33e58656b15f..c1a1a1e0b47d31d073d92a7d859845f1ba809197 100644 |
--- a/mojo/system/test_utils.h |
+++ b/mojo/system/test_utils.h |
@@ -23,6 +23,22 @@ namespace mojo { |
namespace system { |
namespace test { |
+// Posts the given task (to the given task runner) and waits for it to complete. |
+// (Note: Doesn't spin the current thread's message loop, so if you're careless |
+// this could easily deadlock.) |
+void PostTaskAndWait(scoped_refptr<base::TaskRunner> task_runner, |
+ const tracked_objects::Location& from_here, |
+ const base::Closure& task); |
+ |
+// A timeout smaller than |TestTimeouts::tiny_timeout()|. Warning: This may lead |
+// to flakiness, but this is unavoidable if, e.g., you're trying to ensure that |
+// functions with timeouts are reasonably accurate. We want this to be as small |
+// as possible without causing too much flakiness. |
+base::TimeDelta EpsilonTimeout(); |
+ |
+// Stopwatch ------------------------------------------------------------------- |
+ |
+// A simple "stopwatch" for measuring time elapsed from a given starting point. |
class Stopwatch { |
public: |
Stopwatch() {} |
@@ -32,8 +48,8 @@ class Stopwatch { |
start_time_ = base::TimeTicks::HighResNow(); |
} |
- int64_t Elapsed() { |
- return (base::TimeTicks::HighResNow() - start_time_).InMicroseconds(); |
+ base::TimeDelta Elapsed() { |
+ return base::TimeTicks::HighResNow() - start_time_; |
} |
private: |
@@ -42,13 +58,6 @@ class Stopwatch { |
DISALLOW_COPY_AND_ASSIGN(Stopwatch); |
}; |
-// Posts the given task (to the given task runner) and waits for it to complete. |
-// (Note: Doesn't spin the current thread's message loop, so if you're careless |
-// this could easily deadlock.) |
-void PostTaskAndWait(scoped_refptr<base::TaskRunner> task_runner, |
- const tracked_objects::Location& from_here, |
- const base::Closure& task); |
- |
// TestIOThread ---------------------------------------------------------------- |
class TestIOThread { |