Index: remoting/protocol/fake_process_stats_stub.cc |
diff --git a/remoting/protocol/fake_process_stats_stub.cc b/remoting/protocol/fake_process_stats_stub.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e614436d0807705cfb6c3c3dd54893b0c281d290 |
--- /dev/null |
+++ b/remoting/protocol/fake_process_stats_stub.cc |
@@ -0,0 +1,37 @@ |
+// Copyright 2017 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. |
+ |
+#include "remoting/protocol/fake_process_stats_stub.h" |
+ |
+namespace remoting { |
+namespace protocol { |
+ |
+FakeProcessStatsStub::FakeProcessStatsStub() = default; |
+FakeProcessStatsStub::~FakeProcessStatsStub() = default; |
+ |
+void FakeProcessStatsStub::OnProcessStats( |
+ const AggregatedProcessResourceUsage& usage) { |
+ received_.push_back(usage); |
+ if (received_.size() == expected_usage_count_ && |
+ !quit_closure_.is_null()) { |
+ quit_closure_.Run(); |
+ } |
+} |
+ |
+const std::vector<AggregatedProcessResourceUsage>& |
+FakeProcessStatsStub::received() const { |
+ return received_; |
+} |
+ |
+void FakeProcessStatsStub::set_quit_closure(base::Closure quit_closure) { |
+ quit_closure_ = quit_closure; |
+} |
+ |
+void FakeProcessStatsStub::set_expected_usage_count( |
+ size_t expected_usage_count) { |
+ expected_usage_count_ = expected_usage_count; |
+} |
+ |
+} // namespace protocol |
+} // namespace remoting |