Remove screen_capturer_mock_objects.h

This is a trivial change to remove MockScreenCapturerCallback, and use
MockDesktopCapturerCallback to replace it.

BUG=webrtc:6513

Review-Url: https://codereview.webrtc.org/2494013003
Cr-Commit-Position: refs/heads/master@{#15047}
This commit is contained in:
zijiehe 2016-11-11 17:18:34 -08:00 committed by Commit bot
parent 3074096816
commit 372719b577
7 changed files with 54 additions and 49 deletions

View File

@ -102,7 +102,10 @@ if (rtc_include_tests) {
]
if (rtc_desktop_capture_supported) {
deps += [ "desktop_capture:screen_drawer" ]
deps += [
"desktop_capture:desktop_capture_mock",
"desktop_capture:screen_drawer",
]
sources += [
"desktop_capture/screen_capturer_integration_test.cc",
"desktop_capture/screen_drawer_unittest.cc",

View File

@ -66,6 +66,7 @@ if (rtc_include_tests) {
public_deps = [
":desktop_capture",
":rgba_color",
"//testing/gmock",
]
sources = [
@ -73,6 +74,7 @@ if (rtc_include_tests) {
"desktop_frame_generator.h",
"fake_desktop_capturer.cc",
"fake_desktop_capturer.h",
"mock_desktop_capturer_callback.cc",
"mock_desktop_capturer_callback.h",
"screen_capturer_mock_objects.h",
]

View File

@ -0,0 +1,23 @@
/* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h"
namespace webrtc {
MockDesktopCapturerCallback::MockDesktopCapturerCallback() = default;
MockDesktopCapturerCallback::~MockDesktopCapturerCallback() = default;
void MockDesktopCapturerCallback::OnCaptureResult(
DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) {
OnCaptureResultPtr(result, &frame);
}
} // namespace webrtc

View File

@ -10,11 +10,29 @@
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MOCK_DESKTOP_CAPTURER_CALLBACK_H_
#define WEBRTC_MODULES_DESKTOP_CAPTURE_MOCK_DESKTOP_CAPTURER_CALLBACK_H_
#include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h"
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
#include <memory>
#include "webrtc/test/gmock.h"
namespace webrtc {
// TODO(zijiehe): Remove MockScreenCapturerCallback.
class MockDesktopCapturerCallback : public MockScreenCapturerCallback {};
class MockDesktopCapturerCallback : public DesktopCapturer::Callback {
public:
MockDesktopCapturerCallback();
~MockDesktopCapturerCallback() override;
MOCK_METHOD2(OnCaptureResultPtr,
void(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame>* frame));
void OnCaptureResult(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) final;
private:
RTC_DISALLOW_COPY_AND_ASSIGN(MockDesktopCapturerCallback);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MOCK_DESKTOP_CAPTURER_CALLBACK_H_

View File

@ -19,7 +19,7 @@
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
#include "webrtc/modules/desktop_capture/desktop_region.h"
#include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
#include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h"
#include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h"
#include "webrtc/test/gtest.h"
using ::testing::_;
@ -46,7 +46,7 @@ class ScreenCapturerMacTest : public testing::Test {
}
std::unique_ptr<DesktopCapturer> capturer_;
MockScreenCapturerCallback callback_;
MockDesktopCapturerCallback callback_;
};
void ScreenCapturerMacTest::CaptureDoneCallback1(

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_MOCK_OBJECTS_H_
#define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_MOCK_OBJECTS_H_
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
#include "webrtc/test/gmock.h"
namespace webrtc {
// Deprecated.
// Use webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h.
class MockScreenCapturerCallback : public DesktopCapturer::Callback {
public:
MockScreenCapturerCallback() {}
~MockScreenCapturerCallback() override {}
MOCK_METHOD2(OnCaptureResultPtr,
void(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame>* frame));
void OnCaptureResult(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) override {
OnCaptureResultPtr(result, &frame);
}
private:
RTC_DISALLOW_COPY_AND_ASSIGN(MockScreenCapturerCallback);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_MOCK_OBJECTS_H_

View File

@ -16,7 +16,7 @@
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/desktop_region.h"
#include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h"
#include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
@ -66,7 +66,7 @@ class ScreenCapturerTest : public testing::Test {
#endif // defined(WEBRTC_WIN)
std::unique_ptr<DesktopCapturer> capturer_;
MockScreenCapturerCallback callback_;
MockDesktopCapturerCallback callback_;
};
class FakeSharedMemory : public SharedMemory {