Index: chrome/renderer/net/mockable_one_shot_timer.cc |
diff --git a/chrome/renderer/net/mockable_one_shot_timer.cc b/chrome/renderer/net/mockable_one_shot_timer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bc406c2dd51f147f4783ff97db9bf774fb86a973 |
--- /dev/null |
+++ b/chrome/renderer/net/mockable_one_shot_timer.cc |
@@ -0,0 +1,31 @@ |
+// Copyright 2014 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. |
+// MockableOneShotTimer implementation in terms of base::OneShotTimer |
mmenke
2014/02/14 17:56:10
nit: Comments like this should generally go above
Elly Fong-Jones
2014/02/25 19:19:52
Done.
|
+ |
+#include "chrome/renderer/net/mockable_one_shot_timer.h" |
+ |
+MockableOneShotTimer::MockableOneShotTimer() {} |
+MockableOneShotTimer::~MockableOneShotTimer() {} |
+ |
+void MockableOneShotTimer::Fired() { |
+ task_.Run(); |
+} |
+ |
+void MockableOneShotTimer::Start( |
+ const tracked_objects::Location& posted_from, base::TimeDelta delay, |
+ const base::Closure& task) { |
+ DCHECK(!task.is_null()); |
+ task_ = task; |
+ timer_.Start(posted_from, delay, |
+ base::Bind(&MockableOneShotTimer::Fired, |
+ base::Unretained(this))); |
mmenke
2014/02/14 17:56:10
nit: Think you can merge these two lines.
Elly Fong-Jones
2014/02/25 19:19:52
Done.
|
+} |
+ |
+void MockableOneShotTimer::Stop() { |
+ timer_.Stop(); |
+} |
+ |
+bool MockableOneShotTimer::IsRunning() const { |
+ return timer_.IsRunning(); |
+} |