| Index: chrome/browser/memory/tab_manager_unittest.cc
|
| diff --git a/chrome/browser/memory/tab_manager_unittest.cc b/chrome/browser/memory/tab_manager_unittest.cc
|
| index 207aac9e07b4834642e7b97e29b6195389f16792..0003b5169e59bc6b9ab7d7bd6d16b40f03020ac2 100644
|
| --- a/chrome/browser/memory/tab_manager_unittest.cc
|
| +++ b/chrome/browser/memory/tab_manager_unittest.cc
|
| @@ -87,17 +87,15 @@ class MockTabStripModelObserver : public TabStripModelObserver {
|
| class LenientMockTaskRunner {
|
| public:
|
| LenientMockTaskRunner() {}
|
| - MOCK_METHOD3(PostDelayedTask,
|
| - bool(const tracked_objects::Location&,
|
| - const base::Closure&,
|
| - base::TimeDelta));
|
| + MOCK_METHOD1(PostDelayedTask, bool(base::TimeDelta));
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(LenientMockTaskRunner);
|
| };
|
| using MockTaskRunner = testing::StrictMock<LenientMockTaskRunner>;
|
|
|
| // Represents a pending task.
|
| -using Task = std::pair<base::TimeTicks, base::Closure>;
|
| +using Task = std::pair<base::TimeTicks, base::OnceClosure>;
|
|
|
| // Comparator used for sorting Task objects. Can't use std::pair's default
|
| // comparison operators because Closure's are comparable.
|
| @@ -117,11 +115,11 @@ class TaskRunnerProxy : public base::TaskRunner {
|
| : mock_(mock), clock_(clock) {}
|
| bool RunsTasksOnCurrentThread() const override { return true; }
|
| bool PostDelayedTask(const tracked_objects::Location& location,
|
| - const base::Closure& closure,
|
| + base::OnceClosure closure,
|
| base::TimeDelta delta) override {
|
| - mock_->PostDelayedTask(location, closure, delta);
|
| + mock_->PostDelayedTask(delta);
|
| base::TimeTicks when = clock_->NowTicks() + delta;
|
| - tasks_.push_back(Task(when, closure));
|
| + tasks_.push_back(Task(when, std::move(closure)));
|
| // Use 'greater' comparator to make this a min heap.
|
| std::push_heap(tasks_.begin(), tasks_.end(), TaskComparator());
|
| return true;
|
| @@ -132,7 +130,7 @@ class TaskRunnerProxy : public base::TaskRunner {
|
| base::TimeTicks now = clock_->NowTicks();
|
| size_t count = 0;
|
| while (!tasks_.empty() && tasks_.front().first <= now) {
|
| - tasks_.front().second.Run();
|
| + std::move(tasks_.front().second).Run();
|
| std::pop_heap(tasks_.begin(), tasks_.end(), TaskComparator());
|
| tasks_.pop_back();
|
| ++count;
|
| @@ -166,7 +164,7 @@ class TaskRunnerProxy : public base::TaskRunner {
|
| base::SimpleTestTickClock* clock_;
|
|
|
| // A min-heap of outstanding tasks.
|
| - using Task = std::pair<base::TimeTicks, base::Closure>;
|
| + using Task = std::pair<base::TimeTicks, base::OnceClosure>;
|
| std::vector<Task> tasks_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TaskRunnerProxy);
|
| @@ -587,8 +585,6 @@ TEST_F(TabManagerTest, MAYBE_ChildProcessNotifications) {
|
| tm.get_current_pressure_level_ = base::Bind(
|
| &ReturnSpecifiedPressure, base::Unretained(&level));
|
| EXPECT_CALL(mock_task_runner, PostDelayedTask(
|
| - testing::_,
|
| - testing::_,
|
| base::TimeDelta::FromSeconds(tm.kRendererNotificationDelayInSeconds)));
|
| EXPECT_CALL(*this, NotifyRendererProcess(renderer2, level));
|
| tm.OnMemoryPressure(level);
|
| @@ -615,8 +611,6 @@ TEST_F(TabManagerTest, MAYBE_ChildProcessNotifications) {
|
| // Run the scheduled task. This should cause another notification, but this
|
| // time to the foreground tab. It should also cause another scheduled event.
|
| EXPECT_CALL(mock_task_runner, PostDelayedTask(
|
| - testing::_,
|
| - testing::_,
|
| base::TimeDelta::FromSeconds(tm.kRendererNotificationDelayInSeconds)));
|
| EXPECT_CALL(*this, NotifyRendererProcess(renderer1, level));
|
| EXPECT_EQ(1u, task_runner->RunNextTask());
|
| @@ -632,8 +626,6 @@ TEST_F(TabManagerTest, MAYBE_ChildProcessNotifications) {
|
| // Run the scheduled task. This should cause another notification, to the
|
| // background tab. It should also cause another scheduled event.
|
| EXPECT_CALL(mock_task_runner, PostDelayedTask(
|
| - testing::_,
|
| - testing::_,
|
| base::TimeDelta::FromSeconds(tm.kRendererNotificationDelayInSeconds)));
|
| EXPECT_CALL(*this, NotifyRendererProcess(renderer2, level));
|
| EXPECT_EQ(1u, task_runner->RunNextTask());
|
|
|