Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Sep 5, 2019

Description

This pr is the framework counter part of flutter/engine#11913

Related Issues

#39832

Tests

I added the following tests:

Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Sep 5, 2019
@chunhtai chunhtai added the c: API break Backwards-incompatible API changes label Sep 6, 2019
@chunhtai chunhtai requested review from goderbauer and xster September 6, 2019 20:16
@xster
Copy link
Member

xster commented Sep 7, 2019

LGTM otherwise

@Piinks Piinks changed the title added new lfecycle state added new lifecycle state Sep 13, 2019
@Piinks Piinks added the a: existing-apps Integration with existing apps via the add-to-app flow label Sep 16, 2019
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remind myself need to remove local engine once engine change is in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmagman I copy the test from ios_add2app
The test is using XCTestCase to launch the app, and use tap a native button so that it will bring up a flutter view controller. The assertion is in dart side. Is there a way for dart code to notify the engine that the app has crashed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I just saw this. I'm not sure now a dart assert expresses itself in an iOS process... does the app not crash, it just goes white or something?

@chunhtai
Copy link
Contributor Author

ready for review, Added integration test ios_add2app_life_cycle
Here is how the test work.
When main.dart first run, it will cut off semantics hook to prevent flutter app sending semantics update notification to ios embedding.
the flutter app will create a widget that will spy on life cycle changes, and it will rewire semantics hook when it receives expected life cycle sequence. At this point, flutter app will start sending semantics update to ios embeding.

On the Native test side, it will initialize engine and bring up flutterviewcontroller. After that, it will be waiting to receive semantics update with a time out of 30 seconds.

If the flutter app does not receive correct life cycle sequence (detached -> inactive -> resumed), it will never rewire the semantics hook. The native app will timeout after 30 seconds and fail the test.
@goderbauer @jmagman

@chunhtai chunhtai requested a review from jmagman October 3, 2019 16:24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this scheme and add ios_add2appTests to ios_add2app.xcscheme's tests. Then the test command becomes:

set -o pipefail && xcodebuild \
  -workspace ios_add2app.xcworkspace \
  -scheme  ios_add2app \
  -sdk "iphonesimulator$os_version" \
  -destination "OS=$os_version,name=iPhone X" test | $PRETTY

(I know you copied this pattern from the add2app tests, I've been meaning to change it there, too).

Copy link
Contributor Author

@chunhtai chunhtai Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got error 'Scheme ios_add2app is not currently configured for the test action'. do you mean the other way around? deleting ios_add2app and only keep iod_add2appTests?

Copy link
Member

@jmagman jmagman Oct 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To configure it for the test action:

Product > Scheme > Manage Schemes... > ios_add2app > Edit...
Screen Shot 2019-10-03 at 5 24 14 PM

Test > Test > + > ios_add2appTests > Add
Screen Shot 2019-10-03 at 5 24 53 PM

Then you can delete the ios_add2appTests scheme. I'm happy to come show you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to override the getter, you can remove this.

Comment on lines 33 to 42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set with the property setters, not the backing instance variables here so the KVO notifications get posted correctly.

self.mainViewController = ...
self.navigationController = ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readonly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this wrapper method necessary? Can -showFullScreenCold grab what it needs from the AppDelegate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm not familiar with the message channel patterns, is this used anywhere?

Comment on lines 8 to 9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the relative paths.

#import "AppDelegate.h"
#import "FullScreenViewController.h"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks unused?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you seeing memory bloat here? I would imagine the pool drains between tests but I don't know.

@chunhtai
Copy link
Contributor Author

chunhtai commented Oct 4, 2019

@jmagman addressed all comments, ready for review

@codecov
Copy link

codecov bot commented Oct 4, 2019

Codecov Report

Merging #39945 into master will decrease coverage by 3.51%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #39945      +/-   ##
==========================================
- Coverage   62.21%    58.7%   -3.52%     
==========================================
  Files         199      194       -5     
  Lines       19234    18977     -257     
==========================================
- Hits        11966    11140     -826     
- Misses       7268     7837     +569
Flag Coverage Δ
#flutter_tool 58.7% <ø> (-3.52%) ⬇️
Impacted Files Coverage Δ
...kages/flutter_tools/lib/src/commands/generate.dart 20% <0%> (-65.19%) ⬇️
...ages/flutter_tools/lib/src/commands/build_web.dart 29.41% <0%> (-64.71%) ⬇️
packages/flutter_tools/lib/src/web/compile.dart 10.34% <0%> (-59.66%) ⬇️
packages/flutter_tools/lib/src/web/workflow.dart 33.33% <0%> (-55.56%) ⬇️
...ages/flutter_tools/lib/src/macos/macos_device.dart 8% <0%> (-43.86%) ⬇️
...ages/flutter_tools/lib/src/linux/linux_device.dart 40% <0%> (-31.43%) ⬇️
...ackages/flutter_tools/lib/src/commands/unpack.dart 6.75% <0%> (-24.42%) ⬇️
packages/flutter_tools/lib/src/run_cold.dart 19.51% <0%> (-22.85%) ⬇️
...ter_tools/lib/src/build_system/targets/assets.dart 64.86% <0%> (-22.1%) ⬇️
packages/flutter_tools/lib/src/project.dart 65.23% <0%> (-21.19%) ⬇️
... and 108 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02aac50...5fdfd15. Read the comment docs.

@chunhtai
Copy link
Contributor Author

chunhtai commented Oct 7, 2019

@jmagman All comments addressed, thanks!

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all the updates! LGTM with nit.

@goderbauer
Copy link
Member

(PR triage): @chunhtai what's the status of this one?

@chunhtai
Copy link
Contributor Author

@goderbauer
This can be merged, but I am not confident to merge this along with engine pr when i am on vacation. I will be resume the merge after I come back from vacation. Let me know if I should close this.

@chunhtai chunhtai force-pushed the issues/39832 branch 2 times, most recently from 14b3649 to ac9874a Compare November 4, 2019 23:43
@xster
Copy link
Member

xster commented Nov 6, 2019

You're going to land this one soon to match flutter/engine#13642 right?

@chunhtai
Copy link
Contributor Author

chunhtai commented Nov 6, 2019

You're going to land this one soon to match flutter/engine#13642 right?

yes, I am waiting for luci build to finish before i can tag the sha

@xster
Copy link
Member

xster commented Nov 6, 2019

understood. Thanks

@chunhtai chunhtai merged commit 7aebde1 into flutter:master Nov 6, 2019
@xster
Copy link
Member

xster commented Nov 6, 2019

\o/

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: existing-apps Integration with existing apps via the add-to-app flow c: API break Backwards-incompatible API changes framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants