1. 29 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Refactor the test framework (#3622) · 91dd9699
      Ian Hickson authored
      * Refactor widget test framework
      
      Instead of:
      
      ```dart
        test("Card Collection smoke test", () {
          testWidgets((WidgetTester tester) {
      ```
      
      ...you now say:
      
      ```dart
        testWidgets("Card Collection smoke test", (WidgetTester tester) {
      ```
      
      Instead of:
      
      ```dart
        expect(tester, hasWidget(find.text('hello')));
      ```
      
      ...you now say:
      
      ```dart
        expect(find.text('hello'), findsOneWidget);
      ```
      
      Instead of the previous API (exists, widgets, widget, stateOf,
      elementOf, etc), you now have the following comprehensive API. All these
      are functions that take a Finder, except the all* properties.
      
      * `any()` - true if anything matches, c.f. `Iterable.any`
      * `allWidgets` - all the widgets in the tree
      * `widget()` - the one and only widget that matches the finder
      * `firstWidget()` - the first widget that matches the finder
      * `allElements` - all the elements in the tree
      * `element()` - the one and only element that matches the finder
      * `firstElement()` - the first element that matches the finder
      * `allStates` - all the `State`s in the tree
      * `state()` - the one and only state that matches the finder
      * `firstState()` - the first state that matches the finder
      * `allRenderObjects` - all the render objects in the tree
      * `renderObject()` - the one and only render object that matches the finder
      * `firstRenderObject()` - the first render object that matches the finder
      
      There's also `layers' which returns the list of current layers.
      
      `tap`, `fling`, getCenter, getSize, etc, take Finders, like the APIs
      above, and expect there to only be one matching widget.
      
      The finders are:
      
       * `find.text(String text)`
       * `find.widgetWithText(Type widgetType, String text)`
       * `find.byKey(Key key)`
       * `find.byType(Type type)`
       * `find.byElementType(Type type)`
       * `find.byConfig(Widget config)`
       * `find.byWidgetPredicate(WidgetPredicate predicate)`
       * `find.byElementPredicate(ElementPredicate predicate)`
      
      The matchers (for `expect`) are:
      
       * `findsNothing`
       * `findsWidgets`
       * `findsOneWidget`
       * `findsNWidgets(n)`
       * `isOnStage`
       * `isOffStage`
       * `isInCard`
       * `isNotInCard`
      
      Benchmarks now use benchmarkWidgets instead of testWidgets.
      
      Also, for those of you using mockers, `serviceMocker` now automatically
      handles the binding initialization.
      
      This patch also:
      
      * changes how tests are run so that we can more easily swap the logic
        out for a "real" mode instead of FakeAsync.
      
      * introduces CachingIterable.
      
      * changes how flutter_driver interacts with the widget tree to use the
        aforementioned new API rather than ElementTreeTester, which is gone.
      
      * removes ElementTreeTester.
      
      * changes the semantics of a test for scrollables because we couldn't
        convince ourselves that the old semantics made sense; it only worked
        before because flushing the microtasks after every event was broken.
      
      * fixes the flushing of microtasks after every event.
      
      * Reindent the tests
      
      * Fix review comments
      91dd9699
  2. 27 Apr, 2016 1 commit
  3. 22 Apr, 2016 4 commits
    • Adam Barth's avatar
      A blinking cursor should push only one frame (#3445) (#3506) · a5e794ca
      Adam Barth authored
      Prior to this patch, we were pushing two frames each time the cursor blinked.
      In turning the cursor on or off, the markNeedsPaint call was triggering another
      frame to be scheduled because we cleared a bit in the scheduler at the
      beginning of the frame instead of at the end of the frame.
      
      To implement scheduling correctly, we actually need two bits: one for
      ensureVisualUpdate, which just promises to get to the end of the pipeline soon,
      and scheduleFrame, which promises to get to the beginning of the pipeline soon.
      
      (Reland)
      a5e794ca
    • Ian Hickson's avatar
      Clean up our timeline events. (#3504) · b5a827bf
      Ian Hickson authored
      This adds in particular the ability to track the time at which the
      framework boots up, and the time at which we are confident we have
      completed the first useful frame.
      b5a827bf
    • Adam Barth's avatar
      Revert "A blinking cursor should push only one frame (#3445)" · c486fc4a
      Adam Barth authored
      This reverts commit 161f945e.
      
      This patch caused a number of regressions.
      
      Fixes #3497
      c486fc4a
    • Ian Hickson's avatar
      Rename binding abstract classes (#3482) · e968d91c
      Ian Hickson authored
      The old names were getting silly and started stepping on valuable namespace.
      
      The new names are consistent and clear.
      e968d91c
  4. 21 Apr, 2016 1 commit
    • Adam Barth's avatar
      A blinking cursor should push only one frame (#3445) · 161f945e
      Adam Barth authored
      Prior to this patch, we were pushing two frames each time the cursor blinked.
      In turning the cursor on or off, the markNeedsPaint call was triggering another
      frame to be scheduled because we cleared a bit in the scheduler at the
      beginning of the frame instead of at the end of the frame.
      
      To implement scheduling correctly, we actually need two bits: one for
      ensureVisualUpdate, which just promises to get to the end of the pipeline soon,
      and scheduleFrame, which promises to get to the beginning of the pipeline soon.
      161f945e
  5. 19 Apr, 2016 2 commits
    • Ian Hickson's avatar
      Refactor service extensions (#3397) · 261923e5
      Ian Hickson authored
      Bindings now have a debugRegisterServiceExtensions() method that is
      invoked in debug mode (only). (Once we have a profile mode, there'll be
      a registerProfileServiceExtensions() method that gets called in that
      mode only to register extensions that apply then.)
      
      The BindingBase class provides convenience methods for registering
      service extensions that do the equivalent of:
      
      ```dart
      void extension() { ... }
      bool extension([bool enabled]) { ... }
      double extension([double extension])  { ... }
      Map<String, String> extension([Map<String, String> parameters]) { ... }
      ```
      
      The BindingBase class also itself registers ext.flutter.reassemble,
      which it has call a function on the binding called
      reassembleApplication().
      
      The Scheduler binding now exposes the preexisting
      ext.flutter.timeDilation.
      
      The Renderer binding now exposes the preexisting ext.flutter.debugPaint.
      
      The Renderer binding hooks reassembleApplication to trigger the
      rendering tree to be reprocessed (in particular, to fix up the
      optimisation closures).
      
      All the logic from rendering/debug.dart about service extensions is
      replaced by the above.
      
      I moved basic_types to foundation.
      
      The FlutterWidgets binding hooks reassembleApplication to trigger the
      widget tree to be entirely rebuilt.
      
      Flutter Driver now uses ext.flutter.driver instead of
      ext.flutter_driver, and is hooked using the same binding mechanism.
      Eventually we'll probably move the logic into the Flutter library so
      that you just get it without having to invoke a special method first.
      261923e5
    • Ian Hickson's avatar
      Rearrange scheduling library (#3388) · 61605a9d
      Ian Hickson authored
      To be more consistent with other parts of the platform:
      
      * put the binding in a binding.dart file.
      
      * rearrange some members of the Scheduler class to be more close to
        execution order.
      
      * factor out Priority class into its own file.
      
      * add more dart docs.
      61605a9d
  6. 15 Apr, 2016 2 commits
  7. 13 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Fix dependency skew. (#3306) · 7861d029
      Ian Hickson authored
      ...by adding tests to our examples that don't import flutter_test, which
      pins the relevant dependencies.
      
      Also, provide more information when complaining about leaked transient
      callbacks in tests.
      
      Also, make tests display full information when they have an exception,
      by bypassing the throttling we have for Android logging in tests.
      
      Also, make the word wrapping not wrap stack traces if they happen to
      be included in exception output.
      
      Also, fix a leaked transient callback in the checkbox code.
      7861d029
  8. 02 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Rationalise all our exception handling. · ee703da9
      Ian Hickson authored
      - Create a FlutterErrorDetails struct-like class that describes an
      
        exception along with more details that aren't in the exception, like
      
        where it was caught and what was going on when it was caught.
      
      
      
      - Provide a FlutterError static API for handling these objects:
      
      
      
        - FlutterError.onError which is called whenever Flutter catches an
      
          error.
      
      
      
        - FlutterError.reportError() which handles an error.
      
      
      
        - FlutterError.dumpErrorToConsole() which is the default behavior
      
          for onError.
      
      
      
      - Removes all the existing exception handler callbacks.
      
      
      
      - Replaces all the existing places that described exceptions using
      
        debugPrint with calls to FlutterError.reportError().
      
      
      
      - Extend lockState() to also catch exceptions, so that we catch
      
        exceptions that happen during finalizers.
      
      
      
      - Make the test framework catch errors and treat them as failures.
      
      
      
      - Provide a mechanism to override this behavior in the test framework.
      
      
      
      - Make the tests that used to depend on the exception handler
      
        callbacks use this new mechanism.
      
      
      
      - Make pump() also support the phase argument.
      
      
      
      - Improve some tests using these new features.
      
      
      
      Fixes #2356, #2988, #2985, #2220.
      ee703da9
  9. 14 Mar, 2016 1 commit
  10. 12 Mar, 2016 3 commits
  11. 11 Mar, 2016 1 commit
    • Ian Hickson's avatar
      Enable ALL THE LINTS · 1b9cd520
      Ian Hickson authored
      Well, all the easy ones, anyway.
      
      For some reason `// ignore:` isn't working for me so I've disabled
      lints that need that. Also disabled those that require a ton of work
      (which I'm doing, but not in this PR, to keep it reviewable).
      
      This adds:
      - avoid_init_to_null
      - library_names
      - package_api_docs
      - package_names
      - package_prefixed_library_names
      - prefer_is_not_empty
      - sort_constructors_first
      - sort_unnamed_constructors_first
      - unnecessary_getters_setters
      1b9cd520
  12. 13 Feb, 2016 1 commit
    • Hixie's avatar
      SizeObserver crusade: drawer · e5cf7fe3
      Hixie authored
      Drawer doesn't need a SizeObserver, since it only looks at the size
      in event handlers. It can just go and probe the tree to read the size.
      
      Also, change from using _kEdgeDragWidth to using _kWidth when figuring
      out how much of the drawer to show when dragging it from the edge, since
      that is more likely to match the drawer's width.
      e5cf7fe3
  13. 11 Feb, 2016 1 commit
    • Ian Hickson's avatar
      Clean up imports and exports. · a94999ba
      Ian Hickson authored
      Each layer is supposed to reexport the parts of the previous layer
      that are part of its API.
      
      - In painting.dart, export from dart:ui all the Canvas-related APIs
        that make sense to be used at higher levels, e.g. PaintingStyle.
      
      - Delete painting/shadows.dart. It was dead code.
      
      - In rendering/object.dart, export all of painting.dart.
      
      - In widgets/basic.dart, export all of painting.dart and
        animation.dart. Some classes in animation/ are renamed to make this
        less disruptive and confusing to the namespace.
      
      - Split out Stocks back into an import model rather than a part model,
        so that it's easier to manage its dependencies on a per-file basis.
      
      - Move Ticker to scheduler library.
      
      - Remove as many redundant imports as possible now.
      
      - Some minor nit picking cleanup in various files.
      a94999ba
  14. 28 Jan, 2016 1 commit
  15. 24 Jan, 2016 1 commit
  16. 07 Jan, 2016 1 commit
  17. 15 Dec, 2015 1 commit
  18. 14 Dec, 2015 1 commit
  19. 02 Dec, 2015 3 commits
    • Florian Loitsch's avatar
      Rename some of the functions from the scheduler. · 72821152
      Florian Loitsch authored
      The names are probably less familiar, but more consistent:
      - FrameCallback: a callback that is relative to the frame and wants the
        frame offset (a duration) as argument.
      - addXFrameCallback: adds the given callback to the internal lists/maps.
      - scheduleXFrameCallback (currently only X = ""): add the callback, but
        also trigger a new frame.
      - handleX: the method that is invoked when the event-loop or the frame
        calls into the scheduler.
      - ensureXYZ: ensure that the callback happens.
        Unfortunately there is the ambiguity between a "callback": it can be a
        closure, or the action of doing a callback, so we end up with:
        ensureBeginFrameCallback, and ensureEventLoopCallback, where
        "callback" means the action of being called back.
      72821152
    • Florian Loitsch's avatar
      Remove animation scheduler. · 018bcbf2
      Florian Loitsch authored
      018bcbf2
    • Florian Loitsch's avatar
      Merge the two schedulers. · 10c80f2e
      Florian Loitsch authored
      10c80f2e
  20. 17 Nov, 2015 1 commit