[cleanup] remove examples/test/*
Removes old test code used to validate Flutter Driver integration:
- examples/test/driver_example_mod
- examples/test/flutter_widget_test
Integration verified with:
fx make-integration-patch
Change-Id: I0224b514674af61064c3e75f877a81e552e1e046
diff --git a/BUILD.gn b/BUILD.gn
index 4f3a8c7..15e03f9 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -52,7 +52,6 @@
_flutter_tester_tests += [
"//topaz/public/dart/fuchsia_webview_flutter:fuchsia_webview_flutter_unittests($host_toolchain)",
"//topaz/public/dart/widgets:dart_widget_tests($host_toolchain)",
- "//topaz/examples/test/flutter_widget_test($host_toolchain)",
"//topaz/public/dart/fuchsia_internationalization_flutter:tests($host_toolchain)",
"//topaz/public/dart/fuchsia_modular:fuchsia_modular_package_unittests($host_toolchain)",
"//topaz/public/dart/fuchsia_scenic_flutter:fuchsia_scenic_flutter_unittests($host_toolchain)",
@@ -90,8 +89,6 @@
"//topaz/bin/ui/benchmarks/image_grid_flutter",
"//topaz/examples/fidl/echo_client_async_dart",
"//topaz/examples/fidl/echo_server_async_dart",
- "//topaz/examples/test/driver_example_mod",
- "//topaz/examples/test/driver_example_mod:driver_example_mod_tests",
"//topaz/lib/story_shell/examples/story_shell_test:key_listener_device_tests",
"//topaz/public/dart-pkg/zircon:dart_zircon_test",
"//topaz/public/dart/composition_delegate:composition_delegate_tests($host_toolchain)",
diff --git a/examples/test/driver_example_mod/BUILD.gn b/examples/test/driver_example_mod/BUILD.gn
deleted file mode 100644
index e14ac06..0000000
--- a/examples/test/driver_example_mod/BUILD.gn
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/testing/environments.gni")
-import("//topaz/runtime/dart/dart_fuchsia_test.gni")
-import("//topaz/runtime/flutter_runner/flutter_app.gni")
-
-# The main app.
-flutter_app("driver_example_mod") {
- package_name = "driver_example_mod"
-
- main_dart = "lib/main.dart"
-
- meta = [
- {
- path = rebase_path("meta/driver_example_mod.cmx")
- dest = "driver_example_mod.cmx"
- },
- ]
-
- # This creates a flutter_driver enabled binary that will enable extensions for
- # testing when run in an environment along with TestRunner.
- flutter_driver_extendable = true
-
- sources = [
- "src/driver_example_model.dart",
- "src/handlers/root_intent_handler.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/public/dart/fuchsia_modular",
- "//topaz/public/dart/fuchsia_services",
- "//topaz/public/lib/widgets/dart",
- ]
-}
-
-# Example of a flutter driver target test. This can be run on the Fuchsia
-# device using fx run-test. The target application must be available on the
-# machine.
-dart_fuchsia_test("driver_example_mod_tests") {
- sources = [
- "driver_example_mod_test.dart",
- ]
- deps = [
- "//sdk/fidl/fuchsia.sys",
- "//third_party/dart-pkg/git/flutter/packages/flutter_driver",
- "//third_party/dart-pkg/pub/test",
- "//topaz/public/dart/fuchsia_modular_testing",
- "//topaz/public/dart/fuchsia_services",
- ]
-
- meta = [
- {
- path = rebase_path("meta/driver_example_mod_tests.cmx")
- dest = "driver_example_mod_tests.cmx"
- },
- ]
-
- environments = []
-
- # Flutter driver is only available in debug builds, so don't try to run in
- # release CI/CQ.
- if (is_debug) {
- environments += [
- {
- dimensions = {
- device_type = "Intel NUC Kit NUC7i5DNHE"
- }
- tags = [ "flaky" ] # fxb/38260
- },
- {
- dimensions = {
- device_type = "Khadas Vim2 Max"
- }
- tags = [ "flaky" ] # fxb/38260
- },
- ]
- }
-}
diff --git a/examples/test/driver_example_mod/README.md b/examples/test/driver_example_mod/README.md
deleted file mode 100644
index 287f6aa..0000000
--- a/examples/test/driver_example_mod/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# The Flutter Driver example mod
-
-This is a very simple mod intended to be used with flutter driver testing
-scripts.
-
-It contains four buttons that all modify a counter.
-
-## Building
-
-To add the example (with the Flutter Driver Extensions enabled for driving the
-mod), run the following:
-
-```
-$ fx set core.[chromebook-][x64|arm64] --with //topaz/examples/test/driver_example_mod:driver_example_mod_tests --with //topaz/bundles:buildbot
-```
-
-This will include the package and its dependencies with the topaz build when
-you run
-
-```
-$ fx build
-$ fx serve
-```
-
-## Testing
-
-You can then run these tests using the following command:
-
-```
-$ fx run-test driver_example_mod_tests
-```
diff --git a/examples/test/driver_example_mod/analysis_options.yaml b/examples/test/driver_example_mod/analysis_options.yaml
deleted file mode 100644
index f0cea8a..0000000
--- a/examples/test/driver_example_mod/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../../tools/analysis_options.yaml
diff --git a/examples/test/driver_example_mod/lib/main.dart b/examples/test/driver_example_mod/lib/main.dart
deleted file mode 100644
index 144f5ef..0000000
--- a/examples/test/driver_example_mod/lib/main.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:fuchsia_modular/module.dart';
-import 'package:fuchsia_logger/logger.dart';
-
-import 'src/handlers/root_intent_handler.dart';
-
-/// Main entry point to driver example module.
-void main() {
- setupLogger(name: 'driver_example_mod');
- Module().registerIntentHandler(RootIntentHandler());
-}
diff --git a/examples/test/driver_example_mod/lib/src/driver_example_model.dart b/examples/test/driver_example_mod/lib/src/driver_example_model.dart
deleted file mode 100644
index 484854b..0000000
--- a/examples/test/driver_example_mod/lib/src/driver_example_model.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:lib.widgets.dart/model.dart';
-
-class DriverExampleModel extends Model {
- /// Constructs model with an initial count of zero.
- DriverExampleModel() : _count = 0;
-
- int _count;
- int get count => _count;
-
- /// Increments the counter. If no args are supplied increases by one, else by
- /// the number `by`.
- void increment({int by}) {
- if (by == null) {
- _count++;
- } else {
- _count += by;
- }
- notifyListeners();
- }
-
- /// Decrements the counter. If no args are supplied decreases by one, else by
- /// the number `by`.
- void decrement({int by}) {
- if (by == null) {
- _count--;
- } else {
- _count -= by;
- }
- notifyListeners();
- }
-}
diff --git a/examples/test/driver_example_mod/lib/src/handlers/root_intent_handler.dart b/examples/test/driver_example_mod/lib/src/handlers/root_intent_handler.dart
deleted file mode 100644
index 6907207..0000000
--- a/examples/test/driver_example_mod/lib/src/handlers/root_intent_handler.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2019 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:flutter/material.dart' hide Intent;
-import 'package:fuchsia_modular/module.dart';
-import 'package:lib.widgets.dart/model.dart'
- show ScopedModel, ScopedModelDescendant;
-
-import '../driver_example_model.dart';
-
-class RootIntentHandler extends IntentHandler {
- @override
- void handleIntent(Intent intent) async {
- DriverExampleModel model = DriverExampleModel();
- runApp(
- ScopedModel<DriverExampleModel>(
- model: model,
- child: MaterialApp(
- home: Scaffold(
- body: ScopedModelDescendant<DriverExampleModel>(
- builder: (BuildContext context, Widget child,
- DriverExampleModel model) {
- return Column(
- children: <Widget>[
- Center(
- child: Directionality(
- textDirection: TextDirection.ltr,
- child: Text(
- 'This counter has a value of: ${model.count}'),
- ),
- ),
- Row(
- children: <Widget>[
- FlatButton(
- child: Text('+1'),
- onPressed: () => model.increment(),
- ),
- FlatButton(
- child: Text('-1'),
- onPressed: () => model.decrement(),
- ),
- FlatButton(
- child: Text('+5'),
- onPressed: () => model.increment(by: 5),
- ),
- FlatButton(
- child: Text('-5'),
- onPressed: () => model.decrement(by: 5),
- ),
- ],
- ),
- ],
- );
- },
- ),
- ),
- ),
- ),
- );
- }
-}
diff --git a/examples/test/driver_example_mod/meta/driver_example_mod.cmx b/examples/test/driver_example_mod/meta/driver_example_mod.cmx
deleted file mode 100644
index ef876ff..0000000
--- a/examples/test/driver_example_mod/meta/driver_example_mod.cmx
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "program": {
- "data": "data/driver_example_mod"
- },
- "sandbox": {
- "services": [
- "fuchsia.fonts.Provider",
- "fuchsia.logger.LogSink",
- "fuchsia.modular.ModuleContext",
- "fuchsia.sys.Launcher",
- "fuchsia.sys.Environment",
- "fuchsia.ui.input.ImeService",
- "fuchsia.ui.policy.Presenter",
- "fuchsia.ui.scenic.Scenic"
- ]
- }
-}
diff --git a/examples/test/driver_example_mod/meta/driver_example_mod_tests.cmx b/examples/test/driver_example_mod/meta/driver_example_mod_tests.cmx
deleted file mode 100644
index 852cd3d..0000000
--- a/examples/test/driver_example_mod/meta/driver_example_mod_tests.cmx
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "facets": {
- "fuchsia.test": {
- "injected-services": {
- "fuchsia.devicesettings.DeviceSettingsManager": "fuchsia-pkg://fuchsia.com/device_settings_manager#meta/device_settings_manager.cmx",
- "fuchsia.fonts.Provider": "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx",
- "fuchsia.identity.account.AccountManager": "fuchsia-pkg://fuchsia.com/account_manager#meta/account_manager.cmx",
- "fuchsia.sysmem.Allocator": "fuchsia-pkg://fuchsia.com/sysmem_connector#meta/sysmem_connector.cmx",
- "fuchsia.tracing.provider.Registry": "fuchsia-pkg://fuchsia.com/trace_manager#meta/trace_manager.cmx",
- "fuchsia.ui.input.ImeService": "fuchsia-pkg://fuchsia.com/ime_service#meta/ime_service.cmx",
- "fuchsia.ui.policy.Presenter": "fuchsia-pkg://fuchsia.com/root_presenter#meta/root_presenter.cmx",
- "fuchsia.ui.scenic.Scenic": "fuchsia-pkg://fuchsia.com/scenic#meta/scenic.cmx",
- "fuchsia.vulkan.loader.Loader": "fuchsia-pkg://fuchsia.com/vulkan_loader#meta/vulkan_loader.cmx"
- },
- "system-services": [
- "fuchsia.net.NameLookup",
- "fuchsia.netstack.Netstack",
- "fuchsia.posix.socket.Provider"
- ]
- }
- },
- "program": {
- "data": "data/driver_example_mod_tests"
- },
- "sandbox": {
- "features": [
- "deprecated-ambient-replace-as-executable",
- "hub",
- "shell-commands"
- ],
- "services": [
- "fuchsia.devicesettings.DeviceSettingsManager",
- "fuchsia.fonts.Provider",
- "fuchsia.identity.account.AccountManager",
- "fuchsia.posix.socket.Provider",
- "fuchsia.sys.Environment",
- "fuchsia.sys.Launcher",
- "fuchsia.sysmem.Allocator",
- "fuchsia.ui.policy.Presenter",
- "fuchsia.ui.scenic.Scenic",
- "fuchsia.vulkan.loader.Loader"
- ]
- }
-}
diff --git a/examples/test/driver_example_mod/pubspec.yaml b/examples/test/driver_example_mod/pubspec.yaml
deleted file mode 100644
index de784fc..0000000
--- a/examples/test/driver_example_mod/pubspec.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
diff --git a/examples/test/driver_example_mod/test/driver_example_mod_test.dart b/examples/test/driver_example_mod/test/driver_example_mod_test.dart
deleted file mode 100644
index 747fe4b..0000000
--- a/examples/test/driver_example_mod/test/driver_example_mod_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:fidl_fuchsia_modular/fidl_async.dart' as modular;
-import 'package:fidl_fuchsia_modular_testing/fidl_async.dart';
-import 'package:flutter_driver/flutter_driver.dart';
-import 'package:fuchsia_modular_testing/test.dart';
-import 'package:test/test.dart';
-import 'package:zircon/zircon.dart';
-
-const Pattern _isolatePattern = 'driver_example_mod.cmx';
-const _testAppUrl =
- 'fuchsia-pkg://fuchsia.com/driver_example_mod#meta/driver_example_mod.cmx';
-
-final _addModCommand = modular.AddMod(
- modName: [_isolatePattern],
- modNameTransitional: 'root',
- intent: modular.Intent(action: 'action', handler: _testAppUrl),
- surfaceRelation: modular.SurfaceRelation());
-
-Future<void> _launchModUnderTest(TestHarnessProxy testHarness) async {
- final puppetMaster = modular.PuppetMasterProxy();
- await testHarness.connectToModularService(
- ModularService.withPuppetMaster(puppetMaster.ctrl.request()));
-
- // Use PuppetMaster to start a fake story and launch the mod under test
- final storyPuppetMaster = modular.StoryPuppetMasterProxy();
- await puppetMaster.controlStory(
- 'driver_example_mod_test', storyPuppetMaster.ctrl.request());
- await storyPuppetMaster
- .enqueue([modular.StoryCommand.withAddMod(_addModCommand)]);
- await storyPuppetMaster.execute();
-}
-
-void main() {
- group('driver example tests', () {
- TestHarnessProxy testHarness;
- FlutterDriver driver;
-
- setUpAll(() async {
- testHarness = await launchTestHarness();
- await testHarness.run(TestHarnessSpec(
- envServices:
- EnvironmentServicesSpec(serviceDir: Channel.fromFile('/svc'))));
- await _launchModUnderTest(testHarness);
-
- driver = await FlutterDriver.connect(
- fuchsiaModuleTarget: _isolatePattern,
- printCommunication: true,
- logCommunicationToFile: false);
- });
-
- tearDownAll(() async {
- await driver?.close();
- testHarness.ctrl.close();
- });
-
- test('driver connection', () {
- expect(driver, isNotNull);
- });
-
- test('add to counter. remove from counter', () async {
- await driver.tap(find.text('+1'));
- await driver.tap(find.text('+1'));
- await driver.tap(find.text('+5'));
- await driver.tap(find.text('-1'));
- SerializableFinder textFinder =
- find.text('This counter has a value of: 6');
- // If this value hasn't been set correctly the app will crash, as the
- // widget will not be findable.
- await driver.tap(textFinder);
- await driver.tap(find.text('-5'));
- await driver.tap(find.text('-1'));
- textFinder = find.text('This counter has a value of: 0');
- await driver.tap(textFinder);
- });
- });
-}
diff --git a/examples/test/flutter_widget_test/BUILD.gn b/examples/test/flutter_widget_test/BUILD.gn
deleted file mode 100644
index 9fb287d..0000000
--- a/examples/test/flutter_widget_test/BUILD.gn
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//topaz/runtime/dart/flutter_test.gni")
-
-flutter_test("flutter_widget_test") {
- sources = [
- "../test/flutter_widget_test.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/git/flutter/packages/flutter_test",
- "//third_party/dart-pkg/pub/test",
- "//topaz/public/lib/testing/flutter",
- ]
-}
diff --git a/examples/test/flutter_widget_test/analysis_options.yaml b/examples/test/flutter_widget_test/analysis_options.yaml
deleted file mode 100644
index f0cea8a..0000000
--- a/examples/test/flutter_widget_test/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../../tools/analysis_options.yaml
diff --git a/examples/test/flutter_widget_test/pubspec.yaml b/examples/test/flutter_widget_test/pubspec.yaml
deleted file mode 100644
index 7d8aed9..0000000
--- a/examples/test/flutter_widget_test/pubspec.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-name: flutter_widget_test
-
-dev_dependencies:
- flutter_test:
- sdk: flutter
diff --git a/examples/test/flutter_widget_test/test/flutter_widget_test.dart b/examples/test/flutter_widget_test/test/flutter_widget_test.dart
deleted file mode 100644
index 46465e6..0000000
--- a/examples/test/flutter_widget_test/test/flutter_widget_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-void main() {
- testWidgets('my first widget test', (WidgetTester tester) async {
- // You can use keys to locate the widget you need to test
- var sliderKey = UniqueKey();
- var value = 0.0;
-
- // Tells the tester to build a UI based on the widget tree passed to it
- await tester.pumpWidget(
- StatefulBuilder(
- builder: (BuildContext context, StateSetter setState) {
- return MaterialApp(
- home: Material(
- child: Center(
- child: Slider(
- key: sliderKey,
- value: value,
- onChanged: (double newValue) {
- setState(() {
- value = newValue;
- });
- },
- ),
- ),
- ),
- );
- },
- ),
- );
- expect(value, equals(0.0));
-
- // Taps on the widget found by key
- await tester.tap(find.byKey(sliderKey));
-
- // Verifies that the widget updated the value correctly
- expect(value, equals(0.5));
- });
-}
-