Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: components/memory_pressure/memory_pressure_monitor_unittest.cc

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: erase Closure* Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/memory_pressure/memory_pressure_monitor_unittest.cc
diff --git a/components/memory_pressure/memory_pressure_monitor_unittest.cc b/components/memory_pressure/memory_pressure_monitor_unittest.cc
index 139c19e1e0b2d1e0b4a92060bc9e0eb84e529fb5..e295c8359634bfa80633b8bbc7d53376fe932c0c 100644
--- a/components/memory_pressure/memory_pressure_monitor_unittest.cc
+++ b/components/memory_pressure/memory_pressure_monitor_unittest.cc
@@ -5,6 +5,7 @@
#include "components/memory_pressure/memory_pressure_monitor.h"
#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/task_runner.h"
@@ -35,10 +36,8 @@ using testing::_;
// counting confuses gmock.
class LenientMockTaskRunner {
public:
- MOCK_METHOD3(PostDelayedTask,
- bool(const tracked_objects::Location&,
- const base::Closure&,
- base::TimeDelta));
+ MOCK_METHOD2(PostDelayedTask,
+ bool(const tracked_objects::Location&, base::TimeDelta));
};
using MockTaskRunner = testing::StrictMock<LenientMockTaskRunner>;
@@ -49,9 +48,9 @@ class TaskRunnerProxy : public base::TaskRunner {
explicit TaskRunnerProxy(MockTaskRunner* mock) : mock_(mock) {}
bool RunsTasksOnCurrentThread() const override { return true; }
bool PostDelayedTask(const tracked_objects::Location& location,
- const base::Closure& closure,
+ base::Closure closure,
base::TimeDelta delta) override {
- return mock_->PostDelayedTask(location, closure, delta);
+ return mock_->PostDelayedTask(location, delta);
}
private:
@@ -169,7 +168,7 @@ class MemoryPressureMonitorTest : public testing::Test {
// Sets expectations for tasks scheduled via |mock_task_runner_|.
void ExpectTaskPosted(int delay_ms) {
base::TimeDelta delay = base::TimeDelta::FromMilliseconds(delay_ms);
- EXPECT_CALL(mock_task_runner_, PostDelayedTask(_, _, delay))
+ EXPECT_CALL(mock_task_runner_, PostDelayedTask(_, delay))
.WillOnce(testing::Return(true));
}

Powered by Google App Engine
This is Rietveld 408576698