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 "remoting/host/win/worker_process_launcher.h" | 5 #include "remoting/host/win/worker_process_launcher.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // restarted. | 417 // restarted. |
418 TEST_F(WorkerProcessLauncherTest, Restart) { | 418 TEST_F(WorkerProcessLauncherTest, Restart) { |
419 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) | 419 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) |
420 .Times(2) | 420 .Times(2) |
421 .WillRepeatedly(Invoke( | 421 .WillRepeatedly(Invoke( |
422 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); | 422 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); |
423 Expectation first_connect = | 423 Expectation first_connect = |
424 EXPECT_CALL(server_listener_, OnChannelConnected(_)) | 424 EXPECT_CALL(server_listener_, OnChannelConnected(_)) |
425 .Times(2) | 425 .Times(2) |
426 .WillOnce(InvokeWithoutArgs(CreateFunctor( | 426 .WillOnce(InvokeWithoutArgs(CreateFunctor( |
427 this, &WorkerProcessLauncherTest::TerminateWorker, | 427 &WorkerProcessLauncherTest::TerminateWorker, |
| 428 base::Unretained(this), |
428 CONTROL_C_EXIT))) | 429 CONTROL_C_EXIT))) |
429 .WillOnce(InvokeWithoutArgs(this, | 430 .WillOnce(InvokeWithoutArgs(this, |
430 &WorkerProcessLauncherTest::StopWorker)); | 431 &WorkerProcessLauncherTest::StopWorker)); |
431 | 432 |
432 EXPECT_CALL(server_listener_, OnPermanentError(_)) | 433 EXPECT_CALL(server_listener_, OnPermanentError(_)) |
433 .Times(0); | 434 .Times(0); |
434 | 435 |
435 StartWorker(); | 436 StartWorker(); |
436 message_loop_.Run(); | 437 message_loop_.Run(); |
437 } | 438 } |
(...skipping 25 matching lines...) Expand all Loading... |
463 // invoked. | 464 // invoked. |
464 TEST_F(WorkerProcessLauncherTest, PermanentError) { | 465 TEST_F(WorkerProcessLauncherTest, PermanentError) { |
465 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) | 466 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) |
466 .Times(1) | 467 .Times(1) |
467 .WillRepeatedly(Invoke( | 468 .WillRepeatedly(Invoke( |
468 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); | 469 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); |
469 | 470 |
470 EXPECT_CALL(server_listener_, OnChannelConnected(_)) | 471 EXPECT_CALL(server_listener_, OnChannelConnected(_)) |
471 .Times(1) | 472 .Times(1) |
472 .WillOnce(InvokeWithoutArgs(CreateFunctor( | 473 .WillOnce(InvokeWithoutArgs(CreateFunctor( |
473 this, &WorkerProcessLauncherTest::TerminateWorker, | 474 &WorkerProcessLauncherTest::TerminateWorker, |
| 475 base::Unretained(this), |
474 kMinPermanentErrorExitCode))); | 476 kMinPermanentErrorExitCode))); |
475 EXPECT_CALL(server_listener_, OnPermanentError(_)) | 477 EXPECT_CALL(server_listener_, OnPermanentError(_)) |
476 .Times(1) | 478 .Times(1) |
477 .WillOnce(InvokeWithoutArgs(this, | 479 .WillOnce(InvokeWithoutArgs(this, |
478 &WorkerProcessLauncherTest::StopWorker)); | 480 &WorkerProcessLauncherTest::StopWorker)); |
479 | 481 |
480 StartWorker(); | 482 StartWorker(); |
481 message_loop_.Run(); | 483 message_loop_.Run(); |
482 } | 484 } |
483 | 485 |
484 // Requests the worker to crash and expects it to honor the request. | 486 // Requests the worker to crash and expects it to honor the request. |
485 TEST_F(WorkerProcessLauncherTest, Crash) { | 487 TEST_F(WorkerProcessLauncherTest, Crash) { |
486 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) | 488 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) |
487 .Times(2) | 489 .Times(2) |
488 .WillRepeatedly(Invoke( | 490 .WillRepeatedly(Invoke( |
489 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); | 491 this, &WorkerProcessLauncherTest::LaunchProcessAndConnect)); |
490 | 492 |
491 EXPECT_CALL(server_listener_, OnChannelConnected(_)) | 493 EXPECT_CALL(server_listener_, OnChannelConnected(_)) |
492 .Times(2) | 494 .Times(2) |
493 .WillOnce(InvokeWithoutArgs(this, | 495 .WillOnce(InvokeWithoutArgs(this, |
494 &WorkerProcessLauncherTest::CrashWorker)) | 496 &WorkerProcessLauncherTest::CrashWorker)) |
495 .WillOnce(InvokeWithoutArgs(this, | 497 .WillOnce(InvokeWithoutArgs(this, |
496 &WorkerProcessLauncherTest::StopWorker)); | 498 &WorkerProcessLauncherTest::StopWorker)); |
497 | 499 |
498 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) | 500 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) |
499 .Times(1) | 501 .Times(1) |
500 .WillOnce(InvokeWithoutArgs(CreateFunctor( | 502 .WillOnce(InvokeWithoutArgs(CreateFunctor( |
501 this, &WorkerProcessLauncherTest::TerminateWorker, | 503 &WorkerProcessLauncherTest::TerminateWorker, |
| 504 base::Unretained(this), |
502 EXCEPTION_BREAKPOINT))); | 505 EXCEPTION_BREAKPOINT))); |
503 | 506 |
504 StartWorker(); | 507 StartWorker(); |
505 message_loop_.Run(); | 508 message_loop_.Run(); |
506 } | 509 } |
507 | 510 |
508 // Requests the worker to crash and terminates the worker even if it does not | 511 // Requests the worker to crash and terminates the worker even if it does not |
509 // comply. | 512 // comply. |
510 TEST_F(WorkerProcessLauncherTest, CrashAnyway) { | 513 TEST_F(WorkerProcessLauncherTest, CrashAnyway) { |
511 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) | 514 EXPECT_CALL(*launcher_delegate_, LaunchProcess(_)) |
(...skipping 12 matching lines...) Expand all Loading... |
524 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) | 527 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) |
525 .Times(1) | 528 .Times(1) |
526 .WillOnce(InvokeWithoutArgs( | 529 .WillOnce(InvokeWithoutArgs( |
527 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); | 530 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); |
528 | 531 |
529 StartWorker(); | 532 StartWorker(); |
530 message_loop_.Run(); | 533 message_loop_.Run(); |
531 } | 534 } |
532 | 535 |
533 } // namespace remoting | 536 } // namespace remoting |
OLD | NEW |