mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Don't crash the test process when X11 isn't available.
It's not great to use asserts in util functions like this because it breaks the arrange-act-assert rule, but using checks is worse because they will crash the test process on failure (= no other tests get run after that). Bug: b/143587130 Change-Id: If4d085311de0792b9fca1584db299fd24199e72e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162360 Reviewed-by: Artem Titov <titovartem@webrtc.org> Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30093}
This commit is contained in:
parent
774fb933a3
commit
73eb784676
4 changed files with 4 additions and 6 deletions
|
@ -35,7 +35,7 @@ class ScreenCapturerTest : public ::testing::Test {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
capturer_ = DesktopCapturer::CreateScreenCapturer(
|
capturer_ = DesktopCapturer::CreateScreenCapturer(
|
||||||
DesktopCaptureOptions::CreateDefault());
|
DesktopCaptureOptions::CreateDefault());
|
||||||
RTC_DCHECK(capturer_);
|
ASSERT_TRUE(capturer_);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -36,8 +36,6 @@ void TestScreenDrawerLock(
|
||||||
rtc::FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor) {
|
rtc::FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor) {
|
||||||
constexpr int kLockDurationMs = 100;
|
constexpr int kLockDurationMs = 100;
|
||||||
|
|
||||||
RTC_DCHECK(ctor);
|
|
||||||
|
|
||||||
std::atomic<bool> created(false);
|
std::atomic<bool> created(false);
|
||||||
std::atomic<bool> ready(false);
|
std::atomic<bool> ready(false);
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace {
|
||||||
void PaintDesktopFrame(DesktopFrame* frame,
|
void PaintDesktopFrame(DesktopFrame* frame,
|
||||||
DesktopVector pos,
|
DesktopVector pos,
|
||||||
RgbaColor color) {
|
RgbaColor color) {
|
||||||
RTC_DCHECK(frame);
|
ASSERT_TRUE(frame);
|
||||||
RTC_DCHECK(DesktopRect::MakeSize(frame->size()).Contains(pos));
|
ASSERT_TRUE(DesktopRect::MakeSize(frame->size()).Contains(pos));
|
||||||
*reinterpret_cast<uint32_t*>(frame->GetFrameDataAtPos(pos)) =
|
*reinterpret_cast<uint32_t*>(frame->GetFrameDataAtPos(pos)) =
|
||||||
color.ToUInt32();
|
color.ToUInt32();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class WindowCapturerTest : public ::testing::Test,
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
capturer_ = DesktopCapturer::CreateWindowCapturer(
|
capturer_ = DesktopCapturer::CreateWindowCapturer(
|
||||||
DesktopCaptureOptions::CreateDefault());
|
DesktopCaptureOptions::CreateDefault());
|
||||||
RTC_DCHECK(capturer_);
|
ASSERT_TRUE(capturer_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {}
|
void TearDown() override {}
|
||||||
|
|
Loading…
Reference in a new issue