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

Unified Diff: remoting/host/win/worker_process_launcher_unittest.cc

Issue 2451203002: Revert of Use ChannelMojo between the remoting daemon and network processes. (Closed)
Patch Set: Created 4 years, 2 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/host/win/worker_process_launcher_unittest.cc
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc
index ab9dc3884458ad8026bc301027cdc7bbbd5f3543..caa8c66e29dea3e4e0fa5f3c055a1940de065169 100644
--- a/remoting/host/win/worker_process_launcher_unittest.cc
+++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -23,6 +23,7 @@
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/host/chromoting_messages.h"
#include "remoting/host/host_exit_codes.h"
+#include "remoting/host/ipc_util.h"
#include "remoting/host/win/launch_process_with_token.h"
#include "remoting/host/worker_process_ipc_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -43,6 +44,8 @@
namespace {
+const char kIpcSecurityDescriptor[] = "D:(A;;GA;;;AU)";
+
class MockProcessLauncherDelegate : public WorkerProcessLauncher::Delegate {
public:
MockProcessLauncherDelegate() {}
@@ -168,8 +171,8 @@
// Implements WorkerProcessLauncher::Delegate.
std::unique_ptr<MockProcessLauncherDelegate> launcher_delegate_;
- // The client handle to the channel.
- mojo::ScopedMessagePipeHandle client_channel_handle_;
+ // The name of the IPC channel.
+ std::string channel_name_;
// Client and server ends of the IPC channel.
std::unique_ptr<IPC::ChannelProxy> channel_client_;
@@ -278,9 +281,10 @@
}
void WorkerProcessLauncherTest::ConnectClient() {
- channel_client_ = IPC::ChannelProxy::Create(client_channel_handle_.release(),
+ channel_client_ = IPC::ChannelProxy::Create(IPC::ChannelHandle(channel_name_),
IPC::Channel::MODE_CLIENT,
- &client_listener_, task_runner_);
+ &client_listener_,
+ task_runner_);
// Pretend that |kLaunchSuccessTimeoutSeconds| passed since launching
// the worker process. This will make the backoff algorithm think that this
@@ -326,7 +330,7 @@
void WorkerProcessLauncherTest::StopWorker() {
launcher_.reset();
DisconnectClient();
- client_channel_handle_.reset();
+ channel_name_.clear();
channel_server_.reset();
task_runner_ = nullptr;
}
@@ -362,12 +366,14 @@
worker_process_.Set(process_information.TakeProcessHandle());
ASSERT_TRUE(worker_process_.IsValid());
- mojo::MessagePipe pipe;
- client_channel_handle_ = std::move(pipe.handle0);
+ channel_name_ = IPC::Channel::GenerateUniqueRandomChannelID();
+ ScopedHandle pipe;
+ ASSERT_TRUE(CreateIpcChannel(channel_name_, kIpcSecurityDescriptor, &pipe));
// Wrap the pipe into an IPC channel.
channel_server_ = IPC::ChannelProxy::Create(
- pipe.handle1.release(), IPC::Channel::MODE_SERVER, this, task_runner_);
+ IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, this,
+ task_runner_);
HANDLE temp_handle;
ASSERT_TRUE(DuplicateHandle(GetCurrentProcess(), worker_process_.Get(),
« no previous file with comments | « remoting/host/win/unprivileged_process_delegate.cc ('k') | remoting/host/win/wts_session_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698