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

Unified Diff: base/test/test_pending_task_info.cc

Issue 2627863002: Split Closure part of TestPendingTask out of the struct (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « base/test/test_pending_task_info.h ('k') | base/test/test_pending_task_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_pending_task_info.cc
diff --git a/base/test/test_pending_task.cc b/base/test/test_pending_task_info.cc
similarity index 69%
rename from base/test/test_pending_task.cc
rename to base/test/test_pending_task_info.cc
index 87b107e83845a86d5677981f1aed70e89e582a47..475f502e56fb22fe754f5ca4d41ddd9d306c8258 100644
--- a/base/test/test_pending_task.cc
+++ b/base/test/test_pending_task_info.cc
@@ -2,41 +2,42 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
+#include "base/test/test_pending_task_info.h"
-#include "base/test/test_pending_task.h"
+#include <ostream>
namespace base {
-TestPendingTask::TestPendingTask() : nestability(NESTABLE) {}
+TestPendingTaskInfo::TestPendingTaskInfo() = default;
-TestPendingTask::TestPendingTask(
+TestPendingTaskInfo::TestPendingTaskInfo(
const tracked_objects::Location& location,
- const Closure& task,
TimeTicks post_time,
TimeDelta delay,
TestNestability nestability)
: location(location),
- task(task),
post_time(post_time),
delay(delay),
nestability(nestability) {}
-TestPendingTask::TestPendingTask(const TestPendingTask& other) = default;
+TestPendingTaskInfo::TestPendingTaskInfo(const TestPendingTaskInfo& other) =
+ default;
-TimeTicks TestPendingTask::GetTimeToRun() const {
+TimeTicks TestPendingTaskInfo::GetTimeToRun() const {
return post_time + delay;
}
-bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const {
+bool TestPendingTaskInfo::ShouldRunBefore(
+ const TestPendingTaskInfo& other) const {
if (nestability != other.nestability)
return (nestability == NESTABLE);
return GetTimeToRun() < other.GetTimeToRun();
}
-TestPendingTask::~TestPendingTask() {}
+TestPendingTaskInfo::~TestPendingTaskInfo() {}
-void TestPendingTask::AsValueInto(base::trace_event::TracedValue* state) const {
+void TestPendingTaskInfo::AsValueInto(
+ base::trace_event::TracedValue* state) const {
state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
state->SetString("posting_function", location.ToString());
state->SetInteger("post_time", post_time.ToInternalValue());
@@ -53,26 +54,26 @@ void TestPendingTask::AsValueInto(base::trace_event::TracedValue* state) const {
}
std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
-TestPendingTask::AsValue() const {
+TestPendingTaskInfo::AsValue() const {
std::unique_ptr<base::trace_event::TracedValue> state(
new base::trace_event::TracedValue());
AsValueInto(state.get());
return std::move(state);
}
-std::string TestPendingTask::ToString() const {
+std::string TestPendingTaskInfo::ToString() const {
std::string output("TestPendingTask(");
AsValue()->AppendAsTraceFormat(&output);
output += ")";
return output;
}
-std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) {
+std::ostream& operator<<(std::ostream& os, const TestPendingTaskInfo& task) {
PrintTo(task, &os);
return os;
}
-void PrintTo(const TestPendingTask& task, std::ostream* os) {
+void PrintTo(const TestPendingTaskInfo& task, std::ostream* os) {
*os << task.ToString();
}
« no previous file with comments | « base/test/test_pending_task_info.h ('k') | base/test/test_pending_task_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698