@@ -113,8 +113,7 @@ namespace {
113113using component_testing::ChildRef;
114114using component_testing::ConfigValue;
115115using component_testing::DirectoryContents;
116- using component_testing::LocalComponent;
117- using component_testing::LocalComponentHandles;
116+ using component_testing::LocalComponentImpl;
118117using component_testing::ParentRef;
119118using component_testing::Protocol;
120119using component_testing::Realm;
@@ -151,17 +150,17 @@ bool CompareDouble(double f0, double f1, double epsilon) {
151150}
152151
153152// This component implements the TouchInput protocol
154- // and the interface for a RealmBuilder LocalComponent . A LocalComponent
153+ // and the interface for a RealmBuilder LocalComponentImpl . A LocalComponentImpl
155154// is a component that is implemented here in the test, as opposed to
156155// elsewhere in the system. When it's inserted to the realm, it will act
157156// like a proper component. This is accomplished, in part, because the
158157// realm_builder library creates the necessary plumbing. It creates a manifest
159158// for the component and routes all capabilities to and from it.
160- // LocalComponent :
159+ // LocalComponentImpl :
161160// https://fuchsia.dev/fuchsia-src/development/testing/components/realm_builder#mock-components
162161class TouchInputListenerServer
163162 : public fuchsia::ui::test::input::TouchInputListener,
164- public LocalComponent {
163+ public LocalComponentImpl {
165164 public:
166165 explicit TouchInputListenerServer (async_dispatcher_t * dispatcher)
167166 : dispatcher_(dispatcher) {}
@@ -174,21 +173,20 @@ class TouchInputListenerServer
174173 events_received_.push_back (std::move (request));
175174 }
176175
177- // |LocalComponent::Start |
176+ // |LocalComponentImpl::OnStart |
178177 // When the component framework requests for this component to start, this
179178 // method will be invoked by the realm_builder library.
180- void Start (std::unique_ptr<LocalComponentHandles> local_handles ) override {
179+ void OnStart ( ) override {
181180 FML_LOG (INFO) << " Starting TouchInputListenerServer" ;
182181 // When this component starts, add a binding to the
183182 // protocol to this component's outgoing directory.
184- ASSERT_EQ (ZX_OK, local_handles-> outgoing ()->AddPublicService (
183+ ASSERT_EQ (ZX_OK, outgoing ()->AddPublicService (
185184 fidl::InterfaceRequestHandler<
186185 fuchsia::ui::test::input::TouchInputListener>(
187186 [this ](auto request) {
188187 bindings_.AddBinding (this , std::move (request),
189188 dispatcher_);
190189 })));
191- local_handles_.emplace_back (std::move (local_handles));
192190 }
193191
194192 const std::vector<
@@ -199,7 +197,6 @@ class TouchInputListenerServer
199197
200198 private:
201199 async_dispatcher_t * dispatcher_ = nullptr ;
202- std::vector<std::unique_ptr<LocalComponentHandles>> local_handles_;
203200 fidl::BindingSet<fuchsia::ui::test::input::TouchInputListener> bindings_;
204201 std::vector<
205202 fuchsia::ui::test::input::TouchInputListenerReportTouchInputRequest>
@@ -290,7 +287,7 @@ class FlutterTapTestBase : public PortableUITest,
290287
291288 ParamType GetTestUIStackUrl () override { return GetParam (); };
292289
293- std::unique_ptr< TouchInputListenerServer> touch_input_listener_server_;
290+ TouchInputListenerServer* touch_input_listener_server_;
294291};
295292
296293class FlutterTapTest : public FlutterTapTestBase {
@@ -299,10 +296,14 @@ class FlutterTapTest : public FlutterTapTestBase {
299296 FML_LOG (INFO) << " Extending realm" ;
300297 // Key part of service setup: have this test component vend the
301298 // |TouchInputListener| service in the constructed realm.
302- touch_input_listener_server_ =
299+ auto touch_input_listener_server =
303300 std::make_unique<TouchInputListenerServer>(dispatcher ());
304- realm_builder ()->AddLocalChild (kMockTouchInputListener ,
305- touch_input_listener_server_.get ());
301+ touch_input_listener_server_ = touch_input_listener_server.get ();
302+ realm_builder ()->AddLocalChild (
303+ kMockTouchInputListener , [touch_input_listener_server = std::move (
304+ touch_input_listener_server)]() mutable {
305+ return std::move (touch_input_listener_server);
306+ });
306307
307308 // Add touch-input-view to the Realm
308309 realm_builder ()->AddChild (kTouchInputView , kTouchInputViewUrl ,
@@ -381,10 +382,14 @@ class FlutterEmbedTapTest : public FlutterTapTestBase {
381382 FML_LOG (INFO) << " Extending realm" ;
382383 // Key part of service setup: have this test component vend the
383384 // |TouchInputListener| service in the constructed realm.
384- touch_input_listener_server_ =
385+ auto touch_input_listener_server =
385386 std::make_unique<TouchInputListenerServer>(dispatcher ());
386- realm_builder ()->AddLocalChild (kMockTouchInputListener ,
387- touch_input_listener_server_.get ());
387+ touch_input_listener_server_ = touch_input_listener_server.get ();
388+ realm_builder ()->AddLocalChild (
389+ kMockTouchInputListener , [touch_input_listener_server = std::move (
390+ touch_input_listener_server)]() mutable {
391+ return std::move (touch_input_listener_server);
392+ });
388393
389394 // Add touch-input-view to the Realm
390395 realm_builder ()->AddChild (kTouchInputView , kTouchInputViewUrl ,
0 commit comments