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

Side by Side Diff: remoting/host/desktop_process_main.cc

Issue 12096071: Adding a unit test to verify the IPC channel between the network and desktop processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/desktop_process_main.h" 8 #include "remoting/host/desktop_process_main.h"
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 std::string channel_name = 115 std::string channel_name =
116 command_line->GetSwitchValueASCII(kDaemonIpcSwitchName); 116 command_line->GetSwitchValueASCII(kDaemonIpcSwitchName);
117 117
118 if (channel_name.empty()) { 118 if (channel_name.empty()) {
119 Usage(command_line->GetProgram()); 119 Usage(command_line->GetProgram());
120 return kUsageExitCode; 120 return kUsageExitCode;
121 } 121 }
122 122
123 MessageLoop message_loop(MessageLoop::TYPE_UI); 123 MessageLoop message_loop(MessageLoop::TYPE_UI);
124 base::RunLoop run_loop; 124 base::RunLoop run_loop;
125 base::Closure quit_ui_task_runner = base::Bind(
126 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
127 message_loop.message_loop_proxy(),
128 FROM_HERE, run_loop.QuitClosure());
129 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = 125 scoped_refptr<AutoThreadTaskRunner> ui_task_runner =
130 new AutoThreadTaskRunner(message_loop.message_loop_proxy(), 126 new AutoThreadTaskRunner(message_loop.message_loop_proxy(),
131 quit_ui_task_runner); 127 run_loop.QuitClosure());
132 128
133 DesktopProcess desktop_process(ui_task_runner, channel_name); 129 DesktopProcess desktop_process(ui_task_runner, channel_name);
134 130
135 // Create proper kind of desktop environment factory. 131 // Create proper kind of desktop environment factory.
136 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory; 132 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory;
137 #if defined(OS_WIN) 133 #if defined(OS_WIN)
138 desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory( 134 desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory(
139 base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr()))); 135 base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr())));
140 #else // !defined(OS_WIN) 136 #else // !defined(OS_WIN)
141 desktop_environment_factory.reset(new BasicDesktopEnvironmentFactory()); 137 desktop_environment_factory.reset(new BasicDesktopEnvironmentFactory());
142 #endif // !defined(OS_WIN) 138 #endif // !defined(OS_WIN)
143 139
144 if (!desktop_process.Start(desktop_environment_factory.Pass())) 140 if (!desktop_process.Start(desktop_environment_factory.Pass()))
145 return kInitializationFailed; 141 return kInitializationFailed;
146 142
147 // Run the UI message loop. 143 // Run the UI message loop.
148 ui_task_runner = NULL; 144 ui_task_runner = NULL;
149 run_loop.Run(); 145 run_loop.Run();
150 146
151 return kSuccessExitCode; 147 return kSuccessExitCode;
152 } 148 }
153 149
154 } // namespace remoting 150 } // namespace remoting
155 151
156 #if !defined(OS_WIN) 152 #if !defined(OS_WIN)
157 int main(int argc, char** argv) { 153 int main(int argc, char** argv) {
158 return remoting::DesktopProcessMain(argc, argv); 154 return remoting::DesktopProcessMain(argc, argv);
159 } 155 }
160 #endif // !defined(OS_WIN) 156 #endif // !defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698