| Index: remoting/host/video_frame_capturer_unittest.cc
|
| diff --git a/remoting/host/video_frame_capturer_unittest.cc b/remoting/host/video_frame_capturer_unittest.cc
|
| index 4ad0a1b8ca5a937056883a01a6823f0cc49da4fa..35ff24b2622816fa1189f223b1e6d01d345686a8 100644
|
| --- a/remoting/host/video_frame_capturer_unittest.cc
|
| +++ b/remoting/host/video_frame_capturer_unittest.cc
|
| @@ -14,11 +14,37 @@
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +using ::testing::_;
|
| +
|
| namespace remoting {
|
|
|
| namespace {
|
|
|
| -void IgnoreCursorShapeChanged(scoped_ptr<protocol::CursorShapeInfo> info) {
|
| +class MockCapturerDelegate : public VideoFrameCapturer::Delegate {
|
| + public:
|
| + MockCapturerDelegate();
|
| + virtual ~MockCapturerDelegate();
|
| +
|
| + virtual void OnCursorShapeChanged(
|
| + scoped_ptr<protocol::CursorShapeInfo> cursor_shape) OVERRIDE;
|
| +
|
| + MOCK_METHOD1(OnCaptureCompleted, void(scoped_refptr<CaptureData>));
|
| + MOCK_METHOD1(OnCursorShapeChangedPtr, void(protocol::CursorShapeInfo*));
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(MockCapturerDelegate);
|
| +};
|
| +
|
| +MockCapturerDelegate::MockCapturerDelegate() {
|
| +}
|
| +
|
| +MockCapturerDelegate::~MockCapturerDelegate() {
|
| +}
|
| +
|
| +void MockCapturerDelegate::OnCursorShapeChanged(
|
| + scoped_ptr<protocol::CursorShapeInfo> cursor_shape) {
|
| + // Notify the mock method.
|
| + OnCursorShapeChangedPtr(cursor_shape.get());
|
| }
|
|
|
| } // namespace
|
| @@ -39,23 +65,22 @@ class VideoFrameCapturerTest : public testing::Test {
|
| }
|
|
|
| scoped_ptr<VideoFrameCapturer> capturer_;
|
| - MockCaptureCompletedCallback capture_completed_callback_;
|
| + MockCapturerDelegate delegate_;
|
| };
|
|
|
| TEST_F(VideoFrameCapturerTest, StartCapturer) {
|
| - capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
|
| + capturer_->Start(&delegate_);
|
| capturer_->Stop();
|
| }
|
|
|
| TEST_F(VideoFrameCapturerTest, Capture) {
|
| // Assume that Start() treats the screen as invalid initially.
|
| - EXPECT_CALL(capture_completed_callback_,
|
| - CaptureCompletedPtr(DirtyRegionIsNonEmptyRect()));
|
| + EXPECT_CALL(delegate_,
|
| + OnCaptureCompleted(DirtyRegionIsNonEmptyRect()));
|
| + EXPECT_CALL(delegate_, OnCursorShapeChangedPtr(_));
|
|
|
| - capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
|
| - capturer_->CaptureInvalidRegion(base::Bind(
|
| - &MockCaptureCompletedCallback::CaptureCompleted,
|
| - base::Unretained(&capture_completed_callback_)));
|
| + capturer_->Start(&delegate_);
|
| + capturer_->CaptureInvalidRegion();
|
| capturer_->Stop();
|
| }
|
|
|
|
|