OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
14 #include "base/process/process.h" | 16 #include "base/process/process.h" |
15 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
16 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( | 412 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( |
411 new MockDesktopEnvironmentFactory()); | 413 new MockDesktopEnvironmentFactory()); |
412 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) | 414 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) |
413 .Times(AnyNumber()) | 415 .Times(AnyNumber()) |
414 .WillRepeatedly(Invoke( | 416 .WillRepeatedly(Invoke( |
415 this, &IpcDesktopEnvironmentTest::CreateDesktopEnvironment)); | 417 this, &IpcDesktopEnvironmentTest::CreateDesktopEnvironment)); |
416 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) | 418 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) |
417 .Times(AnyNumber()) | 419 .Times(AnyNumber()) |
418 .WillRepeatedly(Return(false)); | 420 .WillRepeatedly(Return(false)); |
419 | 421 |
420 EXPECT_TRUE(desktop_process_->Start(desktop_environment_factory.Pass())); | 422 EXPECT_TRUE(desktop_process_->Start(std::move(desktop_environment_factory))); |
421 } | 423 } |
422 | 424 |
423 void IpcDesktopEnvironmentTest::DestoyDesktopProcess() { | 425 void IpcDesktopEnvironmentTest::DestoyDesktopProcess() { |
424 desktop_channel_.reset(); | 426 desktop_channel_.reset(); |
425 if (desktop_process_) { | 427 if (desktop_process_) { |
426 desktop_process_->OnChannelError(); | 428 desktop_process_->OnChannelError(); |
427 desktop_process_.reset(); | 429 desktop_process_.reset(); |
428 } | 430 } |
429 remote_input_injector_ = nullptr; | 431 remote_input_injector_ = nullptr; |
430 } | 432 } |
(...skipping 24 matching lines...) Expand all Loading... |
455 } | 457 } |
456 | 458 |
457 // Runs until the desktop is attached and exits immediately after that. | 459 // Runs until the desktop is attached and exits immediately after that. |
458 TEST_F(IpcDesktopEnvironmentTest, Basic) { | 460 TEST_F(IpcDesktopEnvironmentTest, Basic) { |
459 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 461 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
460 new protocol::MockClipboardStub()); | 462 new protocol::MockClipboardStub()); |
461 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 463 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
462 .Times(0); | 464 .Times(0); |
463 | 465 |
464 // Start the input injector and screen capturer. | 466 // Start the input injector and screen capturer. |
465 input_injector_->Start(clipboard_stub.Pass()); | 467 input_injector_->Start(std::move(clipboard_stub)); |
466 | 468 |
467 // Run the message loop until the desktop is attached. | 469 // Run the message loop until the desktop is attached. |
468 setup_run_loop_->Run(); | 470 setup_run_loop_->Run(); |
469 | 471 |
470 // Stop the test. | 472 // Stop the test. |
471 DeleteDesktopEnvironment(); | 473 DeleteDesktopEnvironment(); |
472 } | 474 } |
473 | 475 |
474 // Check Capabilities. | 476 // Check Capabilities. |
475 TEST_F(IpcDesktopEnvironmentTest, CapabilitiesNoTouch) { | 477 TEST_F(IpcDesktopEnvironmentTest, CapabilitiesNoTouch) { |
476 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 478 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
477 new protocol::MockClipboardStub()); | 479 new protocol::MockClipboardStub()); |
478 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 480 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
479 .Times(0); | 481 .Times(0); |
480 | 482 |
481 EXPECT_EQ("rateLimitResizeRequests", desktop_environment_->GetCapabilities()); | 483 EXPECT_EQ("rateLimitResizeRequests", desktop_environment_->GetCapabilities()); |
482 | 484 |
483 // Start the input injector and screen capturer. | 485 // Start the input injector and screen capturer. |
484 input_injector_->Start(clipboard_stub.Pass()); | 486 input_injector_->Start(std::move(clipboard_stub)); |
485 | 487 |
486 // Run the message loop until the desktop is attached. | 488 // Run the message loop until the desktop is attached. |
487 setup_run_loop_->Run(); | 489 setup_run_loop_->Run(); |
488 | 490 |
489 // Stop the test. | 491 // Stop the test. |
490 DeleteDesktopEnvironment(); | 492 DeleteDesktopEnvironment(); |
491 } | 493 } |
492 | 494 |
493 // Check touchEvents capability is set when the desktop environment can | 495 // Check touchEvents capability is set when the desktop environment can |
494 // inject touch events. | 496 // inject touch events. |
495 TEST_F(IpcDesktopEnvironmentTest, TouchEventsCapabilities) { | 497 TEST_F(IpcDesktopEnvironmentTest, TouchEventsCapabilities) { |
496 // Create an environment with multi touch enabled. | 498 // Create an environment with multi touch enabled. |
497 desktop_environment_factory_->set_supports_touch_events(true); | 499 desktop_environment_factory_->set_supports_touch_events(true); |
498 desktop_environment_ = desktop_environment_factory_->Create( | 500 desktop_environment_ = desktop_environment_factory_->Create( |
499 client_session_control_factory_.GetWeakPtr()); | 501 client_session_control_factory_.GetWeakPtr()); |
500 | 502 |
501 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 503 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
502 new protocol::MockClipboardStub()); | 504 new protocol::MockClipboardStub()); |
503 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 505 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
504 .Times(0); | 506 .Times(0); |
505 | 507 |
506 EXPECT_EQ("rateLimitResizeRequests touchEvents", | 508 EXPECT_EQ("rateLimitResizeRequests touchEvents", |
507 desktop_environment_->GetCapabilities()); | 509 desktop_environment_->GetCapabilities()); |
508 | 510 |
509 // Start the input injector and screen capturer. | 511 // Start the input injector and screen capturer. |
510 input_injector_->Start(clipboard_stub.Pass()); | 512 input_injector_->Start(std::move(clipboard_stub)); |
511 | 513 |
512 // Run the message loop until the desktop is attached. | 514 // Run the message loop until the desktop is attached. |
513 setup_run_loop_->Run(); | 515 setup_run_loop_->Run(); |
514 | 516 |
515 // Stop the test. | 517 // Stop the test. |
516 DeleteDesktopEnvironment(); | 518 DeleteDesktopEnvironment(); |
517 } | 519 } |
518 | 520 |
519 // Tests that the video capturer receives a frame over IPC. | 521 // Tests that the video capturer receives a frame over IPC. |
520 TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) { | 522 TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) { |
521 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 523 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
522 new protocol::MockClipboardStub()); | 524 new protocol::MockClipboardStub()); |
523 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 525 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
524 .Times(0); | 526 .Times(0); |
525 | 527 |
526 // Start the input injector and screen capturer. | 528 // Start the input injector and screen capturer. |
527 input_injector_->Start(clipboard_stub.Pass()); | 529 input_injector_->Start(std::move(clipboard_stub)); |
528 video_capturer_->Start(&desktop_capturer_callback_); | 530 video_capturer_->Start(&desktop_capturer_callback_); |
529 | 531 |
530 // Run the message loop until the desktop is attached. | 532 // Run the message loop until the desktop is attached. |
531 setup_run_loop_->Run(); | 533 setup_run_loop_->Run(); |
532 | 534 |
533 // Stop the test when the first frame is captured. | 535 // Stop the test when the first frame is captured. |
534 EXPECT_CALL(desktop_capturer_callback_, OnCaptureCompleted(_)) | 536 EXPECT_CALL(desktop_capturer_callback_, OnCaptureCompleted(_)) |
535 .WillOnce(DoAll( | 537 .WillOnce(DoAll( |
536 DeleteArg<0>(), | 538 DeleteArg<0>(), |
537 InvokeWithoutArgs( | 539 InvokeWithoutArgs( |
538 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment))); | 540 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment))); |
539 | 541 |
540 // Capture a single frame. | 542 // Capture a single frame. |
541 video_capturer_->Capture(webrtc::DesktopRegion()); | 543 video_capturer_->Capture(webrtc::DesktopRegion()); |
542 } | 544 } |
543 | 545 |
544 // Tests that attaching to a new desktop works. | 546 // Tests that attaching to a new desktop works. |
545 TEST_F(IpcDesktopEnvironmentTest, Reattach) { | 547 TEST_F(IpcDesktopEnvironmentTest, Reattach) { |
546 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 548 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
547 new protocol::MockClipboardStub()); | 549 new protocol::MockClipboardStub()); |
548 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 550 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
549 .Times(0); | 551 .Times(0); |
550 | 552 |
551 // Start the input injector and screen capturer. | 553 // Start the input injector and screen capturer. |
552 input_injector_->Start(clipboard_stub.Pass()); | 554 input_injector_->Start(std::move(clipboard_stub)); |
553 video_capturer_->Start(&desktop_capturer_callback_); | 555 video_capturer_->Start(&desktop_capturer_callback_); |
554 | 556 |
555 // Run the message loop until the desktop is attached. | 557 // Run the message loop until the desktop is attached. |
556 setup_run_loop_->Run(); | 558 setup_run_loop_->Run(); |
557 | 559 |
558 // Create and start a new desktop process object. | 560 // Create and start a new desktop process object. |
559 setup_run_loop_.reset(new base::RunLoop()); | 561 setup_run_loop_.reset(new base::RunLoop()); |
560 DestoyDesktopProcess(); | 562 DestoyDesktopProcess(); |
561 CreateDesktopProcess(); | 563 CreateDesktopProcess(); |
562 setup_run_loop_->Run(); | 564 setup_run_loop_->Run(); |
563 | 565 |
564 // Stop the test. | 566 // Stop the test. |
565 DeleteDesktopEnvironment(); | 567 DeleteDesktopEnvironment(); |
566 } | 568 } |
567 | 569 |
568 // Tests injection of clipboard events. | 570 // Tests injection of clipboard events. |
569 TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) { | 571 TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) { |
570 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 572 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
571 new protocol::MockClipboardStub()); | 573 new protocol::MockClipboardStub()); |
572 clipboard_stub_ = clipboard_stub.get(); | 574 clipboard_stub_ = clipboard_stub.get(); |
573 | 575 |
574 // Stop the test when a clipboard event is received from the desktop process. | 576 // Stop the test when a clipboard event is received from the desktop process. |
575 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 577 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
576 .Times(1) | 578 .Times(1) |
577 .WillOnce(InvokeWithoutArgs( | 579 .WillOnce(InvokeWithoutArgs( |
578 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); | 580 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); |
579 | 581 |
580 // Start the input injector and screen capturer. | 582 // Start the input injector and screen capturer. |
581 input_injector_->Start(clipboard_stub.Pass()); | 583 input_injector_->Start(std::move(clipboard_stub)); |
582 video_capturer_->Start(&desktop_capturer_callback_); | 584 video_capturer_->Start(&desktop_capturer_callback_); |
583 | 585 |
584 // Run the message loop until the desktop is attached. | 586 // Run the message loop until the desktop is attached. |
585 setup_run_loop_->Run(); | 587 setup_run_loop_->Run(); |
586 | 588 |
587 // Expect a single clipboard event. | 589 // Expect a single clipboard event. |
588 EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) | 590 EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) |
589 .Times(1) | 591 .Times(1) |
590 .WillOnce(Invoke(this, | 592 .WillOnce(Invoke(this, |
591 &IpcDesktopEnvironmentTest::ReflectClipboardEvent)); | 593 &IpcDesktopEnvironmentTest::ReflectClipboardEvent)); |
592 | 594 |
593 // Send a clipboard event. | 595 // Send a clipboard event. |
594 protocol::ClipboardEvent event; | 596 protocol::ClipboardEvent event; |
595 event.set_mime_type(kMimeTypeTextUtf8); | 597 event.set_mime_type(kMimeTypeTextUtf8); |
596 event.set_data("a"); | 598 event.set_data("a"); |
597 input_injector_->InjectClipboardEvent(event); | 599 input_injector_->InjectClipboardEvent(event); |
598 } | 600 } |
599 | 601 |
600 // Tests injection of key events. | 602 // Tests injection of key events. |
601 TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) { | 603 TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) { |
602 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 604 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
603 new protocol::MockClipboardStub()); | 605 new protocol::MockClipboardStub()); |
604 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 606 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
605 .Times(0); | 607 .Times(0); |
606 | 608 |
607 // Start the input injector and screen capturer. | 609 // Start the input injector and screen capturer. |
608 input_injector_->Start(clipboard_stub.Pass()); | 610 input_injector_->Start(std::move(clipboard_stub)); |
609 video_capturer_->Start(&desktop_capturer_callback_); | 611 video_capturer_->Start(&desktop_capturer_callback_); |
610 | 612 |
611 // Run the message loop until the desktop is attached. | 613 // Run the message loop until the desktop is attached. |
612 setup_run_loop_->Run(); | 614 setup_run_loop_->Run(); |
613 | 615 |
614 // Expect a single key event. | 616 // Expect a single key event. |
615 EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) | 617 EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) |
616 .Times(AtLeast(1)) | 618 .Times(AtLeast(1)) |
617 .WillRepeatedly(InvokeWithoutArgs( | 619 .WillRepeatedly(InvokeWithoutArgs( |
618 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); | 620 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); |
619 | 621 |
620 // Send a key event. | 622 // Send a key event. |
621 protocol::KeyEvent event; | 623 protocol::KeyEvent event; |
622 event.set_usb_keycode(0x070004); | 624 event.set_usb_keycode(0x070004); |
623 event.set_pressed(true); | 625 event.set_pressed(true); |
624 input_injector_->InjectKeyEvent(event); | 626 input_injector_->InjectKeyEvent(event); |
625 } | 627 } |
626 | 628 |
627 // Tests injection of text events. | 629 // Tests injection of text events. |
628 TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) { | 630 TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) { |
629 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 631 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
630 new protocol::MockClipboardStub()); | 632 new protocol::MockClipboardStub()); |
631 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 633 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
632 .Times(0); | 634 .Times(0); |
633 | 635 |
634 // Start the input injector and screen capturer. | 636 // Start the input injector and screen capturer. |
635 input_injector_->Start(clipboard_stub.Pass()); | 637 input_injector_->Start(std::move(clipboard_stub)); |
636 video_capturer_->Start(&desktop_capturer_callback_); | 638 video_capturer_->Start(&desktop_capturer_callback_); |
637 | 639 |
638 // Run the message loop until the desktop is attached. | 640 // Run the message loop until the desktop is attached. |
639 setup_run_loop_->Run(); | 641 setup_run_loop_->Run(); |
640 | 642 |
641 // Expect a single text event. | 643 // Expect a single text event. |
642 EXPECT_CALL(*remote_input_injector_, InjectTextEvent(_)) | 644 EXPECT_CALL(*remote_input_injector_, InjectTextEvent(_)) |
643 .Times(AtLeast(1)) | 645 .Times(AtLeast(1)) |
644 .WillRepeatedly(InvokeWithoutArgs( | 646 .WillRepeatedly(InvokeWithoutArgs( |
645 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); | 647 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); |
646 | 648 |
647 // Send a text event. | 649 // Send a text event. |
648 protocol::TextEvent event; | 650 protocol::TextEvent event; |
649 event.set_text("hello"); | 651 event.set_text("hello"); |
650 input_injector_->InjectTextEvent(event); | 652 input_injector_->InjectTextEvent(event); |
651 } | 653 } |
652 | 654 |
653 // Tests injection of mouse events. | 655 // Tests injection of mouse events. |
654 TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) { | 656 TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) { |
655 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 657 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
656 new protocol::MockClipboardStub()); | 658 new protocol::MockClipboardStub()); |
657 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 659 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
658 .Times(0); | 660 .Times(0); |
659 | 661 |
660 // Start the input injector and screen capturer. | 662 // Start the input injector and screen capturer. |
661 input_injector_->Start(clipboard_stub.Pass()); | 663 input_injector_->Start(std::move(clipboard_stub)); |
662 video_capturer_->Start(&desktop_capturer_callback_); | 664 video_capturer_->Start(&desktop_capturer_callback_); |
663 | 665 |
664 // Run the message loop until the desktop is attached. | 666 // Run the message loop until the desktop is attached. |
665 setup_run_loop_->Run(); | 667 setup_run_loop_->Run(); |
666 | 668 |
667 // Expect a single mouse event. | 669 // Expect a single mouse event. |
668 EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) | 670 EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) |
669 .Times(1) | 671 .Times(1) |
670 .WillOnce(InvokeWithoutArgs( | 672 .WillOnce(InvokeWithoutArgs( |
671 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); | 673 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); |
672 | 674 |
673 // Send a mouse event. | 675 // Send a mouse event. |
674 protocol::MouseEvent event; | 676 protocol::MouseEvent event; |
675 event.set_x(0); | 677 event.set_x(0); |
676 event.set_y(0); | 678 event.set_y(0); |
677 input_injector_->InjectMouseEvent(event); | 679 input_injector_->InjectMouseEvent(event); |
678 } | 680 } |
679 | 681 |
680 // Tests injection of touch events. | 682 // Tests injection of touch events. |
681 TEST_F(IpcDesktopEnvironmentTest, InjectTouchEvent) { | 683 TEST_F(IpcDesktopEnvironmentTest, InjectTouchEvent) { |
682 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 684 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
683 new protocol::MockClipboardStub()); | 685 new protocol::MockClipboardStub()); |
684 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 686 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
685 .Times(0); | 687 .Times(0); |
686 | 688 |
687 // Start the input injector and screen capturer. | 689 // Start the input injector and screen capturer. |
688 input_injector_->Start(clipboard_stub.Pass()); | 690 input_injector_->Start(std::move(clipboard_stub)); |
689 video_capturer_->Start(&desktop_capturer_callback_); | 691 video_capturer_->Start(&desktop_capturer_callback_); |
690 | 692 |
691 // Run the message loop until the desktop is attached. | 693 // Run the message loop until the desktop is attached. |
692 setup_run_loop_->Run(); | 694 setup_run_loop_->Run(); |
693 | 695 |
694 protocol::TouchEvent event; | 696 protocol::TouchEvent event; |
695 event.set_event_type(protocol::TouchEvent::TOUCH_POINT_START); | 697 event.set_event_type(protocol::TouchEvent::TOUCH_POINT_START); |
696 protocol::TouchEventPoint* point = event.add_touch_points(); | 698 protocol::TouchEventPoint* point = event.add_touch_points(); |
697 point->set_id(0u); | 699 point->set_id(0u); |
698 point->set_x(0.0f); | 700 point->set_x(0.0f); |
(...skipping 21 matching lines...) Expand all Loading... |
720 } | 722 } |
721 | 723 |
722 // Tests that setting the desktop resolution works. | 724 // Tests that setting the desktop resolution works. |
723 TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) { | 725 TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) { |
724 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 726 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
725 new protocol::MockClipboardStub()); | 727 new protocol::MockClipboardStub()); |
726 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 728 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
727 .Times(0); | 729 .Times(0); |
728 | 730 |
729 // Start the input injector and screen capturer. | 731 // Start the input injector and screen capturer. |
730 input_injector_->Start(clipboard_stub.Pass()); | 732 input_injector_->Start(std::move(clipboard_stub)); |
731 video_capturer_->Start(&desktop_capturer_callback_); | 733 video_capturer_->Start(&desktop_capturer_callback_); |
732 | 734 |
733 // Run the message loop until the desktop is attached. | 735 // Run the message loop until the desktop is attached. |
734 setup_run_loop_->Run(); | 736 setup_run_loop_->Run(); |
735 | 737 |
736 EXPECT_CALL(daemon_channel_, SetScreenResolution(_, _)) | 738 EXPECT_CALL(daemon_channel_, SetScreenResolution(_, _)) |
737 .Times(1) | 739 .Times(1) |
738 .WillOnce(InvokeWithoutArgs( | 740 .WillOnce(InvokeWithoutArgs( |
739 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); | 741 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); |
740 | 742 |
741 // Change the desktop resolution. | 743 // Change the desktop resolution. |
742 screen_controls_->SetScreenResolution(ScreenResolution( | 744 screen_controls_->SetScreenResolution(ScreenResolution( |
743 webrtc::DesktopSize(100, 100), | 745 webrtc::DesktopSize(100, 100), |
744 webrtc::DesktopVector(96, 96))); | 746 webrtc::DesktopVector(96, 96))); |
745 } | 747 } |
746 | 748 |
747 } // namespace remoting | 749 } // namespace remoting |
OLD | NEW |