webrtc_m130/modules/desktop_capture/win/screen_capture_utils_unittest.cc
Austin Orion 8bd0f97fe6 Address CL comments from 200161.
This is a follow up to
https://webrtc-review.googlesource.com/c/src/+/200161

I forgot to actually upload the code that addressed reviewer's comments,
and since they were minor comments I went ahead and completed the CL
before I realized.

Fortunately no harm done because all of this code is behind a disabled
build flag. This is a great example of move fast, make mistakes. Lesson
learned.

Bug: webrtc:9273
Change-Id: I5e35b31719b264855568de4b5e595fe0f192654e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/204420
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Austin Orion <auorion@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#33095}
2021-01-28 22:59:30 +00:00

56 lines
1.5 KiB
C++

/*
* Copyright (c) 2017 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 "modules/desktop_capture/win/screen_capture_utils.h"
#include <string>
#include <vector>
#include "modules/desktop_capture/desktop_capturer.h"
#include "rtc_base/logging.h"
#include "test/gtest.h"
namespace webrtc {
TEST(ScreenCaptureUtilsTest, GetScreenList) {
DesktopCapturer::SourceList screens;
std::vector<std::string> device_names;
ASSERT_TRUE(GetScreenList(&screens));
screens.clear();
ASSERT_TRUE(GetScreenList(&screens, &device_names));
ASSERT_EQ(screens.size(), device_names.size());
}
TEST(ScreenCaptureUtilsTest, GetMonitorList) {
DesktopCapturer::SourceList monitors;
ASSERT_TRUE(GetMonitorList(&monitors));
}
TEST(ScreenCaptureUtilsTest, IsMonitorValid) {
DesktopCapturer::SourceList monitors;
ASSERT_TRUE(GetMonitorList(&monitors));
if (monitors.size() == 0) {
RTC_LOG(LS_INFO) << "Skip screen capture test on systems with no monitors.";
GTEST_SKIP();
}
ASSERT_TRUE(IsMonitorValid(monitors[0].id));
}
TEST(ScreenCaptureUtilsTest, InvalidMonitor) {
ASSERT_FALSE(IsMonitorValid(NULL));
}
} // namespace webrtc