Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Jun 30, 2021

In order to deal with browser differences we have relied on conditional logic (if blocks) and map look-ups scattered throughout the felt codebase. For example, there would be chunks of code like this:

    if (isSafariIOS) {
      await IosSafariArgParser.instance.initIosSimulator();
    }

As well as listings and mapping like this.

This PR introduces BrowserEnvironment interface that provides the functionality needed by the test runner. A single switch block at the root (in test_runner.dart) is used to determine a concrete implementation of this interface. The rest of the code no longer needs to deal with browser differences. It just requests the needed functionality from BrowserEnvironment.

As a result all the routing logic from supported_browsers.dart is gone and the file deleted. Browser-specific implementations of ScreenshotManager are moved to their respective browser files (chrome.dart, firefox.dart, etc), and the screenshot_manager.dart file deleted.

The logic in safari.dart that attempted to support desktop and mobile Safari vis if/else blocks has been split up into safari_ios.dart and safari_macos.dart.

The rest of the code was updated to use the BrowserEnvironment API.

Bonus: do-fetch-goldens-repo has been changed to skip-goldens-repo-fetch to better reflect the default (you opt-in to skip the fetch rather than ask it to fetch).

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

@flutter-dashboard flutter-dashboard bot added platform-web Code specifically for the web engine needs tests labels Jun 30, 2021
@google-cla google-cla bot added the cla: yes label Jun 30, 2021
@yjbanov yjbanov requested a review from mdebbar June 30, 2021 23:12
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

I love this new structure. Makes much sense!

///
/// Example file names:
/// - Chrome, no-suffix: backdrop_filter_clip_moved.actual.png
/// - iOS Safari: backdrop_filter_clip_moved.actual.iOS_Safari.png
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: it should be *.iOS_Safari.actual.png

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

return screenshot;
/// A class for running an instance of Safari for iOS (i.e. mobile Safari).
Copy link
Contributor

Choose a reason for hiding this comment

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

(as you always suggest to me 😁): "A class for" is unnecessary, we already know it's a class. Maybe: "Runs an instance of ..."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for rereading the comments. I didn't read the comments for code that I copied (although I should have). Fixed here and a few other places.

'simctl',
'openurl', // Opens the url on Safari installed on the simulator.
'booted', // The simulator is already booted.
'${url.toString()}'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: trailing comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@yjbanov yjbanov merged commit 4ec5781 into flutter:master Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 3, 2021
bdero pushed a commit to flutter/flutter that referenced this pull request Jul 3, 2021
* e94ed1c [web] skip overlay test on Safari (flutter/engine#27114)

* 6b92842 Roll Skia from 1c467774e56e to e9ab391765c7 (1 revision) (flutter/engine#27143)

* 0977906 Update goldens test for Thai. (flutter/engine#27144)

* 4ec5781 [web] replace browser-related conditional logic with BrowserEnvironment (flutter/engine#27084)

* 05ce70e enable DisplayList by default (flutter/engine#27130)

* e3357d2 Roll Fuchsia Mac SDK from jzKy-rCeR... to oiyYFMOd3... (flutter/engine#27145)

* cb1c312 Support right-clicking on iPadOS (flutter/engine#27019)

* 4ac4e5c Roll Fuchsia Linux SDK from 4MLcvcjCH... to QbIpQIqxK... (flutter/engine#27146)

* e6250f7 Roll Skia from e9ab391765c7 to 04d79fc59488 (1 revision) (flutter/engine#27148)

* 2dacffa Revert "enable DisplayList by default (#27130)" (flutter/engine#27153)
moffatman pushed a commit to moffatman/engine that referenced this pull request Aug 5, 2021
…nt (flutter#27084)

* [web] replace browser-related conditional logic with BrowserEnvironment
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Sep 2, 2021
…nt (flutter#27084)

* [web] replace browser-related conditional logic with BrowserEnvironment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes needs tests platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants