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

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

Issue 2030333003: Revert of Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/screen_capturer_unittest.cc
diff --git a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
index 4d7799cc686ba54966f32e8571c976f02257b56f..bc87ed3eba8ae5d67aa8d768cbeb1560e56df3d3 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
@@ -23,6 +23,7 @@
using ::testing::_;
using ::testing::AnyNumber;
using ::testing::Return;
+using ::testing::SaveArg;
const int kTestSharedMemoryId = 123;
@@ -68,10 +69,6 @@
RTC_DISALLOW_COPY_AND_ASSIGN(FakeSharedMemoryFactory);
};
-ACTION_P(SaveUniquePtrArg, dest) {
- *dest = std::move(*arg1);
-}
-
TEST_F(ScreenCapturerTest, GetScreenListAndSelectScreen) {
webrtc::ScreenCapturer::ScreenList screens;
EXPECT_TRUE(capturer_->GetScreenList(&screens));
@@ -87,10 +84,9 @@
TEST_F(ScreenCapturerTest, Capture) {
// Assume that Start() treats the screen as invalid initially.
- std::unique_ptr<DesktopFrame> frame;
- EXPECT_CALL(callback_,
- OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
- .WillOnce(SaveUniquePtrArg(&frame));
+ DesktopFrame* frame = NULL;
+ EXPECT_CALL(callback_, OnCaptureCompleted(_))
+ .WillOnce(SaveArg<0>(&frame));
capturer_->Start(&callback_);
capturer_->Capture(DesktopRegion());
@@ -109,15 +105,16 @@
EXPECT_TRUE(it.rect().equals(DesktopRect::MakeSize(frame->size())));
it.Advance();
EXPECT_TRUE(it.IsAtEnd());
+
+ delete frame;
}
#if defined(WEBRTC_WIN)
TEST_F(ScreenCapturerTest, UseSharedBuffers) {
- std::unique_ptr<DesktopFrame> frame;
- EXPECT_CALL(callback_,
- OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
- .WillOnce(SaveUniquePtrArg(&frame));
+ DesktopFrame* frame = NULL;
+ EXPECT_CALL(callback_, OnCaptureCompleted(_))
+ .WillOnce(SaveArg<0>(&frame));
capturer_->Start(&callback_);
capturer_->SetSharedMemoryFactory(
@@ -127,6 +124,8 @@
ASSERT_TRUE(frame);
ASSERT_TRUE(frame->shared_memory());
EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId);
+
+ delete frame;
}
TEST_F(ScreenCapturerTest, UseMagnifier) {
@@ -134,14 +133,13 @@
options.set_allow_use_magnification_api(true);
capturer_.reset(ScreenCapturer::Create(options));
- std::unique_ptr<DesktopFrame> frame;
- EXPECT_CALL(callback_,
- OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
- .WillOnce(SaveUniquePtrArg(&frame));
+ DesktopFrame* frame = NULL;
+ EXPECT_CALL(callback_, OnCaptureCompleted(_)).WillOnce(SaveArg<0>(&frame));
capturer_->Start(&callback_);
capturer_->Capture(DesktopRegion());
ASSERT_TRUE(frame);
+ delete frame;
}
#endif // defined(WEBRTC_WIN)
« no previous file with comments | « webrtc/modules/desktop_capture/screen_capturer_mock_objects.h ('k') | webrtc/modules/desktop_capture/screen_capturer_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698