Splitted FileHandler into FrameReader and FrameWriter classes and moved them to testsupport in test.gyp.
Fixed unit tests so they don't use ASSERT_DEATH since that doesn't work with Valgrind.
Fixed all Valgrind warnings except the one caused by CriticalSectionWrapper in system_wrappers.
Reworked all includes and GYP include paths to use full directory paths.
Removed util.h for logging, since it rendered warnings in Valgrind because of gflags. Replaced it with a verbose flag and a new function in video_quality_measurement.cc
BUG=
TEST=Passed test_support_unittests and video_codecs_test_framework_unittests on Linux, Mac and Windows.
Review URL: http://webrtc-codereview.appspot.com/311001
git-svn-id: http://webrtc.googlecode.com/svn/trunk@1126 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/test/testsupport/fileutils_unittest.cc b/test/testsupport/fileutils_unittest.cc
index e9aa03c..a500a07 100644
--- a/test/testsupport/fileutils_unittest.cc
+++ b/test/testsupport/fileutils_unittest.cc
@@ -8,12 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "testsupport/fileutils.h"
+
#include <cstdio>
#include <list>
#include <string>
#include "gtest/gtest.h"
-#include "testsupport/fileutils.h"
#ifdef WIN32
static const char* kPathDelimiter = "\\";
@@ -63,7 +64,7 @@
file_it != files_.end(); ++file_it) {
FILE* file = fopen(file_it->c_str(), "wb");
ASSERT_TRUE(file != NULL) << "Failed to write file: " << file_it->c_str();
- ASSERT_TRUE(fprintf(file, "%s", "Dummy data") > 0);
+ ASSERT_GT(fprintf(file, "%s", "Dummy data"), 0);
fclose(file);
}
// Create a dummy subdir that can be chdir'ed into for testing purposes.
@@ -85,9 +86,9 @@
ASSERT_EQ(chdir(original_working_dir_.c_str()), 0);
}
protected:
+ static FileList files_;
static std::string empty_dummy_dir_;
private:
- static FileList files_;
static std::string original_working_dir_;
};
@@ -164,7 +165,7 @@
// Hard to cover all platforms. Just test that it returns something without
// crashing:
std::string working_dir = webrtc::test::WorkingDir();
- ASSERT_TRUE(working_dir.length() > 0);
+ ASSERT_GT(working_dir.length(), 0u);
}
// Due to multiple platforms, it is hard to make a complete test for
@@ -173,10 +174,18 @@
// function.
TEST_F(FileUtilsTest, ResourcePathReturnsValue) {
std::string resource = webrtc::test::ResourcePath(kTestName, kExtension);
- ASSERT_TRUE(resource.find(kTestName) > 0);
- ASSERT_TRUE(resource.find(kExtension) > 0);
+ ASSERT_GT(resource.find(kTestName), 0u);
+ ASSERT_GT(resource.find(kExtension), 0u);
ASSERT_EQ(0, chdir(kPathDelimiter));
ASSERT_EQ("./", webrtc::test::OutputPath());
}
+TEST_F(FileUtilsTest, GetFileSizeExistingFile) {
+ ASSERT_GT(webrtc::test::GetFileSize(files_.front()), 0u);
+}
+
+TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) {
+ ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp"));
+}
+
} // namespace webrtc