diff --git a/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.cc b/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.cc index 7d6e6bcfdf..f22dcb6b74 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.cc +++ b/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.cc @@ -48,7 +48,6 @@ namespace dart_runner { namespace { constexpr char kTmpPath[] = "/tmp"; -constexpr char kTestCaseName[] = "dart_test_v2"; constexpr zx::duration kIdleWaitDuration = zx::sec(2); constexpr zx::duration kIdleNotifyDuration = zx::msec(500); @@ -116,8 +115,8 @@ DartTestComponentControllerV2::DartTestComponentControllerV2( // applications in tree currently, but the way we build the Flutter // application may change. We should avoid assuming the data path and let the // CML file specify this data path instead. - const std::string component_name = GetComponentNameFromUrl(url_); - data_path_ = "pkg/data/" + component_name; + test_component_name_ = GetComponentNameFromUrl(url_); + data_path_ = "pkg/data/" + test_component_name_; if (controller.is_valid()) { binding_.Bind(std::move(controller)); @@ -366,8 +365,10 @@ bool DartTestComponentControllerV2::CreateIsolate( DartTestComponentControllerV2::CaseIterator::CaseIterator( fidl::InterfaceRequest request, async_dispatcher_t* dispatcher, + std::string test_component_name, fit::function done_callback) : binding_(this, std::move(request), dispatcher), + test_component_name_(test_component_name), done_callback_(std::move(done_callback)) {} // |fuchsia::test::CaseIterator| @@ -377,7 +378,7 @@ void DartTestComponentControllerV2::CaseIterator::GetNext( // test case. Flip flag once the one test case has been retrieved. if (first_case_) { fuchsia::test::Case test_case; - test_case.set_name(std::string(kTestCaseName)); + test_case.set_name(test_component_name_); test_case.set_enabled(true); std::vector cases; cases.push_back(std::move(test_case)); @@ -409,11 +410,11 @@ DartTestComponentControllerV2::RemoveCaseInterator( // |fuchsia::test::Suite| void DartTestComponentControllerV2::GetTests( fidl::InterfaceRequest iterator) { - auto case_iterator = - std::make_unique(std::move(iterator), loop_->dispatcher(), - [this](CaseIterator* case_iterator) { - RemoveCaseInterator(case_iterator); - }); + auto case_iterator = std::make_unique( + std::move(iterator), loop_->dispatcher(), test_component_name_, + [this](CaseIterator* case_iterator) { + RemoveCaseInterator(case_iterator); + }); case_iterators_.emplace(case_iterator.get(), std::move(case_iterator)); } diff --git a/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.h b/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.h index f16ed2c5d6..65b42a663c 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.h +++ b/engine/src/flutter/shell/platform/fuchsia/dart_runner/dart_test_component_controller_v2.h @@ -96,6 +96,7 @@ class DartTestComponentControllerV2 public: CaseIterator(fidl::InterfaceRequest request, async_dispatcher_t* dispatcher, + std::string test_component_name, fit::function done_callback); void GetNext(GetNextCallback callback) override; @@ -103,6 +104,7 @@ class DartTestComponentControllerV2 private: bool first_case_ = true; fidl::Binding binding_; + std::string test_component_name_; fit::function done_callback_; }; @@ -117,6 +119,7 @@ class DartTestComponentControllerV2 // |Suite| /// Exposes suite protocol on behalf of test component. + std::string test_component_name_; std::unique_ptr suite_context_; fidl::BindingSet suite_bindings_;