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

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

Issue 2409833002: Remove DesktopRegion parameter in DesktopCapturer::Capture. (Closed)
Patch Set: Change Capture2 to CaptureFrame Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (exactly_match) { 129 if (exactly_match) {
130 AssertUpdatedRegionIs(**frame, updated_region); 130 AssertUpdatedRegionIs(**frame, updated_region);
131 } else { 131 } else {
132 AssertUpdatedRegionCovers(**frame, updated_region); 132 AssertUpdatedRegionCovers(**frame, updated_region);
133 } 133 }
134 } 134 }
135 })); 135 }));
136 for (const auto& rect : updated_region) { 136 for (const auto& rect : updated_region) {
137 frame_painter->updated_region()->AddRect(rect); 137 frame_painter->updated_region()->AddRect(rect);
138 } 138 }
139 capturer->Capture(DesktopRegion()); 139 capturer->CaptureFrame();
140 } 140 }
141 141
142 // Executes a ScreenCapturerDifferWrapper::Capture(), if updated_region() is not 142 // Executes a ScreenCapturerDifferWrapper::Capture(), if updated_region() is not
143 // set, this function will reset ScreenCapturerDifferWrapper internal 143 // set, this function will reset ScreenCapturerDifferWrapper internal
144 // DesktopFrame into white. 144 // DesktopFrame into white.
145 void ExecuteCapturer(ScreenCapturerDifferWrapper* capturer, 145 void ExecuteCapturer(ScreenCapturerDifferWrapper* capturer,
146 MockScreenCapturerCallback* callback) { 146 MockScreenCapturerCallback* callback) {
147 EXPECT_CALL(*callback, 147 EXPECT_CALL(*callback,
148 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_)) 148 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_))
149 .Times(1); 149 .Times(1);
150 capturer->Capture(DesktopRegion()); 150 capturer->CaptureFrame();
151 } 151 }
152 152
153 void ExecuteDifferWrapperTest(bool with_hints, 153 void ExecuteDifferWrapperTest(bool with_hints,
154 bool enlarge_updated_region, 154 bool enlarge_updated_region,
155 bool random_updated_region, 155 bool random_updated_region,
156 bool check_result) { 156 bool check_result) {
157 const bool updated_region_should_exactly_match = 157 const bool updated_region_should_exactly_match =
158 with_hints && !enlarge_updated_region && !random_updated_region; 158 with_hints && !enlarge_updated_region && !random_updated_region;
159 BlackWhiteDesktopFramePainter frame_painter; 159 BlackWhiteDesktopFramePainter frame_painter;
160 PainterDesktopFrameGenerator frame_generator; 160 PainterDesktopFrameGenerator frame_generator;
(...skipping 10 matching lines...) Expand all
171 171
172 EXPECT_CALL(callback, 172 EXPECT_CALL(callback,
173 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_)) 173 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_))
174 .Times(1) 174 .Times(1)
175 .WillOnce(testing::Invoke([](DesktopCapturer::Result result, 175 .WillOnce(testing::Invoke([](DesktopCapturer::Result result,
176 std::unique_ptr<DesktopFrame>* frame) { 176 std::unique_ptr<DesktopFrame>* frame) {
177 ASSERT_EQ(result, DesktopCapturer::Result::SUCCESS); 177 ASSERT_EQ(result, DesktopCapturer::Result::SUCCESS);
178 AssertUpdatedRegionIs(**frame, 178 AssertUpdatedRegionIs(**frame,
179 {DesktopRect::MakeSize((*frame)->size())}); 179 {DesktopRect::MakeSize((*frame)->size())});
180 })); 180 }));
181 capturer.Capture(DesktopRegion()); 181 capturer.CaptureFrame();
182 182
183 ExecuteDifferWrapperCase(&frame_painter, &capturer, &callback, 183 ExecuteDifferWrapperCase(&frame_painter, &capturer, &callback,
184 {DesktopRect::MakeLTRB(100, 100, 200, 200), 184 {DesktopRect::MakeLTRB(100, 100, 200, 200),
185 DesktopRect::MakeLTRB(300, 300, 400, 400)}, 185 DesktopRect::MakeLTRB(300, 300, 400, 400)},
186 check_result, updated_region_should_exactly_match); 186 check_result, updated_region_should_exactly_match);
187 ExecuteCapturer(&capturer, &callback); 187 ExecuteCapturer(&capturer, &callback);
188 188
189 ExecuteDifferWrapperCase( 189 ExecuteDifferWrapperCase(
190 &frame_painter, &capturer, &callback, 190 &frame_painter, &capturer, &callback,
191 {DesktopRect::MakeLTRB(0, 0, 40, 40), 191 {DesktopRect::MakeLTRB(0, 0, 40, 40),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 TEST(ScreenCapturerDifferWrapperTest, 284 TEST(ScreenCapturerDifferWrapperTest,
285 DISABLED_CaptureWithEnlargedAndRandomHintsPerf) { 285 DISABLED_CaptureWithEnlargedAndRandomHintsPerf) {
286 int64_t started = rtc::TimeMillis(); 286 int64_t started = rtc::TimeMillis();
287 ExecuteDifferWrapperTest(true, true, true, false); 287 ExecuteDifferWrapperTest(true, true, true, false);
288 ASSERT_LE(rtc::TimeMillis() - started, 15000); 288 ASSERT_LE(rtc::TimeMillis() - started, 15000);
289 } 289 }
290 290
291 } // namespace webrtc 291 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698