Skip to content

Commit

Permalink
[fuchsia] Migrate fuchsia.ui.input3 to Natural FIDL bindings
Browse files Browse the repository at this point in the history
Bug: 1351487
Change-Id: I7a543e660371f8d98aa1f856481870d82ffdf5c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4327451
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Bryant Chandler <bryantchandler@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122520}
  • Loading branch information
Bryant Chandler authored and Chromium LUCI CQ committed Mar 27, 2023
1 parent 2426796 commit d6c075d
Show file tree
Hide file tree
Showing 17 changed files with 351 additions and 316 deletions.
3 changes: 2 additions & 1 deletion fuchsia_web/webengine/BUILD.gn
Expand Up @@ -610,10 +610,11 @@ test("web_engine_browsertests") {
"//testing/gtest",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.accessibility.semantics:fuchsia.accessibility.semantics_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.element:fuchsia.element_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.input.virtualkeyboard:fuchsia.input.virtualkeyboard_cpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.input.virtualkeyboard:fuchsia.input.virtualkeyboard_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mediacodec:fuchsia.mediacodec_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mem:fuchsia.mem_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp",
"//ui/gfx",
"//ui/ozone",
Expand Down
318 changes: 158 additions & 160 deletions fuchsia_web/webengine/browser/input_browsertest.cc

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions fuchsia_web/webengine/browser/virtual_keyboard_browsertest.cc
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <fidl/fuchsia.ui.input3/cpp/fidl.h>
#include <fuchsia/input/virtualkeyboard/cpp/fidl.h>
#include <fuchsia/ui/input3/cpp/fidl.h>
#include <lib/fit/function.h>

#include "base/fuchsia/fuchsia_logging.h"
Expand Down Expand Up @@ -73,7 +73,8 @@ class VirtualKeyboardTest : public WebEngineBrowserTest {

// Ensure that the fuchsia.ui.input3.Keyboard service is connected.
component_context_->additional_services()
->RemovePublicService<fuchsia::ui::input3::Keyboard>();
->RemovePublicService<fuchsia_ui_input3::Keyboard>(
fidl::DiscoverableProtocolName<fuchsia_ui_input3::Keyboard>);
keyboard_input_checker_.emplace(component_context_->additional_services());

fuchsia::web::NavigationControllerPtr controller;
Expand Down Expand Up @@ -134,7 +135,7 @@ class VirtualKeyboardTest : public WebEngineBrowserTest {
ScenicTestHelper scenic_test_helper_;
base::test::ScopedFeatureList scoped_feature_list_;

absl::optional<EnsureConnectedChecker<fuchsia::ui::input3::Keyboard>>
absl::optional<EnsureConnectedChecker<fuchsia_ui_input3::Keyboard>>
keyboard_input_checker_;

// Fake virtual keyboard services for the InputMethod to use.
Expand Down
22 changes: 12 additions & 10 deletions fuchsia_web/webengine/test/scoped_connection_checker.h
Expand Up @@ -6,16 +6,18 @@
#define FUCHSIA_WEB_WEBENGINE_TEST_SCOPED_CONNECTION_CHECKER_H_

#include <lib/fdio/directory.h>
#include <lib/fidl/cpp/wire/connect_service.h>
#include <lib/vfs/cpp/service.h>

#include <memory>
#include <string>

#include "base/fuchsia/fuchsia_logging.h"
#include "testing/gtest/include/gtest/gtest.h"

// Verifies that a connection was made, or never attempted, for a given
// |Service| without needing to provide an implementation.
template <typename Service, bool expect_connection>
// `Protocol` without needing to provide an implementation.
template <typename Protocol, bool expect_connection>
class ScopedConnectionCheckerBase {
public:
explicit ScopedConnectionCheckerBase(
Expand All @@ -25,7 +27,7 @@ class ScopedConnectionCheckerBase {
[this](zx::channel channel, async_dispatcher_t*) {
pending_channels_.push_back(std::move(channel));
}),
std::string(Service::Name_));
fidl::DiscoverableProtocolName<Protocol>);

ZX_CHECK(status == ZX_OK, status) << "OutgoingDirectory::AddPublicService";
}
Expand All @@ -43,16 +45,16 @@ class ScopedConnectionCheckerBase {

private:
// Client channels are held in a pending (unconnected) state for the
// lifetime of |this|, so that the client never sees a disconnection event.
// lifetime of `this`, so that the client never sees a disconnection event.
std::vector<zx::channel> pending_channels_;
};

// Checks that no client attempted to connect to |Service|.
template <typename Service>
using NeverConnectedChecker = ScopedConnectionCheckerBase<Service, false>;
// Checks that no client attempted to connect to `Protocol`.
template <typename Protocol>
using NeverConnectedChecker = ScopedConnectionCheckerBase<Protocol, false>;

// Checks that at least one client attempted to connect to |Service|.
template <typename Service>
using EnsureConnectedChecker = ScopedConnectionCheckerBase<Service, true>;
// Checks that at least one client attempted to connect to `Protocol`.
template <typename Protocol>
using EnsureConnectedChecker = ScopedConnectionCheckerBase<Protocol, true>;

#endif // FUCHSIA_WEB_WEBENGINE_TEST_SCOPED_CONNECTION_CHECKER_H_
2 changes: 1 addition & 1 deletion ui/base/ime/fuchsia/BUILD.gn
Expand Up @@ -22,7 +22,7 @@ component("fuchsia") {
"//base",
"//third_party/abseil-cpp:absl",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.input.virtualkeyboard:fuchsia.input.virtualkeyboard_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3_hlcpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
"//ui/base/ime",
Expand Down

0 comments on commit d6c075d

Please sign in to comment.