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

Unified Diff: remoting/protocol/fake_process_stats_stub.h

Issue 2860803002: [Chromoting] Allow ProcessStatsSender to receive nullptr ProcessStatsAgent
Patch Set: Created 3 years, 8 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: remoting/protocol/fake_process_stats_stub.h
diff --git a/remoting/protocol/fake_process_stats_stub.h b/remoting/protocol/fake_process_stats_stub.h
new file mode 100644
index 0000000000000000000000000000000000000000..291e68c64f14fdacbf21674322d3cfdb4da3611c
--- /dev/null
+++ b/remoting/protocol/fake_process_stats_stub.h
@@ -0,0 +1,34 @@
+// 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 <vector>
+
+#include "base/callback.h"
+#include "remoting/proto/process_stats.pb.h"
+#include "remoting/protocol/process_stats_stub.h"
+
+namespace remoting {
+namespace protocol {
+
+class FakeProcessStatsStub final : public ProcessStatsStub {
+ public:
+ FakeProcessStatsStub();
+ ~FakeProcessStatsStub() override;
+
+ // ProcessStatsStub implementation.
+ void OnProcessStats(const AggregatedProcessResourceUsage& usage) override;
+
+ const std::vector<AggregatedProcessResourceUsage>& received() const;
+
+ void set_quit_closure(base::Closure quit_closure);
+ void set_expected_usage_count(size_t expected_usage_count);
joedow 2017/05/03 21:41:02 nit: trivial setters like this can be written inli
Hzj_jie 2017/05/03 22:18:04 Since we have a cc file anyway, I believe avoiding
joedow 2017/05/08 16:25:41 inline functions are fine for trivial getters: htt
Hzj_jie 2017/05/08 18:16:19 But I believe it's not a must-have. https://www.ch
joedow 2017/05/08 18:18:53 That's fine, my comment was marked as a nit
+
+ private:
+ std::vector<AggregatedProcessResourceUsage> received_;
+ size_t expected_usage_count_ = 0;
+ base::Closure quit_closure_;
+};
+
+} // namespace protocol
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698