This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[fuchsia] mouse-input test #37221
Merged
Merged
[fuchsia] mouse-input test #37221
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
021d40d
WIP mouse-input port
lin-erik 970ad7d
Lint CC files
lin-erik 4e41454
Working mouse-input-test
lin-erik 2a8d486
Lint CC files
lin-erik b3096df
Add oot_flutter_jit_runner
lin-erik af6fa52
Address PR comments
lin-erik 6837bcc
Lint CC files
lin-erik d49c4e8
Merge branch 'main' into mouse-input
lin-erik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
shell/platform/fuchsia/flutter/tests/integration/mouse-input/BUILD.gn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Copyright 2013 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. | ||
|
|
||
| assert(is_fuchsia) | ||
|
|
||
| import("//build/fuchsia/sdk.gni") | ||
| import("//flutter/tools/fuchsia/fuchsia_archive.gni") | ||
| import("//flutter/tools/fuchsia/gn-sdk/package.gni") | ||
|
|
||
| group("tests") { | ||
| testonly = true | ||
| deps = [ ":mouse-input-test" ] | ||
| } | ||
|
|
||
| executable("mouse-input-test-bin") { | ||
| testonly = true | ||
| output_name = "mouse-input-test" | ||
| sources = [ "mouse-input-test.cc" ] | ||
|
|
||
| # This is needed for //third_party/googletest for linking zircon symbols. | ||
| libs = [ "$fuchsia_sdk_path/arch/$target_cpu/sysroot/lib/libzircon.so" ] | ||
|
|
||
| deps = [ | ||
| "$fuchsia_sdk_root/fidl:fuchsia.accessibility.semantics", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.buildinfo", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.component", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.fonts", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.intl", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.kernel", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.memorypressure", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.metrics", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.net.interfaces", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.tracing.provider", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.app", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.input", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.pointerinjector", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.policy", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.scenic", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.test.input", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.ui.test.scene", | ||
| "$fuchsia_sdk_root/fidl:fuchsia.web", | ||
| "$fuchsia_sdk_root/pkg:async", | ||
| "$fuchsia_sdk_root/pkg:async-loop-testing", | ||
| "$fuchsia_sdk_root/pkg:fidl_cpp", | ||
| "$fuchsia_sdk_root/pkg:scenic_cpp", | ||
| "$fuchsia_sdk_root/pkg:sys_component_cpp_testing", | ||
| "$fuchsia_sdk_root/pkg:zx", | ||
| "mouse-input-view:package", | ||
| "//build/fuchsia/fidl:fuchsia.ui.gfx", | ||
| "//flutter/fml", | ||
| "//flutter/shell/platform/fuchsia/flutter/tests/integration/utils:portable_ui_test", | ||
| "//third_party/googletest:gtest", | ||
| "//third_party/googletest:gtest_main", | ||
| ] | ||
| } | ||
|
|
||
| fuchsia_test_archive("mouse-input-test") { | ||
| testonly = true | ||
| deps = [ | ||
| ":mouse-input-test-bin", | ||
|
|
||
| # "OOT" copies of the runners used by tests, to avoid conflicting with the | ||
| # runners in the base fuchsia image. | ||
| # TODO(fxbug.dev/106575): Fix this with subpackages. | ||
| "//flutter/shell/platform/fuchsia/flutter:oot_flutter_jit_runner", | ||
| ] | ||
|
|
||
| binary = "$target_name" | ||
| cml_file = rebase_path("meta/$target_name.cml") | ||
| } |
60 changes: 60 additions & 0 deletions
60
shell/platform/fuchsia/flutter/tests/integration/mouse-input/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # mouse-input | ||
|
|
||
| `mouse-input-test` exercises mouse input through a child view (in this case, the `mouse-input-view` Dart component) and | ||
| asserting the location as well as what button was used (mouse down, mouse up, wheel, etc) during the event. We do this by | ||
| attaching the child view, injecting mouse input, and validating that the view reports the event back with the expected | ||
| payload. | ||
|
|
||
| ```shell | ||
| Injecting the mouse input | ||
| [mouse-input-test.cm] INFO: [portable_ui_test.cc(227)] Injecting mouse input | ||
|
|
||
| View receives the event | ||
| [flutter_jit_runner] INFO: mouse-input-view.cm(flutter): mouse-input-view received input: PointerData(embedderId: 0, timeStamp: 23:18:05.031003, change: PointerChange.add, kind: PointerDeviceKind.mouse, signalKind: PointerSignalKind.none, device: 4294967295, pointerIdentifier: 0, physicalX: 641.4656372070312, physicalY: 402.9313049316406, physicalDeltaX: 0.0, physicalDeltaY: 0.0, buttons: 0, synthesized: true, pressure: 0.0, pressureMin: 0.0, pressureMax: 0.0, distance: 0.0, distanceMax: 0.0, size: 0.0, radiusMajor: 0.0, radiusMinor: 0.0, radiusMin: 0.0, radiusMax: 0.0, orientation: 0.0, tilt: 0.0, platformData: 0, scrollDeltaX: 0.0, scrollDeltaY: 0.0, panX: 0.0, panY: 0.0, panDeltaX: 0.0, panDeltaY: 0.0, scale: 0.0, rotation: 0.0) | ||
|
|
||
| Successfully received response from view | ||
| [mouse-input-test.cm] INFO: [mouse-input-test.cc(120)] Received MouseInput event | ||
| [mouse-input-test.cm] INFO: [mouse-input-test.cc(207)] Client received mouse change at (641.466, 402.931) with buttons 0. | ||
| [mouse-input-test.cm] INFO: [mouse-input-test.cc(211)] Expected mouse change is at approximately (641, 402) with buttons 0. | ||
| ``` | ||
|
|
||
| ## Running the Test | ||
|
|
||
| Reference the Flutter integration test [documentation](https://github.com/flutter/engine/blob/main/shell/platform/fuchsia/flutter/tests/integration/README.md) at `//flutter/shell/platform/fuchsia/flutter/tests/integration/README.md` | ||
|
|
||
| ## Playing around with `mouse-input-view` | ||
|
|
||
| Build Fuchsia with `workstation_eng.qemu-x64` | ||
| ```shell | ||
| fx set workstation_eng.qemu-x64 --with-base=//src/session/bin/session_manager && fx build | ||
| ``` | ||
|
|
||
| Build flutter/engine | ||
| ```shell | ||
| $ENGINE_DIR/flutter/tools/gn --fuchsia --no-lto && ninja -C $ENGINE_DIR/out/fuchsia_debug_x64 flutter/shell/platform/fuchsia/flutter/tests/ | ||
| integration/mouse_input:tests | ||
| ``` | ||
|
|
||
| Start a Fuchsia package server | ||
| ```shell | ||
| cd "$FUCHSIA_DIR" | ||
| fx serve | ||
| ``` | ||
|
|
||
| Publish `touch-input-view` | ||
| ```shell | ||
| $FUCHSIA_DIR/.jiri_root/bin/fx pm publish -a -repo $FUCHSIA_DIR/$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files -f $ENGINE_DIR/out/ | ||
| fuchsia_debug_x64/gen/flutter/shell/platform/fuchsia/flutter/tests/integration/mouse-input/mouse-input-view/mouse-input-view/mouse-input-view.far | ||
| ``` | ||
|
|
||
| Launch Fuchsia emulator in a graphical environment | ||
| ```shell | ||
| ffx emu start | ||
| ``` | ||
|
|
||
| **Before proceeding, make sure you have successfully completed the "Set a Password" screen** | ||
|
|
||
| Add `mouse-input-view` | ||
| ```shell | ||
| ffx session add fuchsia-pkg://fuchsia.com/mouse-input-view#meta/mouse-input-view.cm | ||
| ``` | ||
17 changes: 17 additions & 0 deletions
17
shell/platform/fuchsia/flutter/tests/integration/mouse-input/meta/gtest_runner.shard.cml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2013 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. | ||
| { | ||
| program: { | ||
| runner: "gtest_runner", | ||
| }, | ||
| capabilities: [ | ||
| { protocol: "fuchsia.test.Suite" }, | ||
| ], | ||
| expose: [ | ||
| { | ||
| protocol: "fuchsia.test.Suite", | ||
| from: "self", | ||
| }, | ||
| ], | ||
| } |
55 changes: 55 additions & 0 deletions
55
shell/platform/fuchsia/flutter/tests/integration/mouse-input/meta/mouse-input-test.cml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright 2013 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. | ||
| { | ||
| include: [ | ||
| "gtest_runner.shard.cml", | ||
| "sys/component/realm_builder_absolute.shard.cml", | ||
|
|
||
| // This test needs both the vulkan facet and the hermetic-tier-2 facet, | ||
| // so we are forced to make it a system test. | ||
| "sys/testing/system-test.shard.cml", | ||
| ], | ||
| program: { | ||
| binary: "bin/app", | ||
| }, | ||
| use: [ | ||
| { | ||
| protocol: [ | ||
| "fuchsia.ui.test.input.MouseInputListener", | ||
| ] | ||
| } | ||
| ], | ||
| offer: [ | ||
| { | ||
| // Offer capabilities needed by components in this test realm. | ||
| // Keep it minimal, describe only what's actually needed. | ||
| protocol: [ | ||
| "fuchsia.kernel.RootJobForInspect", | ||
| "fuchsia.kernel.Stats", | ||
| "fuchsia.logger.LogSink", | ||
| "fuchsia.scheduler.ProfileProvider", | ||
| "fuchsia.sysmem.Allocator", | ||
| "fuchsia.tracing.provider.Registry", | ||
| "fuchsia.ui.input.ImeService", | ||
| "fuchsia.vulkan.loader.Loader", | ||
| "fuchsia.ui.scenic.Scenic", | ||
| "fuchsia.ui.composition.Allocator", | ||
| "fuchsia.ui.composition.Flatland", | ||
| "fuchsia.ui.test.input.MouseInputListener", | ||
| "fuchsia.intl.PropertyProvider", | ||
| "fuchsia.posix.socket.Provider", | ||
| "fuchsia.ui.pointerinjector.Registry", | ||
| ], | ||
| from: "parent", | ||
| to: "#realm_builder", | ||
| }, | ||
| { | ||
| directory: "pkg", | ||
| subdir: "config", | ||
| as: "config-data", | ||
| from: "framework", | ||
| to: "#realm_builder", | ||
| }, | ||
| ], | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.