未验证 提交 61ec840e 编写于 作者: G gaaclarke 提交者: GitHub

Made it so unit tests can be written against all ios engine code. (#17624)

上级 b241ec1d
......@@ -881,6 +881,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterViewCon
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge_ios.h
......
......@@ -37,15 +37,12 @@ _flutter_framework_headers = [
_flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers"
shared_library("create_flutter_framework_dylib") {
visibility = [ ":*" ]
output_name = "Flutter"
ldflags = [ "-Wl,-install_name,@rpath/Flutter.framework/Flutter" ]
public = _flutter_framework_headers
# TODO(54502): move this variable into //build/config/ios/ios_sdk.gni
# Version of iOS that we're targeting for tests.
ios_testing_deployment_target = "13.0"
source_set("flutter_framework_source") {
visibility = [ ":*" ]
cflags_objc = flutter_cflags_objc
cflags_objcc = flutter_cflags_objcc
......@@ -112,6 +109,21 @@ shared_library("create_flutter_framework_dylib") {
sources += _flutter_framework_headers
defines = [ "FLUTTER_FRAMEWORK=1" ]
if (shell_enable_metal) {
defines += [ "FLUTTER_SHELL_ENABLE_METAL=1" ]
sources += [
"ios_context_metal.h",
"ios_context_metal.mm",
"ios_external_texture_metal.h",
"ios_external_texture_metal.mm",
"ios_surface_metal.h",
"ios_surface_metal.mm",
]
}
deps = [
":ios_gpu_configuration",
"//flutter/common",
......@@ -128,21 +140,6 @@ shared_library("create_flutter_framework_dylib") {
public_configs = [ "//flutter:config" ]
defines = [ "FLUTTER_FRAMEWORK=1" ]
if (shell_enable_metal) {
defines += [ "FLUTTER_SHELL_ENABLE_METAL=1" ]
sources += [
"ios_context_metal.h",
"ios_context_metal.mm",
"ios_external_texture_metal.h",
"ios_external_texture_metal.mm",
"ios_surface_metal.h",
"ios_surface_metal.mm",
]
}
libs = [
"CoreMedia.framework",
"CoreVideo.framework",
......@@ -153,6 +150,146 @@ shared_library("create_flutter_framework_dylib") {
]
}
ocmock_path = "../../../../../third_party/ocmock/Source"
# TODO(54503): Clone the OCMock repository so we can add a BUILD.gn to it.
static_library("ocmock") {
configs -= [ "//build/config/compiler:chromium_code" ]
cflags = [
"-fvisibility=default",
"-mios-simulator-version-min=$ios_testing_deployment_target",
"-Wno-misleading-indentation",
]
sources = [
"$ocmock_path/OCMock/NSInvocation+OCMAdditions.h",
"$ocmock_path/OCMock/NSInvocation+OCMAdditions.m",
"$ocmock_path/OCMock/NSMethodSignature+OCMAdditions.h",
"$ocmock_path/OCMock/NSMethodSignature+OCMAdditions.m",
"$ocmock_path/OCMock/NSNotificationCenter+OCMAdditions.h",
"$ocmock_path/OCMock/NSNotificationCenter+OCMAdditions.m",
"$ocmock_path/OCMock/NSObject+OCMAdditions.h",
"$ocmock_path/OCMock/NSObject+OCMAdditions.m",
"$ocmock_path/OCMock/NSValue+OCMAdditions.h",
"$ocmock_path/OCMock/NSValue+OCMAdditions.m",
"$ocmock_path/OCMock/OCClassMockObject.h",
"$ocmock_path/OCMock/OCClassMockObject.m",
"$ocmock_path/OCMock/OCMArg.h",
"$ocmock_path/OCMock/OCMArg.m",
"$ocmock_path/OCMock/OCMArgAction.h",
"$ocmock_path/OCMock/OCMArgAction.m",
"$ocmock_path/OCMock/OCMBlockArgCaller.h",
"$ocmock_path/OCMock/OCMBlockArgCaller.m",
"$ocmock_path/OCMock/OCMBlockCaller.h",
"$ocmock_path/OCMock/OCMBlockCaller.m",
"$ocmock_path/OCMock/OCMBoxedReturnValueProvider.h",
"$ocmock_path/OCMock/OCMBoxedReturnValueProvider.m",
"$ocmock_path/OCMock/OCMConstraint.h",
"$ocmock_path/OCMock/OCMConstraint.m",
"$ocmock_path/OCMock/OCMExceptionReturnValueProvider.h",
"$ocmock_path/OCMock/OCMExceptionReturnValueProvider.m",
"$ocmock_path/OCMock/OCMExpectationRecorder.h",
"$ocmock_path/OCMock/OCMExpectationRecorder.m",
"$ocmock_path/OCMock/OCMFunctions.h",
"$ocmock_path/OCMock/OCMFunctions.m",
"$ocmock_path/OCMock/OCMFunctionsPrivate.h",
"$ocmock_path/OCMock/OCMIndirectReturnValueProvider.h",
"$ocmock_path/OCMock/OCMIndirectReturnValueProvider.m",
"$ocmock_path/OCMock/OCMInvocationExpectation.h",
"$ocmock_path/OCMock/OCMInvocationExpectation.m",
"$ocmock_path/OCMock/OCMInvocationMatcher.h",
"$ocmock_path/OCMock/OCMInvocationMatcher.m",
"$ocmock_path/OCMock/OCMInvocationStub.h",
"$ocmock_path/OCMock/OCMInvocationStub.m",
"$ocmock_path/OCMock/OCMLocation.h",
"$ocmock_path/OCMock/OCMLocation.m",
"$ocmock_path/OCMock/OCMMacroState.h",
"$ocmock_path/OCMock/OCMMacroState.m",
"$ocmock_path/OCMock/OCMNotificationPoster.h",
"$ocmock_path/OCMock/OCMNotificationPoster.m",
"$ocmock_path/OCMock/OCMObserverRecorder.h",
"$ocmock_path/OCMock/OCMObserverRecorder.m",
"$ocmock_path/OCMock/OCMPassByRefSetter.h",
"$ocmock_path/OCMock/OCMPassByRefSetter.m",
"$ocmock_path/OCMock/OCMRealObjectForwarder.h",
"$ocmock_path/OCMock/OCMRealObjectForwarder.m",
"$ocmock_path/OCMock/OCMRecorder.h",
"$ocmock_path/OCMock/OCMRecorder.m",
"$ocmock_path/OCMock/OCMReturnValueProvider.h",
"$ocmock_path/OCMock/OCMReturnValueProvider.m",
"$ocmock_path/OCMock/OCMStubRecorder.h",
"$ocmock_path/OCMock/OCMStubRecorder.m",
"$ocmock_path/OCMock/OCMVerifier.h",
"$ocmock_path/OCMock/OCMVerifier.m",
"$ocmock_path/OCMock/OCMock.h",
"$ocmock_path/OCMock/OCMockObject.h",
"$ocmock_path/OCMock/OCMockObject.m",
"$ocmock_path/OCMock/OCObserverMockObject.h",
"$ocmock_path/OCMock/OCObserverMockObject.m",
"$ocmock_path/OCMock/OCPartialMockObject.h",
"$ocmock_path/OCMock/OCPartialMockObject.m",
"$ocmock_path/OCMock/OCProtocolMockObject.h",
"$ocmock_path/OCMock/OCProtocolMockObject.m",
]
include_dirs = [ "$ocmock_path" ]
}
ios_test_flutter_path = rebase_path("$root_out_dir/libios_test_flutter.dylib")
platform_frameworks_path = "$ios_sdk_path/../../Library/Frameworks/"
# NOTE: This currently only supports simulator targets because of the install_name.
# TODO(54504): Switch the install_name and make the test runner copy the dynamic
# library into the testing bundle.
shared_library("ios_test_flutter") {
visibility = [ ":*" ]
cflags = [
"-fvisibility=default",
"-F$platform_frameworks_path",
"-fobjc-arc",
"-mios-simulator-version-min=$ios_testing_deployment_target",
]
ldflags = [
"-F$platform_frameworks_path",
"-Wl,-framework,XCTest",
"-Wl,-install_name,$ios_test_flutter_path",
]
configs -= [
"//build/config/gcc:symbol_visibility_hidden",
"//build/config:symbol_visibility_hidden",
]
sources = [
"framework/Source/FlutterBinaryMessengerRelayTest.mm",
"framework/Source/FlutterEngineTest.mm",
"framework/Source/FlutterPluginAppLifeCycleDelegateTest.m",
"framework/Source/FlutterTextInputPluginTest.m",
"framework/Source/FlutterViewControllerTest.mm",
"framework/Source/SemanticsObjectTest.mm",
]
deps = [
":flutter_framework_source",
":ocmock",
"//flutter/shell/platform/darwin/common:framework_shared",
"//third_party/skia",
]
include_dirs = [ "$ocmock_path" ]
public_configs = [ "//flutter:config" ]
}
shared_library("create_flutter_framework_dylib") {
visibility = [ ":*" ]
output_name = "Flutter"
ldflags = [ "-Wl,-install_name,@rpath/Flutter.framework/Flutter" ]
public = _flutter_framework_headers
deps = [
":flutter_framework_source",
]
public_configs = [ "//flutter:config" ]
}
copy("copy_dylib") {
visibility = [ ":*" ]
......@@ -257,6 +394,7 @@ test_fixtures("flutter_tests_fixtures") {
fixtures = []
}
# Note: This currently isn't used, it might be removed.
ios_app("FlutterTests") {
testonly = true
......
......@@ -122,7 +122,9 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
- (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt {
if (!@available(iOS 13, *)) {
if (@available(iOS 13, *)) {
// noop
} else {
return;
}
......@@ -171,7 +173,9 @@ typedef enum UIAccessibilityContrast : NSInteger {
#pragma mark - Platform Contrast
- (void)testItReportsNormalPlatformContrastByDefault {
if (!@available(iOS 13, *)) {
if (@available(iOS 13, *)) {
// noop
} else {
return;
}
......@@ -199,7 +203,9 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
- (void)testItReportsPlatformContrastWhenViewWillAppear {
if (!@available(iOS 13, *)) {
if (@available(iOS 13, *)) {
// noop
} else {
return;
}
......@@ -227,7 +233,9 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
- (void)testItReportsHighContrastWhenTraitCollectionRequestsIt {
if (!@available(iOS 13, *)) {
if (@available(iOS 13, *)) {
// noop
} else {
return;
}
......@@ -453,13 +461,12 @@ typedef enum UIAccessibilityContrast : NSInteger {
FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine
nibName:nil
bundle:nil];
id observer =
[[NSNotificationCenter defaultCenter] addObserverForName:FlutterViewControllerWillDealloc
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification* _Nonnull note) {
[expectation fulfill];
}];
[[NSNotificationCenter defaultCenter] addObserverForName:FlutterViewControllerWillDealloc
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification* _Nonnull note) {
[expectation fulfill];
}];
realVC = nil;
}
[self waitForExpectations:@[ expectation ] timeout:1.0];
......
#import <OCMock/OCMock.h>
#import <XCTest/XCTest.h>
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
#import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h"
FLUTTER_ASSERT_ARC
namespace flutter {
namespace {
class MockAccessibilityBridge : public AccessibilityBridgeIos {
public:
MockAccessibilityBridge() { view_ = [[UIView alloc] init]; }
UIView* view() const override { return view_; }
UIView<UITextInput>* textInputView() override { return nil; }
void DispatchSemanticsAction(int32_t id, SemanticsAction action) override {}
void DispatchSemanticsAction(int32_t id,
SemanticsAction action,
std::vector<uint8_t> args) override {}
FlutterPlatformViewsController* GetPlatformViewsController() const override { return nil; }
private:
UIView* view_;
};
} // namespace
} // namespace flutter
@interface SemanticsObjectTest : XCTestCase
@end
@implementation SemanticsObjectTest
- (void)testCreate {
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
new flutter::MockAccessibilityBridge());
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
XCTAssertNotNil(object);
}
@end
......@@ -7,20 +7,14 @@
objects = {
/* Begin PBXBuildFile section */
0D17A5C022D78FCD0057279F /* FlutterViewControllerTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0D17A5BF22D78FCD0057279F /* FlutterViewControllerTest.mm */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
0D1CE5D8233430F400E5D880 /* FlutterChannelsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D1CE5D7233430F400E5D880 /* FlutterChannelsTest.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
0D4C3FB022DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D4C3FAF22DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
0D52D3BD22C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0D52D3B622C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
0D6AB6B622BB05E100EEE540 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6AB6B522BB05E100EEE540 /* AppDelegate.m */; };
0D6AB6B922BB05E100EEE540 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6AB6B822BB05E100EEE540 /* ViewController.m */; };
0D6AB6BC22BB05E100EEE540 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D6AB6BA22BB05E100EEE540 /* Main.storyboard */; };
0D6AB6BE22BB05E200EEE540 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0D6AB6BD22BB05E200EEE540 /* Assets.xcassets */; };
0D6AB6C122BB05E200EEE540 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D6AB6BF22BB05E200EEE540 /* LaunchScreen.storyboard */; };
0D6AB6C422BB05E200EEE540 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6AB6C322BB05E200EEE540 /* main.m */; };
0D6AB6EB22BB40E700EEE540 /* FlutterEngineTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0D6AB6E722BB40CF00EEE540 /* FlutterEngineTest.mm */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
0D6AB72C22BC339F00EEE540 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D6AB72522BC336100EEE540 /* libOCMock.a */; };
0D6AB73F22BD8F0200EEE540 /* FlutterEngineConfig.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 0D6AB73E22BD8F0200EEE540 /* FlutterEngineConfig.xcconfig */; };
3D8AF6182384C5420033B95F /* FlutterTextInputPluginTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8AF6172384C5420033B95F /* FlutterTextInputPluginTest.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -31,55 +25,10 @@
remoteGlobalIDString = 0D6AB6B022BB05E100EEE540;
remoteInfo = IosUnitTests;
};
0D6AB72022BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 030EF0A814632FD000B04273;
remoteInfo = OCMock;
};
0D6AB72222BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 03565A3118F0566E003AE91E;
remoteInfo = OCMockTests;
};
0D6AB72422BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 030EF0DC14632FF700B04273;
remoteInfo = OCMockLib;
};
0D6AB72622BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D31108AD1828DB8700737925;
remoteInfo = OCMockLibTests;
};
0D6AB72822BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F0B950F11B0080BE00942C38;
remoteInfo = "OCMock iOS";
};
0D6AB72A22BC336100EEE540 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 817EB1621BD765130047E85A;
remoteInfo = "OCMock tvOS";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0D17A5BF22D78FCD0057279F /* FlutterViewControllerTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterViewControllerTest.mm; sourceTree = "<group>"; };
0D1CE5D7233430F400E5D880 /* FlutterChannelsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterChannelsTest.m; sourceTree = "<group>"; };
0D4C3FAF22DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterPluginAppLifeCycleDelegateTest.m; sourceTree = "<group>"; };
0D52D3B622C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterBinaryMessengerRelayTest.mm; sourceTree = "<group>"; };
0D6AB6B122BB05E100EEE540 /* IosUnitTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IosUnitTests.app; sourceTree = BUILT_PRODUCTS_DIR; };
0D6AB6B422BB05E100EEE540 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
0D6AB6B522BB05E100EEE540 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
......@@ -92,10 +41,7 @@
0D6AB6C322BB05E200EEE540 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
0D6AB6C922BB05E200EEE540 /* IosUnitTestsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IosUnitTestsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
0D6AB6CF22BB05E200EEE540 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0D6AB6E722BB40CF00EEE540 /* FlutterEngineTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterEngineTest.mm; sourceTree = "<group>"; };
0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OCMock.xcodeproj; path = ../../../../../third_party/ocmock/Source/OCMock.xcodeproj; sourceTree = "<group>"; };
0D6AB73E22BD8F0200EEE540 /* FlutterEngineConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = FlutterEngineConfig.xcconfig; sourceTree = "<group>"; };
3D8AF6172384C5420033B95F /* FlutterTextInputPluginTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterTextInputPluginTest.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -110,7 +56,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0D6AB72C22BC339F00EEE540 /* libOCMock.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -165,27 +110,12 @@
isa = PBXGroup;
children = (
0D1CE5D62334309900E5D880 /* Source-Common */,
0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */,
0D6AB6E622BB409F00EEE540 /* Source */,
0D6AB6CF22BB05E200EEE540 /* Info.plist */,
0D6AB73E22BD8F0200EEE540 /* FlutterEngineConfig.xcconfig */,
);
path = Tests;
sourceTree = "<group>";
};
0D6AB6E622BB409F00EEE540 /* Source */ = {
isa = PBXGroup;
children = (
0D52D3B622C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm */,
0D6AB6E722BB40CF00EEE540 /* FlutterEngineTest.mm */,
3D8AF6172384C5420033B95F /* FlutterTextInputPluginTest.m */,
0D17A5BF22D78FCD0057279F /* FlutterViewControllerTest.mm */,
0D4C3FAF22DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m */,
);
name = Source;
path = ../../../../shell/platform/darwin/ios/framework/Source;
sourceTree = "<group>";
};
0D6AB6FC22BC1BC300EEE540 /* Frameworks */ = {
isa = PBXGroup;
children = (
......@@ -193,19 +123,6 @@
name = Frameworks;
sourceTree = "<group>";
};
0D6AB71822BC336100EEE540 /* Products */ = {
isa = PBXGroup;
children = (
0D6AB72122BC336100EEE540 /* OCMock.framework */,
0D6AB72322BC336100EEE540 /* OCMockTests.xctest */,
0D6AB72522BC336100EEE540 /* libOCMock.a */,
0D6AB72722BC336100EEE540 /* OCMockLibTests.xctest */,
0D6AB72922BC336100EEE540 /* OCMock.framework */,
0D6AB72B22BC336100EEE540 /* OCMock.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -233,7 +150,6 @@
0D6AB6C522BB05E200EEE540 /* Sources */,
0D6AB6C622BB05E200EEE540 /* Frameworks */,
0D6AB6C722BB05E200EEE540 /* Resources */,
0D6AB6E122BB122F00EEE540 /* ShellScript */,
);
buildRules = (
);
......@@ -274,12 +190,6 @@
mainGroup = 0D6AB6A822BB05E100EEE540;
productRefGroup = 0D6AB6B222BB05E100EEE540 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 0D6AB71822BC336100EEE540 /* Products */;
ProjectRef = 0D6AB71722BC336100EEE540 /* OCMock.xcodeproj */;
},
);
projectRoot = "";
targets = (
0D6AB6B022BB05E100EEE540 /* IosUnitTests */,
......@@ -288,51 +198,6 @@
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
0D6AB72122BC336100EEE540 /* OCMock.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = OCMock.framework;
remoteRef = 0D6AB72022BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0D6AB72322BC336100EEE540 /* OCMockTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = OCMockTests.xctest;
remoteRef = 0D6AB72222BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0D6AB72522BC336100EEE540 /* libOCMock.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libOCMock.a;
remoteRef = 0D6AB72422BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0D6AB72722BC336100EEE540 /* OCMockLibTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = OCMockLibTests.xctest;
remoteRef = 0D6AB72622BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0D6AB72922BC336100EEE540 /* OCMock.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = OCMock.framework;
remoteRef = 0D6AB72822BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0D6AB72B22BC336100EEE540 /* OCMock.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = OCMock.framework;
remoteRef = 0D6AB72A22BC336100EEE540 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
0D6AB6AF22BB05E100EEE540 /* Resources */ = {
isa = PBXResourcesBuildPhase;
......@@ -354,26 +219,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0D6AB6E122BB122F00EEE540 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
shellScript = "TARGET_FRAMEWORKS_PATH=\"$TARGET_BUILD_DIR/../Frameworks\"\nFRAMEWORK_PATH=$PROJECT_DIR/../../../../out/$FLUTTER_ENGINE/Flutter.framework\nrsync -avzh \"$FRAMEWORK_PATH\" \"$TARGET_FRAMEWORKS_PATH\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
0D6AB6AD22BB05E100EEE540 /* Sources */ = {
isa = PBXSourcesBuildPhase;
......@@ -389,12 +234,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0D6AB6EB22BB40E700EEE540 /* FlutterEngineTest.mm in Sources */,
3D8AF6182384C5420033B95F /* FlutterTextInputPluginTest.m in Sources */,
0D17A5C022D78FCD0057279F /* FlutterViewControllerTest.mm in Sources */,
0D1CE5D8233430F400E5D880 /* FlutterChannelsTest.m in Sources */,
0D52D3BD22C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm in Sources */,
0D4C3FB022DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -589,7 +429,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Automatic;
FRAMEWORK_SEARCH_PATHS = ../../../../out/$FLUTTER_ENGINE;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = (
../../../..,
../../../../flutter/shell/platform/darwin/common/framework/Headers,
......@@ -601,20 +441,17 @@
../../../../third_party/icu/source/common,
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Tests",
../../../../out/$FLUTTER_ENGINE,
../../../../out/$FLUTTER_ENGINE/obj/flutter/shell/platform/darwin/ios/,
);
OTHER_LDFLAGS = (
"-framework",
Flutter,
"-lOCMock",
"-locmock",
"-ObjC",
"-lios_test_flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.flutter.IosUnitTestsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -633,7 +470,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Automatic;
FRAMEWORK_SEARCH_PATHS = ../../../../out/$FLUTTER_ENGINE;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = (
../../../..,
../../../../flutter/shell/platform/darwin/common/framework/Headers,
......@@ -645,20 +482,17 @@
../../../../third_party/icu/source/common,
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Tests",
../../../../out/$FLUTTER_ENGINE,
../../../../out/$FLUTTER_ENGINE/obj/flutter/shell/platform/darwin/ios/,
);
OTHER_LDFLAGS = (
"-framework",
Flutter,
"-lOCMock",
"-locmock",
"-ObjC",
"-lios_test_flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.flutter.IosUnitTestsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
......
# iOS Unit Tests
These are the unit tests for iOS engine. They can be executed locally and are
also run in LUCI builds.
## Running Tests
```sh
./flutter/tools/gn --ios --simulator --unoptimized
cd flutter/testing/ios/IosUnitTests
./build_and_run_tests.sh
```
After the `ios_flutter_test` target is built you can also run the tests inside
of xcode with `IosUnitTests.xcodeproj`.
## Adding Tests
When you add a new unit test file, also add a reference to that file in
shell/platform/darwin/ios/BUILD.gn, under the `sources` list of the
`ios_flutter_test` target. Once it's there, it will execute with the other
tests.
#!/bin/sh
FLUTTER_ENGINE=ios_debug_sim_unopt
if [ $# -eq 1 ]; then
FLUTTER_ENGINE=$1
fi
pushd $PWD
cd ../../../..
./flutter/tools/gn --ios --simulator --unoptimized
ninja -j 100 -C out/ios_debug_sim_unopt
if [ ! -d "out/$FLUTTER_ENGINE" ]; then
echo "You must GN to generate out/$FLUTTER_ENGINE"
echo "example: ./flutter/tools/gn --ios --simulator --unoptimized"
exit 1
fi
autoninja -C out/$FLUTTER_ENGINE ios_test_flutter
popd
./run_tests.sh ios_debug_sim_unopt
./run_tests.sh $FLUTTER_ENGINE
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册