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

Unified Diff: mojo/common/common_custom_types_unittest.cc

Issue 2822593002: [Memory UMA] Return the extra_processes_dump map as part of the ResponseCallback (Closed)
Patch Set: Rebase 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: mojo/common/common_custom_types_unittest.cc
diff --git a/mojo/common/common_custom_types_unittest.cc b/mojo/common/common_custom_types_unittest.cc
index b0943783879967e50a947624e50cb1e64aa79506..c019d38c2204a4b7796e153073d413c580a01cd3 100644
--- a/mojo/common/common_custom_types_unittest.cc
+++ b/mojo/common/common_custom_types_unittest.cc
@@ -7,6 +7,7 @@
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/numerics/safe_math.h"
+#include "base/process/process_handle.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -32,6 +33,11 @@ struct PassTraits {
};
template <>
+struct PassTraits<base::ProcessId> {
+ using Type = base::ProcessId;
+};
+
+template <>
struct PassTraits<base::Time> {
using Type = base::Time;
};
@@ -91,6 +97,21 @@ class TestUnguessableTokenImpl : public TestUnguessableToken {
mojo::Binding<TestUnguessableToken> binding_;
};
+class TestProcessIdImpl : public TestProcessId {
+ public:
+ explicit TestProcessIdImpl(TestProcessIdRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestProcessId implementation:
+ void BounceProcessId(base::ProcessId in,
+ const BounceProcessIdCallback& callback) override {
+ callback.Run(in);
+ }
+
+ private:
+ mojo::Binding<TestProcessId> binding_;
+};
+
class TestTimeImpl : public TestTime {
public:
explicit TestTimeImpl(TestTimeRequest request)
@@ -226,6 +247,19 @@ TEST_F(CommonCustomTypesTest, UnguessableToken) {
run_loop.Run();
}
+TEST_F(CommonCustomTypesTest, ProcessId) {
+ base::RunLoop run_loop;
+
+ TestProcessIdPtr ptr;
+ TestProcessIdImpl impl(MakeRequest(&ptr));
+
+ base::ProcessId pid = base::GetCurrentProcId();
+
+ ptr->BounceProcessId(pid, ExpectResponse(&pid, run_loop.QuitClosure()));
+
+ run_loop.Run();
+}
+
TEST_F(CommonCustomTypesTest, Time) {
base::RunLoop run_loop;

Powered by Google App Engine
This is Rietveld 408576698