5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_DART_TEST_COMPONENT_CONTROLLER_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_DART_TEST_COMPONENT_CONTROLLER_H_
10#include <fuchsia/component/runner/cpp/fidl.h>
11#include <fuchsia/test/cpp/fidl.h>
12#include <lib/async-loop/cpp/loop.h>
13#include <lib/async/cpp/executor.h>
14#include <lib/async/cpp/wait.h>
15#include <lib/fdio/namespace.h>
16#include <lib/sys/cpp/component_context.h>
17#include <lib/sys/cpp/service_directory.h>
18#include <lib/zx/timer.h>
20#include <lib/fidl/cpp/binding_set.h>
21#include "lib/fidl/cpp/binding.h"
23#include "third_party/dart/runtime/include/dart_api.h"
36 :
public fuchsia::component::runner::ComponentController,
37 public fuchsia::test::Suite {
42 fuchsia::component::runner::ComponentStartInfo start_info,
43 std::shared_ptr<sys::ServiceDirectory> runner_incoming_services,
44 fidl::InterfaceRequest<fuchsia::component::runner::ComponentController>
46 DoneCallback done_callback);
57 fidl::InterfaceRequest<fuchsia::test::CaseIterator> iterator)
override;
60 void Run(std::vector<fuchsia::test::Invocation>
tests,
61 fuchsia::test::RunOptions
options,
62 fidl::InterfaceHandle<fuchsia::test::RunListener> listener)
override;
64 fidl::InterfaceRequestHandler<fuchsia::test::Suite>
GetHandler() {
65 return suite_bindings_.GetHandler(
this, loop_->dispatcher());
70 fpromise::promise<> RunDartMain();
74 bool CreateAndBindNamespace();
76 bool SetUpFromKernel();
77 bool SetUpFromAppSnapshot();
88 void OnIdleTimer(async_dispatcher_t* dispatcher,
89 async::WaitBase* wait,
91 const zx_packet_signal* signal);
94 class CaseIterator final :
public fuchsia::test::CaseIterator {
96 CaseIterator(fidl::InterfaceRequest<fuchsia::test::CaseIterator> request,
97 async_dispatcher_t* dispatcher,
98 std::string test_component_name,
101 void GetNext(GetNextCallback
callback)
override;
104 bool first_case_ =
true;
105 fidl::Binding<fuchsia::test::CaseIterator>
binding_;
106 std::string test_component_name_;
110 std::unique_ptr<CaseIterator> RemoveCaseInterator(CaseIterator*);
115 fidl::InterfacePtr<fuchsia::test::CaseListener> case_listener_;
116 std::map<CaseIterator*, std::unique_ptr<CaseIterator>> case_iterators_;
121 std::string test_component_name_;
122 std::unique_ptr<sys::ComponentContext> suite_context_;
123 fidl::BindingSet<fuchsia::test::Suite> suite_bindings_;
127 std::unique_ptr<async::Loop> loop_;
128 async::Executor executor_;
132 std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
133 std::string data_path_;
134 std::unique_ptr<sys::ComponentContext> context_;
136 fuchsia::component::runner::ComponentStartInfo start_info_;
137 fidl::Binding<fuchsia::component::runner::ComponentController> binding_;
138 DoneCallback done_callback_;
140 zx::socket out_, err_, out_client_, err_client_;
141 fdio_ns_t* namespace_ =
nullptr;
148 std::vector<dart_utils::MappedResource> kernel_peices_;
151 int32_t return_code_ = 0;
154 zx::timer idle_timer_;
156 &DartTestComponentController::OnIdleTimer>
void Run(std::vector< fuchsia::test::Invocation > tests, fuchsia::test::RunOptions options, fidl::InterfaceHandle< fuchsia::test::RunListener > listener) override
|Suite| protocol implementation.
~DartTestComponentController() override
fidl::InterfaceRequestHandler< fuchsia::test::Suite > GetHandler()
void GetTests(fidl::InterfaceRequest< fuchsia::test::CaseIterator > iterator) override
|Suite| protocol implementation.
DartTestComponentController(fuchsia::component::runner::ComponentStartInfo start_info, std::shared_ptr< sys::ServiceDirectory > runner_incoming_services, fidl::InterfaceRequest< fuchsia::component::runner::ComponentController > controller, DoneCallback done_callback)
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
const uint8_t * isolate_snapshot_data
const uint8_t * isolate_snapshot_instructions
static double time(int loops, Benchmark *bench, Target *target)