Refactor fileutils.cc/h and fileutils_unittests.cc into their own targets.
This will allow for custom implementations downstream. R=kjellander@webrtc.org, phoglund@webrtc.org BUG=webrtc:6727 Review-Url: https://codereview.webrtc.org/2548713003 Cr-Commit-Position: refs/heads/master@{#15423}
This commit is contained in:
parent
1d08100b9e
commit
37535bfb7f
@ -104,19 +104,28 @@ rtc_source_set("test_main") {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("fileutils") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"testsupport/fileutils.cc",
|
||||
"testsupport/fileutils.h",
|
||||
]
|
||||
if (is_ios) {
|
||||
sources += [ "testsupport/iosfileutils.mm" ]
|
||||
configs += [ "//build/config/compiler:enable_arc" ]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_source_set("test_support") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"gmock.h",
|
||||
"gtest.h",
|
||||
"testsupport/fileutils.cc",
|
||||
"testsupport/fileutils.h",
|
||||
"testsupport/frame_reader.cc",
|
||||
"testsupport/frame_reader.h",
|
||||
"testsupport/frame_writer.cc",
|
||||
"testsupport/frame_writer.h",
|
||||
"testsupport/iosfileutils.mm",
|
||||
"testsupport/metrics/video_metrics.cc",
|
||||
"testsupport/metrics/video_metrics.h",
|
||||
"testsupport/mock/mock_frame_reader.h",
|
||||
@ -139,15 +148,15 @@ rtc_source_set("test_support") {
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":fileutils",
|
||||
]
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
configs += [ "//build/config/compiler:enable_arc" ]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
deps += [ "//base:base" ]
|
||||
data = [
|
||||
@ -200,7 +209,6 @@ rtc_test("test_support_unittests") {
|
||||
"rtp_file_reader_unittest.cc",
|
||||
"rtp_file_writer_unittest.cc",
|
||||
"testsupport/always_passing_unittest.cc",
|
||||
"testsupport/fileutils_unittest.cc",
|
||||
"testsupport/frame_reader_unittest.cc",
|
||||
"testsupport/frame_writer_unittest.cc",
|
||||
"testsupport/metrics/video_metrics_unittest.cc",
|
||||
@ -232,6 +240,7 @@ rtc_test("test_support_unittests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
":fileutils_unittests",
|
||||
":test_common",
|
||||
":test_main",
|
||||
"../modules/video_capture",
|
||||
@ -239,6 +248,17 @@ rtc_test("test_support_unittests") {
|
||||
"//testing/gtest",
|
||||
]
|
||||
}
|
||||
rtc_source_set("fileutils_unittests") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"testsupport/fileutils_unittest.cc",
|
||||
]
|
||||
deps = [
|
||||
":fileutils",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("test_common") {
|
||||
testonly = true
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "Shlwapi.h"
|
||||
#include "WinDef.h"
|
||||
|
||||
#include "webrtc/system_wrappers/include/utf_util_win.h"
|
||||
#define GET_CURRENT_DIR _getcwd
|
||||
@ -135,7 +136,7 @@ std::string ProjectRootPath() {
|
||||
path = path + kPathDelimiter + ".." + kPathDelimiter + "..";
|
||||
char canonical_path[FILENAME_MAX];
|
||||
#ifdef WIN32
|
||||
bool succeeded = PathCanonicalizeA(canonical_path, path.c_str());
|
||||
BOOL succeeded = PathCanonicalizeA(canonical_path, path.c_str());
|
||||
#else
|
||||
bool succeeded = realpath(path.c_str(), canonical_path) != NULL;
|
||||
#endif
|
||||
|
||||
@ -37,15 +37,15 @@ class FileUtilsTest : public testing::Test {
|
||||
protected:
|
||||
FileUtilsTest() {
|
||||
}
|
||||
virtual ~FileUtilsTest() {}
|
||||
~FileUtilsTest() override {}
|
||||
// Runs before the first test
|
||||
static void SetUpTestCase() {
|
||||
original_working_dir_ = webrtc::test::WorkingDir();
|
||||
}
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
ASSERT_EQ(chdir(original_working_dir_.c_str()), 0);
|
||||
}
|
||||
void TearDown() {
|
||||
void TearDown() override {
|
||||
ASSERT_EQ(chdir(original_working_dir_.c_str()), 0);
|
||||
}
|
||||
private:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user