Make zone handlers call zone.run to run callbacks. (#2451)

The platform library `Zone` implementation will change to not use
`bindCallbackGuarded` in the `Timer` constructors and top-level
`scheduleMicrotask` function.
Instead it only calls `registerCallback`, and then the
`Zone.create{,Periodic}Timer` and `Zone.scheduleMicrotask` are in charge
of using `Zone.runGuarded` on the callback when timer/microtask event
happens.

This ensures that a surrounding zone's `registerCallback` can't make the
callback throw in a way that is outside of the `runGuarded` call.

Also makes periodic timers that are delayed past multiple tick points,
update their `tick` count by more than one instead of running multiple
times, like timers should.

Adds testing of using the `FakeAsync`'s `Zone` functions directly, and
embedding it in another zone to check that it does run using `Zone.run`.
Adds testing of periodic timers incrementing `tick` by more than one.
tree: ab47a5340729ceceedf1350c5f5307539d455d80
  1. .github/
  2. integration_tests/
  3. pkgs/
  4. tool/
  5. .gitattributes
  6. .gitignore
  7. analysis_options.yaml
  8. CODEOWNERS
  9. CONTRIBUTING.md
  10. mono_repo.yaml
  11. pubspec.yaml
  12. README.md
README.md

Dart CI OpenSSF Scorecard

What's here?

Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api and package:test_core are implementation details and generally not user-facing.

package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher and features a literate API.

Packages

PackageDescriptionIssuesVersion
checksA framework for checking values against expectations and building custom expectations.issuespub package
fake_asyncFake asynchronous events such as timers and microtasks for deterministic testing.issuespub package
matcherSupport for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases.issuespub package
testA full featured library for writing and running Dart tests across platforms.issuespub package
test_apiThe user facing API for structuring Dart tests and checking expectations.pub package
test_coreA basic library for writing tests and running them on the VM.pub package
test_descriptorAn API for defining and verifying files and directory structures.issuespub package
test_processTest processes: starting; validating stdout and stderr; checking exit code.issuespub package