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

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

Issue 14305004: Simplify ScreenCapturer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « remoting/host/desktop_session_proxy.cc ('k') | remoting/host/ipc_video_frame_capturer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 10 #include "base/message_loop.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 .Times(0); 488 .Times(0);
489 489
490 // Stop the test. 490 // Stop the test.
491 DeleteDesktopEnvironment(); 491 DeleteDesktopEnvironment();
492 492
493 task_runner_ = NULL; 493 task_runner_ = NULL;
494 io_task_runner_ = NULL; 494 io_task_runner_ = NULL;
495 main_run_loop_.Run(); 495 main_run_loop_.Run();
496 } 496 }
497 497
498 // Tests InvalidateRegion().
499 TEST_F(IpcDesktopEnvironmentTest, InvalidateRegion) {
500 scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
501 new protocol::MockClipboardStub());
502 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
503 .Times(0);
504
505 // Start the input injector and screen capturer.
506 input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
507 video_capturer_->Start(&screen_capturer_delegate_);
508
509 // Run the message loop until the desktop is attached.
510 setup_run_loop_->Run();
511
512 // Input injector should receive no events.
513 EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
514 .Times(0);
515 EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
516 .Times(0);
517 EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
518 .Times(0);
519
520 // Stop the test when the first frame is captured.
521 EXPECT_CALL(screen_capturer_delegate_, OnCaptureCompleted(_))
522 .WillOnce(InvokeWithoutArgs(
523 this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment));
524
525 // Invalidate a region that is larger than the screen.
526 SkIRect horizontal_rect = SkIRect::MakeXYWH(
527 -100,
528 media::ScreenCapturerFake::kHeight / 4,
529 media::ScreenCapturerFake::kWidth + 200,
530 media::ScreenCapturerFake::kHeight / 2);
531 SkIRect vertical_rect = SkIRect::MakeXYWH(
532 media::ScreenCapturerFake::kWidth / 4,
533 -100,
534 media::ScreenCapturerFake::kWidth / 2,
535 media::ScreenCapturerFake::kHeight + 200);
536
537 SkRegion invalid_region;
538 invalid_region.op(horizontal_rect, SkRegion::kUnion_Op);
539 invalid_region.op(vertical_rect, SkRegion::kUnion_Op);
540 video_capturer_->InvalidateRegion(invalid_region);
541
542 // Capture a single frame.
543 video_capturer_->CaptureFrame();
544
545 task_runner_ = NULL;
546 io_task_runner_ = NULL;
547 main_run_loop_.Run();
548 }
549
550 // Tests injection of clipboard events. 498 // Tests injection of clipboard events.
551 TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) { 499 TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {
552 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( 500 scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
553 new protocol::MockClipboardStub()); 501 new protocol::MockClipboardStub());
554 clipboard_stub_ = clipboard_stub.get(); 502 clipboard_stub_ = clipboard_stub.get();
555 503
556 // Stop the test when a clipboard event is received from the desktop process. 504 // Stop the test when a clipboard event is received from the desktop process.
557 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) 505 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
558 .Times(1) 506 .Times(1)
559 .WillOnce(InvokeWithoutArgs( 507 .WillOnce(InvokeWithoutArgs(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 event.set_x(0); 599 event.set_x(0);
652 event.set_y(0); 600 event.set_y(0);
653 input_injector_->InjectMouseEvent(event); 601 input_injector_->InjectMouseEvent(event);
654 602
655 task_runner_ = NULL; 603 task_runner_ = NULL;
656 io_task_runner_ = NULL; 604 io_task_runner_ = NULL;
657 main_run_loop_.Run(); 605 main_run_loop_.Run();
658 } 606 }
659 607
660 } // namespace remoting 608 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_proxy.cc ('k') | remoting/host/ipc_video_frame_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698