Skip to content
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

Factor out a task synchronization help function for unit tests #28467

Merged
merged 3 commits into from Sep 8, 2021

Conversation

@ColdPaleLight
Copy link
Member

@ColdPaleLight ColdPaleLight commented Sep 5, 2021

The pattern of synchronously executing a task happens multiple times in tests. Pulled out helper functions can make tests are easier to parse/maintain

fixes: flutter/flutter#89493

detail: #28159 (comment)

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.
@google-cla google-cla bot added the cla: yes label Sep 5, 2021
"post_task_sync.cc",
"post_task_sync.h",
Comment on lines +20 to +21

This comment has been minimized.

@ColdPaleLight

ColdPaleLight Sep 5, 2021
Author Member

I am not sure if this is a good place to add post_task_sync.h and post_task_sync.cc. In addition, I am not sure whether post_task_sync.h and post_task_sync.cc are good file names.
But I think we should put these helper functions in a public place like this so that other unit tests can use them directly

This comment has been minimized.

@gaaclarke

gaaclarke Sep 8, 2021
Contributor

Yea, this sounds good to me.

@ColdPaleLight ColdPaleLight requested a review from gaaclarke Sep 5, 2021
void PostPlatformTaskSync(const TaskRunners& task_runners,
const std::function<void()>& function);

void PostUITaskSync(const TaskRunners& task_runners,
const std::function<void()>& function);

void PostRasterTaskSync(const TaskRunners& task_runners,
const std::function<void()>& function);

void PostIOTaskSync(const TaskRunners& task_runners,
const std::function<void()>& function);
Comment on lines 14 to 24

This comment has been minimized.

@gaaclarke

gaaclarke Sep 7, 2021
Contributor

I think we should remove these functions and just rely on PostTaskSync

This comment has been minimized.

@ColdPaleLight

ColdPaleLight Sep 8, 2021
Author Member

Done

@ColdPaleLight ColdPaleLight changed the title Factor out several task synchronization help functions for unit tests Factor out a task synchronization help function for unit tests Sep 8, 2021
@ColdPaleLight ColdPaleLight requested a review from gaaclarke Sep 8, 2021
Copy link
Contributor

@gaaclarke gaaclarke left a comment

LGTM, nice

@fluttergithubbot fluttergithubbot merged commit e296708 into flutter:master Sep 8, 2021
21 checks passed
21 checks passed
@flutter-dashboard
Linux Android AOT Engine
Details
@flutter-dashboard
Linux Android Debug Engine
Details
@flutter-dashboard
Linux Arm Host Engine
Details
@flutter-dashboard
Linux Framework Smoke Tests
Details
@flutter-dashboard
Linux Fuchsia
Details
@flutter-dashboard
Linux Fuchsia FEMU
Details
@flutter-dashboard
Linux Host Engine
Details
@flutter-dashboard
Linux Unopt
Details
@flutter-dashboard
Mac Android AOT Engine
Details
@flutter-dashboard
Mac Host Engine
Details
@flutter-dashboard
Mac Unopt
Details
@flutter-dashboard
Mac iOS Engine
Details
@wip
WIP Ready for review
Details
@flutter-dashboard
Windows Android AOT Engine
Details
@flutter-dashboard
Windows Host Engine
Details
@flutter-dashboard
Windows UWP Engine
Details
@flutter-dashboard
Windows Unopt
Details
@cirrus-ci
build_and_test_linux_unopt_debug Task Summary
Details
@flutter-dashboard
ci.yaml validation .ci.yaml validation
Details
@google-cla
cla/google All necessary CLAs are signed
@flutter-dashboard
luci-engine
Details
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants