Add xctest target to migrate sdk/objc/Framework to it.
This CL adds all the scaffolding needed to support xctest target
in sdk/objc/Framework and adds the target to the bot configuration.
The benefits of this are two-fold.
1. We'll separate framework unittests from their current target,
`rtc_unittests`, that has many many other tests.
This way framework unit tests will have nice, compact, selfcontained target.
2. We'll harvest the power of XCTest (native testing framework)
that should hopefully make adding and writing objc tests easier.
This CL migrates only one test to prove the setup works.
More tests will be migrated in follow up cls.
Bug: webrtc:8382
Change-Id: I0b5b9596c2a6d91683d13632323441de1aa461e0
Reviewed-on: https://webrtc-review.googlesource.com/8501
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Reviewed-by: Daniela Jovanoska Petrenko <denicija@webrtc.org>
Commit-Queue: Daniela Jovanoska Petrenko <denicija@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20289}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index ffc1e8d..1401132 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -512,6 +512,60 @@
}
if (rtc_include_tests) {
+ # TODO(denicija):remove second part of this check.
+ if (is_ios && (current_cpu == "arm64" || use_ios_simulator)) {
+ rtc_source_set("sdk_unittests_sources") {
+ testonly = true
+ include_dirs = [
+ "objc/Framework/Headers",
+ "objc/Framework/Classes",
+ ]
+ sources = [
+ # TODO(denicija): Once more sources are included,
+ # move the second part of the check on line 516 here
+ # when adding this file to the sources
+ "objc/Framework/UnitTests/RTCMTLVideoView_xctest.mm",
+ ]
+ if (use_ios_simulator) {
+ # Only include this file on simulator, as it's already
+ # included in device builds.
+ sources += [ "objc/Framework/Classes/Metal/RTCMTLVideoView.m" ]
+ libs = [ "CoreVideo.framework" ]
+ }
+ deps = [
+ ":common_objc",
+ ":peerconnection_objc",
+ ":peerconnectionfactory_objc",
+ ":videotoolbox_objc",
+ ":videotracksource_objc",
+ "..//system_wrappers:system_wrappers_default",
+ "../media:rtc_media_base",
+ "../modules:module_api",
+ "../rtc_base:rtc_base",
+ "../rtc_base:rtc_base_tests_utils",
+ "../system_wrappers:system_wrappers_default",
+ ]
+ public_deps = [
+ "//build/config/ios:xctest",
+ "//third_party/ocmock",
+ ]
+ }
+
+ rtc_ios_xctest_test("sdk_unittests") {
+ info_plist = "//test/ios/Info.plist"
+ sources = [
+ "objc/Framework/UnitTests/main.m",
+ ]
+ _bundle_id_suffix = ios_generic_test_bundle_id_suffix
+ extra_substitutions = [ "GTEST_BUNDLE_ID_SUFFIX=$_bundle_id_suffix" ]
+ deps = [
+ ":sdk_unittests_sources",
+ ]
+ ldflags = [ "-all_load" ]
+ }
+ }
+
+ # TODO(denicija): once all tests are migrated to xctest remove this source set.
rtc_source_set("sdk_unittests_objc") {
testonly = true
@@ -567,18 +621,8 @@
if (is_ios) {
sources += [ "objc/Framework/UnitTests/RTCAudioSessionTest.mm" ]
-
- # RTCMTLVideoView not supported on 32-bit arm
- if (current_cpu != "arm") {
- sources += [ "objc/Framework/UnitTests/RTCMTLVideoViewTests.mm" ]
- if (current_cpu != "arm64") {
- # Only include this file on simulator, as it's already
- # included in device builds.
- sources += [ "objc/Framework/Classes/Metal/RTCMTLVideoView.m" ]
- libs = [ "CoreVideo.framework" ]
- }
- }
}
+
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).