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

Unified Diff: mojo/edk/test/multiprocess_test_helper.cc

Issue 2466433002: Add mojo::edk::ClosePeerConnection. (Closed)
Patch Set: Created 4 years, 1 month 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 | « mojo/edk/test/multiprocess_test_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/test/multiprocess_test_helper.cc
diff --git a/mojo/edk/test/multiprocess_test_helper.cc b/mojo/edk/test/multiprocess_test_helper.cc
index 611c465bd387c0865e27714cdce1ed23ef4a8782..68336bd8a60de229d5f6cbf074f5f9ffbb3b1945 100644
--- a/mojo/edk/test/multiprocess_test_helper.cc
+++ b/mojo/edk/test/multiprocess_test_helper.cc
@@ -146,9 +146,11 @@ ScopedMessagePipeHandle MultiprocessTestHelper::StartChildWithExtraSwitch(
launch_type == LaunchType::NAMED_CHILD) {
pipe = CreateParentMessagePipe(pipe_token, child_token);
} else if (launch_type == LaunchType::PEER) {
- pipe = ConnectToPeerProcess(channel.PassServerHandle());
+ peer_token_ = mojo::edk::GenerateRandomToken();
+ pipe = ConnectToPeerProcess(channel.PassServerHandle(), peer_token_);
} else if (launch_type == LaunchType::NAMED_PEER) {
- pipe = ConnectToPeerProcess(CreateServerHandle(named_pipe));
+ peer_token_ = mojo::edk::GenerateRandomToken();
+ pipe = ConnectToPeerProcess(CreateServerHandle(named_pipe), peer_token_);
}
test_child_ =
@@ -184,6 +186,12 @@ int MultiprocessTestHelper::WaitForChildShutdown() {
return rv;
}
+void MultiprocessTestHelper::ClosePeerConnection() {
+ DCHECK(!peer_token_.empty());
+ ::mojo::edk::ClosePeerConnection(peer_token_);
+ peer_token_.clear();
+}
+
bool MultiprocessTestHelper::WaitForChildTestShutdown() {
return WaitForChildShutdown() == 0;
}
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698