diff --git a/build/darwin/ios_app.gni b/build/darwin/ios_app.gni new file mode 100644 index 0000000000000..920019f0ec888 --- /dev/null +++ b/build/darwin/ios_app.gni @@ -0,0 +1,20 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +template("ios_app") { + assert(is_ios) + + copy("${target_name}__info_plist") { + sources = [ invoker.info_plist ] + outputs = [ "$root_out_dir/${target_name}.app/Info.plist" ] + } + executable("$target_name") { + forward_variables_from(invoker, "*") + output_name = "${target_name}.app/$target_name" + + deps += [ + ":${target_name}__info_plist", + ] + } +} diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 31bb08f46357a..ee3436b9db871 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -730,6 +730,8 @@ FILE: ../../../flutter/shell/platform/darwin/common/framework/Source/FlutterStan FILE: ../../../flutter/shell/platform/darwin/common/framework/Source/FlutterStandardCodec_Internal.h FILE: ../../../flutter/shell/platform/darwin/common/framework/Source/flutter_codecs_unittest.mm FILE: ../../../flutter/shell/platform/darwin/common/framework/Source/flutter_standard_codec_unittest.mm +FILE: ../../../flutter/shell/platform/darwin/ios/FlutterTestsInfo.plist +FILE: ../../../flutter/shell/platform/darwin/ios/flutter_unittests.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Flutter.podspec FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index 6e00a098ee4ed..a338ce91ec123 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -5,9 +5,11 @@ assert(is_ios) import("//build/config/ios/ios_sdk.gni") +import("$flutter_root/build/darwin/ios_app.gni") import("$flutter_root/common/config.gni") import("$flutter_root/shell/gpu/gpu.gni") import("$flutter_root/shell/platform/darwin/common/framework_shared.gni") +import("$flutter_root/testing/testing.gni") _flutter_framework_dir = "$root_out_dir/Flutter.framework" @@ -249,6 +251,30 @@ shared_library("copy_and_verify_framework_headers") { ] } +test_fixtures("flutter_tests_fixtures") { + fixtures = [] +} + +ios_app("FlutterTests") { + testonly = true + + info_plist = "FlutterTestsInfo.plist" + + sources = [ + "flutter_unittests.mm", + ] + + libs = [ + "Foundation.framework", + ] + + deps = [ + ":flutter_tests_fixtures", + "//flutter/runtime:libdart", + "//flutter/testing", + ] +} + group("flutter_framework") { deps = [ ":copy_and_verify_framework_headers", diff --git a/shell/platform/darwin/ios/FlutterTestsInfo.plist b/shell/platform/darwin/ios/FlutterTestsInfo.plist new file mode 100644 index 0000000000000..8af0cac31d48e --- /dev/null +++ b/shell/platform/darwin/ios/FlutterTestsInfo.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FlutterTests + CFBundleIdentifier + io.flutter.FlutterTests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FlutterTests + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + + diff --git a/shell/platform/darwin/ios/flutter_unittests.mm b/shell/platform/darwin/ios/flutter_unittests.mm new file mode 100644 index 0000000000000..35dce374b6cd5 --- /dev/null +++ b/shell/platform/darwin/ios/flutter_unittests.mm @@ -0,0 +1,19 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#include "flutter/testing/testing.h" + +namespace flutter_tests { + +TEST(SmokeTest, Success) { + EXPECT_EQ(1, 1); +} + +TEST(SmokeTest, Fail) { + EXPECT_EQ(1, 2); +} + +} diff --git a/testing/run_all_unittests.cc b/testing/run_all_unittests.cc index 6d5d11c584fa4..8c47c30a087c2 100644 --- a/testing/run_all_unittests.cc +++ b/testing/run_all_unittests.cc @@ -2,9 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "flutter/fml/build_config.h" #include "gtest/gtest.h" +#ifdef OS_IOS +#include +#endif // OS_IOS + int main(int argc, char** argv) { +#ifdef OS_IOS + asl_log_descriptor(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO, + ASL_LOG_DESCRIPTOR_WRITE); + asl_log_descriptor(NULL, NULL, ASL_LEVEL_ERR, STDERR_FILENO, + ASL_LOG_DESCRIPTOR_WRITE); +#endif // OS_IOS + ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }