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