From 1c90ed8b64d9ed8ce2431afad8bc6e6d9acc4556 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 25 Oct 2023 13:24:15 -0700 Subject: [PATCH] Fix structure of pkg:integration_test (#137283) The private _ libraries should not be advertised as importable. Moving them to the src directory. I noticed this while browsing our dart docs. This should remove the underscore entries. ![image](https://github.com/flutter/flutter/assets/1227763/41511efe-4eb8-487a-9758-ccde1720e05a) Replaces https://github.com/flutter/flutter/pull/137197. --- packages/integration_test/lib/common.dart | 3 --- packages/integration_test/lib/integration_test.dart | 4 ++-- packages/integration_test/lib/{ => src}/_callback_io.dart | 8 ++++---- .../integration_test/lib/{ => src}/_callback_web.dart | 8 ++++---- .../integration_test/lib/{ => src}/_extension_io.dart | 0 .../integration_test/lib/{ => src}/_extension_web.dart | 0 packages/integration_test/lib/src/callback.dart | 5 +++++ packages/integration_test/lib/src/extension.dart | 5 +++++ 8 files changed, 20 insertions(+), 13 deletions(-) rename packages/integration_test/lib/{ => src}/_callback_io.dart (95%) rename packages/integration_test/lib/{ => src}/_callback_web.dart (97%) rename packages/integration_test/lib/{ => src}/_extension_io.dart (100%) rename packages/integration_test/lib/{ => src}/_extension_web.dart (100%) create mode 100644 packages/integration_test/lib/src/callback.dart create mode 100644 packages/integration_test/lib/src/extension.dart diff --git a/packages/integration_test/lib/common.dart b/packages/integration_test/lib/common.dart index e5307f924e..e148851b38 100644 --- a/packages/integration_test/lib/common.dart +++ b/packages/integration_test/lib/common.dart @@ -285,9 +285,6 @@ class WebDriverCommand { /// /// Depending on the platform the communication between `integration_tests` and /// the `driver_tests` can be different. -/// -/// For the web implementation [WebCallbackManager]. -/// For the io implementation [IOCallbackManager]. abstract class CallbackManager { /// The callback function to response the driver side input. Future> callback( diff --git a/packages/integration_test/lib/integration_test.dart b/packages/integration_test/lib/integration_test.dart index 811f1c244e..244cfbd98e 100644 --- a/packages/integration_test/lib/integration_test.dart +++ b/packages/integration_test/lib/integration_test.dart @@ -14,10 +14,10 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:vm_service/vm_service.dart' as vm; -import '_callback_io.dart' if (dart.library.html) '_callback_web.dart' as driver_actions; -import '_extension_io.dart' if (dart.library.html) '_extension_web.dart'; import 'common.dart'; +import 'src/callback.dart' as driver_actions; import 'src/channel.dart'; +import 'src/extension.dart'; const String _success = 'success'; diff --git a/packages/integration_test/lib/_callback_io.dart b/packages/integration_test/lib/src/_callback_io.dart similarity index 95% rename from packages/integration_test/lib/_callback_io.dart rename to packages/integration_test/lib/src/_callback_io.dart index 40850d6859..e2181cee60 100644 --- a/packages/integration_test/lib/_callback_io.dart +++ b/packages/integration_test/lib/src/_callback_io.dart @@ -8,8 +8,8 @@ import 'dart:ui'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'common.dart'; -import 'src/channel.dart'; +import '../common.dart'; +import 'channel.dart'; /// The dart:io implementation of [CallbackManager]. /// @@ -19,12 +19,12 @@ import 'src/channel.dart'; CallbackManager get callbackManager => _singletonCallbackManager; /// IOCallbackManager singleton. -final IOCallbackManager _singletonCallbackManager = IOCallbackManager(); +final _IOCallbackManager _singletonCallbackManager = _IOCallbackManager(); /// Manages communication between `integration_tests` and the `driver_tests`. /// /// This is the dart:io implementation. -class IOCallbackManager implements CallbackManager { +class _IOCallbackManager implements CallbackManager { @override Future> callback( Map params, IntegrationTestResults testRunner) async { diff --git a/packages/integration_test/lib/_callback_web.dart b/packages/integration_test/lib/src/_callback_web.dart similarity index 97% rename from packages/integration_test/lib/_callback_web.dart rename to packages/integration_test/lib/src/_callback_web.dart index c56eb0813e..88d01c6d26 100644 --- a/packages/integration_test/lib/_callback_web.dart +++ b/packages/integration_test/lib/src/_callback_web.dart @@ -4,7 +4,7 @@ import 'dart:async'; -import 'common.dart'; +import '../common.dart'; /// The dart:html implementation of [CallbackManager]. /// @@ -14,8 +14,8 @@ import 'common.dart'; CallbackManager get callbackManager => _singletonWebDriverCommandManager; /// WebDriverCommandManager singleton. -final WebCallbackManager _singletonWebDriverCommandManager = - WebCallbackManager(); +final _WebCallbackManager _singletonWebDriverCommandManager = + _WebCallbackManager(); /// Manages communication between `integration_tests` and the `driver_tests`. /// @@ -26,7 +26,7 @@ final WebCallbackManager _singletonWebDriverCommandManager = /// WebDriver APIs. /// /// See: https://www.w3.org/TR/webdriver/ -class WebCallbackManager implements CallbackManager { +class _WebCallbackManager implements CallbackManager { /// App side tests will put the command requests from WebDriver to this pipe. Completer _webDriverCommandPipe = Completer(); diff --git a/packages/integration_test/lib/_extension_io.dart b/packages/integration_test/lib/src/_extension_io.dart similarity index 100% rename from packages/integration_test/lib/_extension_io.dart rename to packages/integration_test/lib/src/_extension_io.dart diff --git a/packages/integration_test/lib/_extension_web.dart b/packages/integration_test/lib/src/_extension_web.dart similarity index 100% rename from packages/integration_test/lib/_extension_web.dart rename to packages/integration_test/lib/src/_extension_web.dart diff --git a/packages/integration_test/lib/src/callback.dart b/packages/integration_test/lib/src/callback.dart new file mode 100644 index 0000000000..c10e2d27c6 --- /dev/null +++ b/packages/integration_test/lib/src/callback.dart @@ -0,0 +1,5 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export '_callback_io.dart' if (dart.library.html) '_callback_web.dart'; diff --git a/packages/integration_test/lib/src/extension.dart b/packages/integration_test/lib/src/extension.dart new file mode 100644 index 0000000000..a2cb861fbf --- /dev/null +++ b/packages/integration_test/lib/src/extension.dart @@ -0,0 +1,5 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export '_extension_io.dart' if (dart.library.html) '_extension_web.dart';