From f415c255c7265d959c9fdf13a4db69a2c85bcc7b Mon Sep 17 00:00:00 2001 From: Caroline Liu <10456171+caroqliu@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:57:58 -0400 Subject: [PATCH] [fuchsia] migrate touch-input integration tests to gfx scene manager test ui stack (flutter/engine#41118) This change migrates `touch-input` integration tests from the `gfx-root-presenter-test-ui-stack` UI test realm variant to run parameterized tests of two types: `gfx-scene-manager-test-ui-stack` and `flatland-scene-manager-test-ui-stack`. Both are exercised for the generic tap test, and only GFX is exercised for embedded view cases. This will enable fuchsia.git to remove the `gfx-root-presenter-test-ui-stack` variant, which will no longer be supported. This change also: - removes or updates all remaining references of root presenter, which manifested in the form of inline code comments - adds a TODO to update the child view app for the embedded touch input test cases Note that this change does _not_ modify the `embedder` integration tests, which use a generic `test-ui-stack` variant as defined by the fuchsia pkg url: `fuchsia-pkg://fuchsia.com/test-ui-stack#meta/test-ui-stack.cm`. Since the contents of this package is defined in fuchsia.git, the realm under test can adapt to changes in fuchsia.git so long as they update the test-ui-stack build target (which they do in https://fxrev.dev/831359, the change that relies on the touch changes in this repo described above.) Fixes https://fxbug.dev/125304 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. --- .../flutter/tests/fakes/scenic/fake_session.h | 1 - .../lib/embedding-flutter-view.dart | 1 + .../touch-input/meta/touch-input-test.cml | 3 ++- .../touch-input/touch-input-test.cc | 21 ++++++++++++------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_session.h b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_session.h index eb55b95da6..9f5ecd91dc 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_session.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_session.h @@ -59,7 +59,6 @@ namespace flutter_runner::testing { // +Error handling / session disconnection is still WIP. FakeSession will // likely generate a CHECK in any place where the real scenic would disconnect // the session or send a ScenicError. -// +root_presenter-only commands e.g. CreateLayer are not handled. // +Deprecated / obsolete commands are not handled. // +Input is not handled. // +Rendering is not handled. diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart index 252ee55342..950d931b87 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart @@ -31,6 +31,7 @@ void main(List args) { print('embedding-flutter-view args: $option: ${arguments[option]}'); } + // TODO(fxbug.dev/125514): Support Flatland Child View. TestApp app = TestApp( ChildView.gfx(_launchGfxChildView()), showOverlay: arguments['showOverlay'], diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/meta/touch-input-test.cml b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/meta/touch-input-test.cml index 2e24ff66df..a5a34384e0 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/meta/touch-input-test.cml +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/meta/touch-input-test.cml @@ -55,7 +55,8 @@ "fuchsia.test": { "deprecated-allowed-packages": [ "embedding-flutter-view", - "gfx-root-presenter-test-ui-stack", + "gfx-scene-manager-test-ui-stack", + "flatland-scene-manager-test-ui-stack", "oot_flutter_aot_runner", "oot_flutter_jit_runner", "oot_flutter_jit_product_runner", diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-test.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-test.cc index 5166cca0cb..d9c1f430cf 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-test.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-test.cc @@ -51,13 +51,12 @@ // This test exercises the touch input dispatch path from Input Pipeline to a // Scenic client. It is a multi-component test, and carefully avoids sleeping or // polling for component coordination. -// - It runs real Root Presenter, Input Pipeline, and Scenic components. +// - It runs real Scene Manager and Scenic components. // - It uses a fake display controller; the physical device is unused. // // Components involved // - This test program -// - Input Pipeline -// - Root Presenter +// - Scene Manager // - Scenic // - Child view, a Scenic client // @@ -66,7 +65,7 @@ // // Setup sequence // - The test sets up this view hierarchy: -// - Top level scene, owned by Root Presenter. +// - Top level scene, owned by Scene Manager. // - Child view, owned by the ui client. // - The test waits for a Scenic event that verifies the child has UI content in // the scene graph. @@ -128,8 +127,11 @@ using RealmBuilder = component_testing::RealmBuilder; // Set this as low as you can that still works across all test platforms. constexpr zx::duration kTimeout = zx::min(1); +constexpr auto kGfxTestUIStackUrl = + "fuchsia-pkg://fuchsia.com/gfx-scene-manager-test-ui-stack#meta/" + "test-ui-stack.cm"; constexpr auto kTestUIStackUrl = - "fuchsia-pkg://fuchsia.com/gfx-root-presenter-test-ui-stack#meta/" + "fuchsia-pkg://fuchsia.com/flatland-scene-manager-test-ui-stack#meta/" "test-ui-stack.cm"; constexpr auto kMockTouchInputListener = "touch_input_listener"; @@ -424,11 +426,12 @@ class FlutterEmbedTapTest : public FlutterTapTestBase { // Makes use of gtest's parameterized testing, allowing us // to test different combinations of test-ui-stack + runners. Currently, there -// is just one combination. Documentation: +// are both GFX and Flatland variants. Documentation: // http://go/gunitadvanced#value-parameterized-tests INSTANTIATE_TEST_SUITE_P(FlutterTapTestParameterized, FlutterTapTest, - ::testing::Values(kTestUIStackUrl)); + ::testing::Values(kGfxTestUIStackUrl, + kTestUIStackUrl)); TEST_P(FlutterTapTest, FlutterTap) { // Launch client view, and wait until it's rendering to proceed with the test. @@ -454,9 +457,11 @@ TEST_P(FlutterTapTest, FlutterTap) { ASSERT_EQ(touch_injection_request_count(), 1); } +// TODO(fxbug.dev/125514): Embedded Child View needs to support Flatland. +// Only test GFX Test UI stack for embedded test cases for now. INSTANTIATE_TEST_SUITE_P(FlutterEmbedTapTestParameterized, FlutterEmbedTapTest, - ::testing::Values(kTestUIStackUrl)); + ::testing::Values(kGfxTestUIStackUrl)); TEST_P(FlutterEmbedTapTest, FlutterEmbedTap) { // Launch view