Fix modules_unittests on iOS.
Some of the module tests were failing on iOS, causing them to be ignored on the trybots. Specifically this CL: - Skips some tests that should not run on the simulator - Fixes iOS file system test helpers - Fixes failing nalu parser unittest BUG=webrtc:4752 R=henrika@webrtc.org, peah@webrtc.org, sprang@webrtc.org TBR=tkchin@webrtc.org Review URL: https://codereview.webrtc.org/2352063002 . Cr-Commit-Position: refs/heads/master@{#14472}
This commit is contained in:
parent
a4545ee4bb
commit
470c0887b3
@ -693,11 +693,14 @@ if (rtc_include_tests) {
|
||||
]
|
||||
|
||||
sources += [
|
||||
"audio_device/ios/audio_device_unittest_ios.cc",
|
||||
"audio_device/ios/objc/RTCAudioSessionTest.mm",
|
||||
"video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc",
|
||||
]
|
||||
|
||||
if (target_cpu != "x64") {
|
||||
sources += [ "audio_device/ios/audio_device_unittest_ios.cc" ]
|
||||
}
|
||||
|
||||
ldflags = [ "-ObjC" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ void ClearTempFiles() {
|
||||
remove(kv.second.c_str());
|
||||
}
|
||||
|
||||
void OpenFileAndReadMessage(const std::string filename,
|
||||
void OpenFileAndReadMessage(std::string filename,
|
||||
::google::protobuf::MessageLite* msg) {
|
||||
FILE* file = fopen(filename.c_str(), "rb");
|
||||
ASSERT_TRUE(file != NULL);
|
||||
@ -404,7 +404,12 @@ class ApmTest : public ::testing::Test {
|
||||
|
||||
ApmTest::ApmTest()
|
||||
: output_path_(test::OutputPath()),
|
||||
#ifndef WEBRTC_IOS
|
||||
ref_path_(test::ProjectRootPath() + "data/audio_processing/"),
|
||||
#else
|
||||
// On iOS test data is flat in the project root dir
|
||||
ref_path_(test::ProjectRootPath()),
|
||||
#endif
|
||||
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
|
||||
ref_filename_(ref_path_ + "output_data_fixed.pb"),
|
||||
#elif defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
|
||||
|
||||
@ -516,8 +516,8 @@ TEST_F(DebugDumpTest, ToggleAecLevel) {
|
||||
VerifyDebugDump(generator.dump_file_name());
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
// AGC may not be supported on Android.
|
||||
// AGC is not supported on Android or iOS.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
#define MAYBE_ToggleAgc DISABLED_ToggleAgc
|
||||
#else
|
||||
#define MAYBE_ToggleAgc ToggleAgc
|
||||
|
||||
@ -26,8 +26,8 @@ TEST(H264VideoToolboxNaluTest, TestHasVideoFormatDescription) {
|
||||
const uint8_t sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x27};
|
||||
EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(sps_buffer,
|
||||
arraysize(sps_buffer)));
|
||||
const uint8_t aud_sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29,
|
||||
0x00, 0x00, 0x00, 0x01, 0x27};
|
||||
const uint8_t aud_sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29, 0x10,
|
||||
0x00, 0x00, 0x00, 0x01, 0x27, 0xFF};
|
||||
EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(
|
||||
aud_sps_buffer, arraysize(aud_sps_buffer)));
|
||||
const uint8_t other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x28};
|
||||
|
||||
@ -45,6 +45,7 @@ namespace test {
|
||||
#if defined(WEBRTC_IOS)
|
||||
// Defined in iosfileutils.mm. No header file to discourage use elsewhere.
|
||||
std::string IOSOutputPath();
|
||||
std::string IOSRootPath();
|
||||
std::string IOSResourcePath(std::string name, std::string extension);
|
||||
#endif
|
||||
|
||||
@ -119,6 +120,9 @@ std::string WorkingDir() {
|
||||
#else // WEBRTC_ANDROID
|
||||
|
||||
std::string ProjectRootPath() {
|
||||
#if defined(WEBRTC_IOS)
|
||||
return IOSRootPath();
|
||||
#else
|
||||
std::string path = WorkingDir();
|
||||
if (path == kFallbackPath) {
|
||||
return kCannotFindProjectRootDir;
|
||||
@ -141,6 +145,7 @@ std::string ProjectRootPath() {
|
||||
}
|
||||
fprintf(stderr, "Cannot find project root directory!\n");
|
||||
return kCannotFindProjectRootDir;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string OutputPath() {
|
||||
|
||||
@ -54,6 +54,13 @@ std::string IOSResourcePath(std::string name, std::string extension) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string IOSRootPath() {
|
||||
@autoreleasepool {
|
||||
NSBundle* mainBundle = [NSBundle mainBundle];
|
||||
return StdStringFromNSString(mainBundle.bundlePath) + "/";
|
||||
}
|
||||
}
|
||||
|
||||
// For iOS, we don't have access to the output directory. Return the path to the
|
||||
// temporary directory instead. This is mostly used by tests that need to write
|
||||
// output files to disk.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user