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

Unified Diff: webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc

Issue 2468753002: Add CreateWindowCapturer() and CreateScreenCapturer() in DesktopCapturer (Closed)
Patch Set: Build break without X11 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc
diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc b/webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc
similarity index 85%
copy from webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc
copy to webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc
index ae7b7d9a85aceb64599e4e693223a4a9be698c82..594ad1327441486e7744dd1eb254acfa063adf5e 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper_unittest.cc
+++ b/webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h"
+#include "webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.h"
#include <initializer_list>
#include <memory>
@@ -21,7 +21,7 @@
#include "webrtc/modules/desktop_capture/desktop_region.h"
#include "webrtc/modules/desktop_capture/differ_block.h"
#include "webrtc/modules/desktop_capture/fake_screen_capturer.h"
-#include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h"
+#include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h"
#include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
#include "webrtc/test/gtest.h"
#include "webrtc/typedefs.h"
@@ -70,7 +70,7 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
// following,
// (Each block in the following grid is a 8 x 8 pixels area. X means the real
// updated area, m means the updated area marked by
- // ScreenCapturerDifferWrapper.)
+ // DesktopCapturerDifferWrapper.)
// +---+---+---+---+---+---+---+---+
// | X | m | m | m | m | m | m | m |
// +---+---+---+---+---+---+---+---+
@@ -81,7 +81,7 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
// | m | m | m | m | m | m | m | X |
// +---+---+---+---+---+---+---+---+
// The top left [0, 0] - [8, 8] and right bottom [56, 24] - [64, 32] blocks of
- // this area are updated. But since ScreenCapturerDifferWrapper compares
+ // this area are updated. But since DesktopCapturerDifferWrapper compares
// 32 x 32 blocks by default, this entire area is marked as updated. So the
// [8, 8] - [56, 32] is expected to be covered in the difference.
//
@@ -96,7 +96,7 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
// | m | m | m | m | | | | | X | m | m | m |
// +---+---+---+---+---+---+---+---+---+---+---+---+
// the [8, 8] - [64, 32] is not expected to be covered in the difference. As
- // ScreenCapturerDifferWrapper should only mark [0, 0] - [32, 32] and
+ // DesktopCapturerDifferWrapper should only mark [0, 0] - [32, 32] and
// [64, 0] - [96, 32] as updated.
DesktopRegion differ(frame.updated_region());
differ.Subtract(region);
@@ -106,15 +106,15 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
}
}
-// Executes a ScreenCapturerDifferWrapper::Capture() and compares its output
+// Executes a DesktopCapturerDifferWrapper::Capture() and compares its output
// DesktopFrame::updated_region() with |updated_region| if |check_result| is
// true. If |exactly_match| is true, AssertUpdatedRegionIs() will be used,
// otherwise AssertUpdatedRegionCovers() will be used.
template <template <typename, typename...> class T = std::initializer_list,
typename... Rect>
void ExecuteDifferWrapperCase(BlackWhiteDesktopFramePainter* frame_painter,
- ScreenCapturerDifferWrapper* capturer,
- MockScreenCapturerCallback* callback,
+ DesktopCapturerDifferWrapper* capturer,
+ MockDesktopCapturerCallback* callback,
const T<DesktopRect, Rect...>& updated_region,
bool check_result,
bool exactly_match) {
@@ -139,11 +139,11 @@ void ExecuteDifferWrapperCase(BlackWhiteDesktopFramePainter* frame_painter,
capturer->CaptureFrame();
}
-// Executes a ScreenCapturerDifferWrapper::Capture(), if updated_region() is not
-// set, this function will reset ScreenCapturerDifferWrapper internal
-// DesktopFrame into white.
-void ExecuteCapturer(ScreenCapturerDifferWrapper* capturer,
- MockScreenCapturerCallback* callback) {
+// Executes a DesktopCapturerDifferWrapper::Capture(), if updated_region() is
+// not set, this function will reset DesktopCapturerDifferWrapper internal
+// DesktopFrame into black.
+void ExecuteCapturer(DesktopCapturerDifferWrapper* capturer,
+ MockDesktopCapturerCallback* callback) {
EXPECT_CALL(*callback,
OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, testing::_))
.Times(1);
@@ -159,10 +159,10 @@ void ExecuteDifferWrapperTest(bool with_hints,
BlackWhiteDesktopFramePainter frame_painter;
PainterDesktopFrameGenerator frame_generator;
frame_generator.set_desktop_frame_painter(&frame_painter);
- std::unique_ptr<FakeScreenCapturer> fake(new FakeScreenCapturer());
+ std::unique_ptr<FakeDesktopCapturer<>> fake(new FakeDesktopCapturer<>());
fake->set_frame_generator(&frame_generator);
- ScreenCapturerDifferWrapper capturer(std::move(fake));
- MockScreenCapturerCallback callback;
+ DesktopCapturerDifferWrapper capturer(std::move(fake));
+ MockDesktopCapturerCallback callback;
frame_generator.set_provide_updated_region_hints(with_hints);
frame_generator.set_enlarge_updated_region(enlarge_updated_region);
frame_generator.set_add_random_updated_region(random_updated_region);
@@ -224,27 +224,27 @@ void ExecuteDifferWrapperTest(bool with_hints,
} // namespace
-TEST(ScreenCapturerDifferWrapperTest, CaptureWithoutHints) {
+TEST(DesktopCapturerDifferWrapperTest, CaptureWithoutHints) {
ExecuteDifferWrapperTest(false, false, false, true);
}
-TEST(ScreenCapturerDifferWrapperTest, CaptureWithHints) {
+TEST(DesktopCapturerDifferWrapperTest, CaptureWithHints) {
ExecuteDifferWrapperTest(true, false, false, true);
}
-TEST(ScreenCapturerDifferWrapperTest, CaptureWithEnlargedHints) {
+TEST(DesktopCapturerDifferWrapperTest, CaptureWithEnlargedHints) {
ExecuteDifferWrapperTest(true, true, false, true);
}
-TEST(ScreenCapturerDifferWrapperTest, CaptureWithRandomHints) {
+TEST(DesktopCapturerDifferWrapperTest, CaptureWithRandomHints) {
ExecuteDifferWrapperTest(true, false, true, true);
}
-TEST(ScreenCapturerDifferWrapperTest, CaptureWithEnlargedAndRandomHints) {
+TEST(DesktopCapturerDifferWrapperTest, CaptureWithEnlargedAndRandomHints) {
ExecuteDifferWrapperTest(true, true, true, true);
}
-// When hints are provided, ScreenCapturerDifferWrapper has a slightly better
+// When hints are provided, DesktopCapturerDifferWrapper has a slightly better
// performance in current configuration, but not so significant. Following is
// one run result.
// [ RUN ] DISABLED_CaptureWithoutHintsPerf
@@ -257,31 +257,31 @@ TEST(ScreenCapturerDifferWrapperTest, CaptureWithEnlargedAndRandomHints) {
// [ OK ] DISABLED_CaptureWithRandomHintsPerf (6184 ms)
// [ RUN ] DISABLED_CaptureWithEnlargedAndRandomHintsPerf
// [ OK ] DISABLED_CaptureWithEnlargedAndRandomHintsPerf (6347 ms)
-TEST(ScreenCapturerDifferWrapperTest, DISABLED_CaptureWithoutHintsPerf) {
+TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithoutHintsPerf) {
int64_t started = rtc::TimeMillis();
ExecuteDifferWrapperTest(false, false, false, false);
ASSERT_LE(rtc::TimeMillis() - started, 15000);
}
-TEST(ScreenCapturerDifferWrapperTest, DISABLED_CaptureWithHintsPerf) {
+TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithHintsPerf) {
int64_t started = rtc::TimeMillis();
ExecuteDifferWrapperTest(true, false, false, false);
ASSERT_LE(rtc::TimeMillis() - started, 15000);
}
-TEST(ScreenCapturerDifferWrapperTest, DISABLED_CaptureWithEnlargedHintsPerf) {
+TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithEnlargedHintsPerf) {
int64_t started = rtc::TimeMillis();
ExecuteDifferWrapperTest(true, true, false, false);
ASSERT_LE(rtc::TimeMillis() - started, 15000);
}
-TEST(ScreenCapturerDifferWrapperTest, DISABLED_CaptureWithRandomHintsPerf) {
+TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithRandomHintsPerf) {
int64_t started = rtc::TimeMillis();
ExecuteDifferWrapperTest(true, false, true, false);
ASSERT_LE(rtc::TimeMillis() - started, 15000);
}
-TEST(ScreenCapturerDifferWrapperTest,
+TEST(DesktopCapturerDifferWrapperTest,
DISABLED_CaptureWithEnlargedAndRandomHintsPerf) {
int64_t started = rtc::TimeMillis();
ExecuteDifferWrapperTest(true, true, true, false);

Powered by Google App Engine
This is Rietveld 408576698