-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[url_launcher] migrating iOS tests from objc to swift #4758
[url_launcher] migrating iOS tests from objc to swift #4758
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clean. Just 2 nits
It's nice that our original ObjC code has good DI practice and does not rely on OCMock
in tests. This allows us to migrate to Swift directly without refactoring original code.
|
||
class URLLauncherTests: XCTestCase { | ||
var plugin: FLTURLLauncherPlugin! | ||
var launcher: FakeLauncher! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these can be private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the class can be final
.
|
||
} | ||
|
||
class FakeLauncher: NSObject, FULLauncher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 2 fake classes can be fileprivate
and final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
@@ -1,5 +1,6 @@ | |||
## NEXT | |||
|
|||
* Migrates unit tests and UI test from objc to swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be reverted; test-only changes don't need to be mentioned in the CHANGELOG.
s.public_header_files = 'Classes/**/*.h' | ||
s.xcconfig = { | ||
'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift', | ||
'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: these shouldn't be indented differently.
|
||
} | ||
|
||
final fileprivate class FakeLauncher: NSObject, FULLauncher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need this to inherit from NSObject?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes since the plugin is still in objective-c
} | ||
} | ||
|
||
final fileprivate class FakeFlutterBinaryMessenger: NSObject, FlutterBinaryMessenger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here.
} | ||
} | ||
|
||
final fileprivate class FakeFlutterBinaryMessenger: NSObject, FlutterBinaryMessenger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, why does this class even exist? It's not used anywhere, and it wasn't in the Obj-C version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
||
final class URLLauncherTests: XCTestCase { | ||
private var plugin: FLTURLLauncherPlugin! | ||
private var launcher: FakeLauncher! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did the test class become stateful in this migration? Stateful test fixtures are generally an anti-pattern, and making the object under test stateful is especially problematic.
packages/url_launcher/url_launcher_ios/example/ios/RunnerTests/URLLauncherTests.swift
Show resolved
Hide resolved
Overrides: the changes to non-test files are only needed to support running the tests. |
Is this ready for re-review, or still in progress? |
@stuartmorgan Yes, it is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
flutter/packages@aaae5ef...ef0c65e 2023-09-11 engine-flutter-autoroll@skia.org Roll Flutter from 7c28e8e to 219efce (16 revisions) (flutter/packages#4901) 2023-09-11 chris.langham32@gmail.com [url_launcher] migrating iOS tests from objc to swift (flutter/packages#4758) 2023-09-09 engine-flutter-autoroll@skia.org Roll Flutter from da676f7 to 7c28e8e (20 revisions) (flutter/packages#4879) 2023-09-09 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 3.1.2 to 3.1.3 (flutter/packages#4863) 2023-09-08 engine-flutter-autoroll@skia.org Roll Flutter from aea4552 to da676f7 (28 revisions) (flutter/packages#4874) 2023-09-08 48349434+paulppn@users.noreply.github.com [webview_flutter_android] Added the functionality to fullscreen html5 video (flutter/packages#3879) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@aaae5ef...ef0c65e 2023-09-11 engine-flutter-autoroll@skia.org Roll Flutter from 7c28e8e to 219efce (16 revisions) (flutter/packages#4901) 2023-09-11 chris.langham32@gmail.com [url_launcher] migrating iOS tests from objc to swift (flutter/packages#4758) 2023-09-09 engine-flutter-autoroll@skia.org Roll Flutter from da676f7 to 7c28e8e (20 revisions) (flutter/packages#4879) 2023-09-09 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 3.1.2 to 3.1.3 (flutter/packages#4863) 2023-09-08 engine-flutter-autoroll@skia.org Roll Flutter from aea4552 to da676f7 (28 revisions) (flutter/packages#4874) 2023-09-08 48349434+paulppn@users.noreply.github.com [webview_flutter_android] Added the functionality to fullscreen html5 video (flutter/packages#3879) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
* main: (83 commits) go_router_builder: support the latest pkg:analyzer (flutter#4921) Replace collection type lints with more general lint (flutter#4912) Roll Flutter from 219efce to 4e7a07a (30 revisions) (flutter#4910) [camerax] Implement `startVideoCapturing` and `onVideoRecordedEvent` (flutter#4815) [tool] Add a package inclusion filter (flutter#4904) [flutter_markdown] Fix changelog regarding minimum supported SDK version (flutter#4851) [ios_platform_images] Add integration tests (flutter#4899) [image_picker] Copy exif tags in categories II and III (flutter#4738) [google_maps_flutter_android] Fix for testToggleInfoWindow persistently flaky (flutter#4768) Roll Flutter from 7c28e8e to 219efce (16 revisions) (flutter#4901) [url_launcher] migrating iOS tests from objc to swift (flutter#4758) Roll Flutter from da676f7 to 7c28e8e (20 revisions) (flutter#4879) Bump actions/upload-artifact from 3.1.2 to 3.1.3 (flutter#4863) Roll Flutter from aea4552 to da676f7 (28 revisions) (flutter#4874) [webview_flutter_android] Added the functionality to fullscreen html5 video (flutter#3879) [tool] Add Android dependency (gradle) option to update dependencies command (flutter#4757) [camerax] Implement resolution configuration (flutter#3799) Manual roll Flutter from 685ce14 to aea4552 (64 revisions) (flutter#4870) [rfw, ci] Regenerate goldens, manually roll flutter#4835 (flutter#4862) Bump actions/checkout from 3.6.0 to 4.0.0 (flutter#4845) ...
This PR converts the iOS test of the url_launcher plugin from objc to swift.
List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#119102
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].CHANGELOG.md
to add a description of the change, [following repository CHANGELOG style].///
).