Chromium Code Reviews

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer_unittest.cc

Issue 2099123002: [Chromoting] Improve DirectX capturer to support multiple outputs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Resolve review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 126 matching lines...)
137 std::unique_ptr<DesktopFrame> frame; 137 std::unique_ptr<DesktopFrame> frame;
138 EXPECT_CALL(callback_, 138 EXPECT_CALL(callback_,
139 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _)) 139 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
140 .WillOnce(SaveUniquePtrArg(&frame)); 140 .WillOnce(SaveUniquePtrArg(&frame));
141 141
142 capturer_->Start(&callback_); 142 capturer_->Start(&callback_);
143 capturer_->Capture(DesktopRegion()); 143 capturer_->Capture(DesktopRegion());
144 ASSERT_TRUE(frame); 144 ASSERT_TRUE(frame);
145 } 145 }
146 146
147 TEST_F(ScreenCapturerTest, UseDirectxCapturer) {
148 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault());
149 options.set_allow_directx_capturer(true);
150 capturer_.reset(ScreenCapturer::Create(options));
151
152 std::unique_ptr<DesktopFrame> frame;
153 EXPECT_CALL(callback_,
154 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
155 .WillOnce(SaveUniquePtrArg(&frame));
156
157 capturer_->Start(&callback_);
158 capturer_->Capture(DesktopRegion());
159 ASSERT_TRUE(frame);
160 }
161
162 TEST_F(ScreenCapturerTest, UseDirectxCapturerWithSharedBuffers) {
163 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault());
164 options.set_allow_directx_capturer(true);
165 capturer_.reset(ScreenCapturer::Create(options));
166
167 std::unique_ptr<DesktopFrame> frame;
168 EXPECT_CALL(callback_,
169 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
170 .WillOnce(SaveUniquePtrArg(&frame));
171
172 capturer_->Start(&callback_);
173 capturer_->SetSharedMemoryFactory(
174 std::unique_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory()));
175 capturer_->Capture(DesktopRegion());
176 ASSERT_TRUE(frame);
177 ASSERT_TRUE(frame->shared_memory());
178 EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId);
179 }
180
147 #endif // defined(WEBRTC_WIN) 181 #endif // defined(WEBRTC_WIN)
148 182
149 } // namespace webrtc 183 } // namespace webrtc
OLDNEW

Powered by Google App Engine