// 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.h"
namespace base {
TestPendingTask::~TestPendingTask() {}
+void TestPendingTask::AsValueInto(base::debug::TracedValue* state) const {
+ state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
+ state->SetString("posting_function", location.ToString());
+ state->SetInteger("post_time", post_time.ToInternalValue());
+ state->SetInteger("delay", delay.ToInternalValue());
+ switch (nestability) {
+ case NESTABLE:
+ state->SetString("nestability", "NESTABLE");
+ break;
+ case NON_NESTABLE:
+ state->SetString("nestability", "NON_NESTABLE");
+ break;
+ }
+ state->SetInteger("delay", delay.ToInternalValue());
+}
+
+scoped_refptr<base::debug::ConvertableToTraceFormat> TestPendingTask::AsValue()
+ const {
+ scoped_refptr<base::debug::TracedValue> state =
+ new base::debug::TracedValue();
+ AsValueInto(state.get());
+ return state;
+}
+
+std::string TestPendingTask::ToString() const {
+ std::string output("TestPendingTask(");
+ AsValue()->AppendAsTraceFormat(&output);
+ output += ")";
+ return output;
+}
+
+std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) {
+ PrintTo(task, &os);
+ return os;
+}
+
+void PrintTo(const TestPendingTask& task, std::ostream* os) {
+ *os << task.ToString();
+}
+
} // namespace base