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

Side by Side Diff: remoting/capturer/video_frame_capturer_unittest.cc

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
OLDNEW
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/video_frame_capturer.h" 5 #include "remoting/capturer/video_frame_capturer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #if defined(OS_MACOSX) 8 #if defined(OS_MACOSX)
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #endif // defined(OS_MACOSX) 10 #endif // defined(OS_MACOSX)
11 #include "remoting/base/capture_data.h" 11 #include "remoting/capturer/capture_data.h"
12 #include "remoting/base/shared_buffer_factory.h" 12 #include "remoting/capturer/capturer_mock_objects.h"
13 #include "remoting/host/host_mock_objects.h" 13 #include "remoting/capturer/shared_buffer_factory.h"
14 #include "remoting/protocol/protocol_mock_objects.h"
15 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 16
18 using ::testing::_; 17 using ::testing::_;
19 using ::testing::AnyNumber; 18 using ::testing::AnyNumber;
20 19
21 namespace remoting { 20 namespace remoting {
22 21
23 class MockSharedBufferFactory : public SharedBufferFactory { 22 class MockSharedBufferFactory : public SharedBufferFactory {
24 public: 23 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 TEST_F(VideoFrameCapturerTest, StartCapturer) { 58 TEST_F(VideoFrameCapturerTest, StartCapturer) {
60 capturer_ = VideoFrameCapturer::Create(); 59 capturer_ = VideoFrameCapturer::Create();
61 capturer_->Start(&delegate_); 60 capturer_->Start(&delegate_);
62 capturer_->Stop(); 61 capturer_->Stop();
63 } 62 }
64 63
65 TEST_F(VideoFrameCapturerTest, Capture) { 64 TEST_F(VideoFrameCapturerTest, Capture) {
66 // Assume that Start() treats the screen as invalid initially. 65 // Assume that Start() treats the screen as invalid initially.
67 EXPECT_CALL(delegate_, 66 EXPECT_CALL(delegate_,
68 OnCaptureCompleted(DirtyRegionIsNonEmptyRect())); 67 OnCaptureCompleted(DirtyRegionIsNonEmptyRect()));
69 EXPECT_CALL(delegate_, OnCursorShapeChangedPtr(_)) 68 EXPECT_CALL(delegate_, OnCursorShapeChanged(_))
70 .Times(AnyNumber()); 69 .Times(AnyNumber());
71 70
72 capturer_ = VideoFrameCapturer::Create(); 71 capturer_ = VideoFrameCapturer::Create();
73 capturer_->Start(&delegate_); 72 capturer_->Start(&delegate_);
74 capturer_->CaptureFrame(); 73 capturer_->CaptureFrame();
75 capturer_->Stop(); 74 capturer_->Stop();
76 } 75 }
77 76
78 #if defined(OS_WIN) 77 #if defined(OS_WIN)
79 78
80 TEST_F(VideoFrameCapturerTest, UseSharedBuffers) { 79 TEST_F(VideoFrameCapturerTest, UseSharedBuffers) {
81 EXPECT_CALL(delegate_, 80 EXPECT_CALL(delegate_,
82 OnCaptureCompleted(DirtyRegionIsNonEmptyRect())); 81 OnCaptureCompleted(DirtyRegionIsNonEmptyRect()));
83 EXPECT_CALL(delegate_, OnCursorShapeChangedPtr(_)) 82 EXPECT_CALL(delegate_, OnCursorShapeChanged(_))
84 .Times(AnyNumber()); 83 .Times(AnyNumber());
85 84
86 EXPECT_CALL(shared_buffer_factory_, CreateSharedBuffer(_)) 85 EXPECT_CALL(shared_buffer_factory_, CreateSharedBuffer(_))
87 .Times(1) 86 .Times(1)
88 .WillOnce(Invoke(this, &VideoFrameCapturerTest::CreateSharedBuffer)); 87 .WillOnce(Invoke(this, &VideoFrameCapturerTest::CreateSharedBuffer));
89 EXPECT_CALL(shared_buffer_factory_, ReleaseSharedBuffer(_)) 88 EXPECT_CALL(shared_buffer_factory_, ReleaseSharedBuffer(_))
90 .Times(1); 89 .Times(1);
91 90
92 capturer_ = VideoFrameCapturer::CreateWithFactory(&shared_buffer_factory_); 91 capturer_ = VideoFrameCapturer::CreateWithFactory(&shared_buffer_factory_);
93 capturer_->Start(&delegate_); 92 capturer_->Start(&delegate_);
94 capturer_->CaptureFrame(); 93 capturer_->CaptureFrame();
95 capturer_->Stop(); 94 capturer_->Stop();
96 capturer_.reset(); 95 capturer_.reset();
97 } 96 }
98 97
99 #endif // defined(OS_WIN) 98 #endif // defined(OS_WIN)
100 99
101 } // namespace remoting 100 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698