| OLD | NEW |
| 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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
| 10 #include "base/win/scoped_process_information.h" | 10 #include "base/win/scoped_process_information.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 void WorkerProcessLauncherTest::TerminateWorker(DWORD exit_code) { | 271 void WorkerProcessLauncherTest::TerminateWorker(DWORD exit_code) { |
| 272 if (worker_process_.IsValid()) | 272 if (worker_process_.IsValid()) |
| 273 TerminateProcess(worker_process_.Get(), exit_code); | 273 TerminateProcess(worker_process_.Get(), exit_code); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void WorkerProcessLauncherTest::ConnectClient() { | 276 void WorkerProcessLauncherTest::ConnectClient() { |
| 277 channel_client_ = IPC::ChannelProxy::Create(IPC::ChannelHandle(channel_name_), | 277 channel_client_ = IPC::ChannelProxy::Create(IPC::ChannelHandle(channel_name_), |
| 278 IPC::Channel::MODE_CLIENT, | 278 IPC::Channel::MODE_CLIENT, |
| 279 &client_listener_, | 279 &client_listener_, |
| 280 task_runner_, | 280 task_runner_); |
| 281 nullptr); | |
| 282 | 281 |
| 283 // Pretend that |kLaunchSuccessTimeoutSeconds| passed since launching | 282 // Pretend that |kLaunchSuccessTimeoutSeconds| passed since launching |
| 284 // the worker process. This will make the backoff algorithm think that this | 283 // the worker process. This will make the backoff algorithm think that this |
| 285 // launch attempt was successful and it will not delay the next launch. | 284 // launch attempt was successful and it will not delay the next launch. |
| 286 launcher_->RecordSuccessfulLaunchForTest(); | 285 launcher_->RecordSuccessfulLaunchForTest(); |
| 287 } | 286 } |
| 288 | 287 |
| 289 void WorkerProcessLauncherTest::DisconnectClient() { | 288 void WorkerProcessLauncherTest::DisconnectClient() { |
| 290 channel_client_.reset(); | 289 channel_client_.reset(); |
| 291 } | 290 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 worker_process_.Set(process_information.TakeProcessHandle()); | 357 worker_process_.Set(process_information.TakeProcessHandle()); |
| 359 ASSERT_TRUE(worker_process_.IsValid()); | 358 ASSERT_TRUE(worker_process_.IsValid()); |
| 360 | 359 |
| 361 channel_name_ = IPC::Channel::GenerateUniqueRandomChannelID(); | 360 channel_name_ = IPC::Channel::GenerateUniqueRandomChannelID(); |
| 362 ScopedHandle pipe; | 361 ScopedHandle pipe; |
| 363 ASSERT_TRUE(CreateIpcChannel(channel_name_, kIpcSecurityDescriptor, &pipe)); | 362 ASSERT_TRUE(CreateIpcChannel(channel_name_, kIpcSecurityDescriptor, &pipe)); |
| 364 | 363 |
| 365 // Wrap the pipe into an IPC channel. | 364 // Wrap the pipe into an IPC channel. |
| 366 channel_server_ = IPC::ChannelProxy::Create( | 365 channel_server_ = IPC::ChannelProxy::Create( |
| 367 IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, this, | 366 IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, this, |
| 368 task_runner_, nullptr); | 367 task_runner_); |
| 369 | 368 |
| 370 HANDLE temp_handle; | 369 HANDLE temp_handle; |
| 371 ASSERT_TRUE(DuplicateHandle(GetCurrentProcess(), | 370 ASSERT_TRUE(DuplicateHandle(GetCurrentProcess(), |
| 372 worker_process_.Get(), | 371 worker_process_.Get(), |
| 373 GetCurrentProcess(), | 372 GetCurrentProcess(), |
| 374 &temp_handle, | 373 &temp_handle, |
| 375 0, | 374 0, |
| 376 FALSE, | 375 FALSE, |
| 377 DUPLICATE_SAME_ACCESS)); | 376 DUPLICATE_SAME_ACCESS)); |
| 378 ScopedHandle copy(temp_handle); | 377 ScopedHandle copy(temp_handle); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) | 524 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) |
| 526 .Times(1) | 525 .Times(1) |
| 527 .WillOnce(InvokeWithoutArgs( | 526 .WillOnce(InvokeWithoutArgs( |
| 528 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); | 527 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); |
| 529 | 528 |
| 530 StartWorker(); | 529 StartWorker(); |
| 531 message_loop_.Run(); | 530 message_loop_.Run(); |
| 532 } | 531 } |
| 533 | 532 |
| 534 } // namespace remoting | 533 } // namespace remoting |
| OLD | NEW |