diff --git a/BUILD.gn b/BUILD.gn index f9157ff6914a8..edbbbcd20a616 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -107,7 +107,7 @@ group("flutter") { } # Compile all benchmark targets if enabled. - if (enable_unittests && !is_win) { + if (enable_unittests && !is_win && !is_fuchsia) { public_deps += [ "//flutter/display_list:display_list_benchmarks", "//flutter/fml:fml_benchmarks", diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 71ef40f1bf732..4e896a581d904 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1932,13 +1932,11 @@ FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/dart_jit_product_ FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/dart_jit_product_runner.cmx FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/dart_jit_runner.cml FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/dart_jit_runner.cmx -FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/dart_zircon_test.cmx FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/jit_product_runtime FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/meta/jit_runtime FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/service_isolate.cc FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/service_isolate.h FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/vmservice/empty.dart -FILE: ../../../flutter/shell/platform/fuchsia/dart_runner/vmservice/meta/vmservice.cmx FILE: ../../../flutter/shell/platform/fuchsia/flutter/accessibility_bridge.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/accessibility_bridge.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc @@ -2006,7 +2004,6 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_product_r FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_product_runner.cmx FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_runner.cml FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_runner.cmx -FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_runner_tests.cmx FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/jit_product_runtime FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/jit_runtime FILE: ../../../flutter/shell/platform/fuchsia/flutter/platform_view.cc @@ -2018,8 +2015,8 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/pointer_delegate_unittests FILE: ../../../flutter/shell/platform/fuchsia/flutter/program_metadata.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.h +FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_tzdata_missing_unittest.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc -FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_unittest.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/software_surface.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/software_surface.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/software_surface_producer.cc diff --git a/display_list/BUILD.gn b/display_list/BUILD.gn index 2a8a293f7157c..1f919a9ec4971 100644 --- a/display_list/BUILD.gn +++ b/display_list/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/fuchsia/sdk.gni") import("//flutter/common/config.gni") import("//flutter/testing/testing.gni") @@ -111,6 +112,12 @@ if (enable_unittests) { # Required for M_PI and others. defines += [ "_USE_MATH_DEFINES" ] } + + # This is needed for //third_party/googletest for linking zircon symbols. + if (is_fuchsia) { + libs = + [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ] + } } executable("display_list_rendertests") { @@ -132,6 +139,12 @@ if (enable_unittests) { # Required for M_PI and others. defines += [ "_USE_MATH_DEFINES" ] } + + # This is needed for //third_party/googletest for linking zircon symbols. + if (is_fuchsia) { + libs = + [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ] + } } } diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 35ad7c37bbf3a..90447af75be98 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -355,6 +355,7 @@ if (enable_unittests) { "//flutter/testing", ] + # This is needed for //third_party/googletest for linking zircon symbols. if (is_fuchsia) { libs = [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ] diff --git a/shell/platform/fuchsia/dart-pkg/zircon/test/BUILD.gn b/shell/platform/fuchsia/dart-pkg/zircon/test/BUILD.gn index 667e4c6a0806c..6feebc1d454d9 100644 --- a/shell/platform/fuchsia/dart-pkg/zircon/test/BUILD.gn +++ b/shell/platform/fuchsia/dart-pkg/zircon/test/BUILD.gn @@ -36,7 +36,7 @@ flutter_component("channel_test_flutter_component") { main_package = "channel_test" component_name = "channel_test" main_dart = "channel_test.dart" - manifest = rebase_path("meta/channel_test.cmx") + manifest = rebase_path("meta/channel_test.cml") deps = [ ":dart_library" ] } diff --git a/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cml b/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cml new file mode 100644 index 0000000000000..d3c09451ea04d --- /dev/null +++ b/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cml @@ -0,0 +1,5 @@ +{ + program: { + data: "data/channel_test", + }, +} diff --git a/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cmx b/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cmx deleted file mode 100644 index 05dd53c74f17e..0000000000000 --- a/shell/platform/fuchsia/dart-pkg/zircon/test/meta/channel_test.cmx +++ /dev/null @@ -1,10 +0,0 @@ -{ - "program": { - "data": "data/channel_test" - }, - "sandbox": { - "services": [ - "fuchsia.sys.Environment" - ] - } -} \ No newline at end of file diff --git a/shell/platform/fuchsia/dart_runner/meta/dart_zircon_test.cmx b/shell/platform/fuchsia/dart_runner/meta/dart_zircon_test.cmx deleted file mode 100644 index 36e7ac8ac5e29..0000000000000 --- a/shell/platform/fuchsia/dart_runner/meta/dart_zircon_test.cmx +++ /dev/null @@ -1,15 +0,0 @@ -{ - "program": { - "data": "data/dart_zircon_test" - }, - "sandbox": { - "features": [ - "deprecated-ambient-replace-as-executable", - "root-ssl-certificates" - ], - "services": [ - "fuchsia.intl.PropertyProvider", - "fuchsia.sys.Environment" - ] - } -} diff --git a/shell/platform/fuchsia/dart_runner/vmservice/meta/vmservice.cmx b/shell/platform/fuchsia/dart_runner/vmservice/meta/vmservice.cmx deleted file mode 100644 index 81e85a3e12edf..0000000000000 --- a/shell/platform/fuchsia/dart_runner/vmservice/meta/vmservice.cmx +++ /dev/null @@ -1,20 +0,0 @@ -{ - "program": { - "data": "data/vmservice" - }, - "sandbox": { - "services": [ - "fuchsia.cobalt.LoggerFactory", - "fuchsia.fonts.Provider", - "fuchsia.intl.PropertyProvider", - "fuchsia.logger.LogSink", - "fuchsia.modular.ContextWriter", - "fuchsia.modular.ModuleContext", - "fuchsia.sys.Environment", - "fuchsia.ui.input.ImeService", - "fuchsia.ui.policy.Presenter", - "fuchsia.ui.scenic.Scenic", - "fuchsia.wlan.product.deprecatedclient.DeprecatedClient" - ] - } -} diff --git a/shell/platform/fuchsia/flutter/BUILD.gn b/shell/platform/fuchsia/flutter/BUILD.gn index 3ddd06b9327c3..ca8f5f2c207b0 100644 --- a/shell/platform/fuchsia/flutter/BUILD.gn +++ b/shell/platform/fuchsia/flutter/BUILD.gn @@ -472,7 +472,6 @@ if (enable_unittests) { "keyboard_unittest.cc", "platform_view_unittest.cc", "pointer_delegate_unittests.cc", - "runner_unittest.cc", "tests/engine_unittests.cc", "tests/fake_flatland_unittests.cc", "tests/fake_session_unittests.cc", @@ -539,11 +538,50 @@ if (enable_unittests) { ] + flutter_deps } + executable("flutter_runner_tzdata_missing_unittests") { + testonly = true + + output_name = "flutter_runner_tzdata_missing_tests" + + sources = [ "runner_tzdata_missing_unittest.cc" ] + + # This is needed for //third_party/googletest for linking zircon symbols. + libs = [ "$fuchsia_sdk_path/arch/$target_cpu/sysroot/lib/libzircon.so" ] + + # The use of these dependencies is temporary and will be moved behind the + # embedder API. + flutter_deps = [ + "//flutter/lib/ui", + "//flutter/shell/platform/common/client_wrapper:client_wrapper_library_stubs", + "//third_party/dart/runtime:libdart_jit", + "//third_party/dart/runtime/platform:libdart_platform_jit", + ] + + deps = [ + ":flutter_runner_fixtures", + ":flutter_runner_sources", + "//flutter/testing", + ] + flutter_deps + } + fuchsia_test_archive("flutter_runner_tests") { deps = [ ":flutter_runner_unittests" ] binary = "$target_name" + resources = [ + { + path = rebase_path("//third_party/icu/common/icudtl.dat") + dest = "icudtl.dat" + }, + ] + } + + fuchsia_test_archive("flutter_runner_tzdata_tests") { + deps = [ ":flutter_runner_tzdata_unittests" ] + + binary = "$target_name" + resources = [ { path = rebase_path("//third_party/icu/common/icudtl.dat") @@ -565,12 +603,10 @@ if (enable_unittests) { dest = "tzdata/zoneinfo64.res" }, ] - - cmx_file = rebase_path("meta/$target_name.cmx") } - fuchsia_test_archive("flutter_runner_tzdata_tests") { - deps = [ ":flutter_runner_tzdata_unittests" ] + fuchsia_test_archive("flutter_runner_tzdata_missing_tests") { + deps = [ ":flutter_runner_tzdata_missing_unittests" ] binary = "$target_name" @@ -588,6 +624,18 @@ if (enable_unittests) { binary = "fml_unittests" } + fuchsia_test_archive("display_list_tests") { + deps = [ "//flutter/display_list:display_list_unittests" ] + + binary = "display_list_unittests" + } + + fuchsia_test_archive("display_list_render_tests") { + deps = [ "//flutter/display_list:display_list_rendertests" ] + + binary = "display_list_rendertests" + } + fuchsia_test_archive("flow_tests") { deps = [ "//flutter/flow:flow_unittests" ] @@ -817,9 +865,12 @@ if (enable_unittests) { deps = [ ":dart_utils_tests", + ":display_list_render_tests", + ":display_list_tests", ":embedder_tests", ":flow_tests", ":flutter_runner_tests", + ":flutter_runner_tzdata_missing_tests", ":flutter_runner_tzdata_tests", ":fml_tests", ":runtime_tests", diff --git a/shell/platform/fuchsia/flutter/meta/flutter_runner_tests.cmx b/shell/platform/fuchsia/flutter/meta/flutter_runner_tests.cmx deleted file mode 100644 index 35b1e7e996912..0000000000000 --- a/shell/platform/fuchsia/flutter/meta/flutter_runner_tests.cmx +++ /dev/null @@ -1,34 +0,0 @@ -{ - "program": { - "binary": "bin/app", - "env_vars": [ - "ICU_TIMEZONE_FILES_DIR=/pkg/data/tzdata" - ] - }, - "facets": { - "fuchsia.test": { - "system-services": [ - "fuchsia.sysmem.Allocator", - "fuchsia.ui.scenic.Scenic", - "fuchsia.vulkan.loader.Loader" - ] - } - }, - "sandbox": { - "features": [ - "deprecated-ambient-replace-as-executable", - "vulkan", - "isolated-cache-storage", - "isolated-temp" - ], - "services": [ - "fuchsia.accessibility.semantics.SemanticsManager", - "fuchsia.intl.PropertyProvider", - "fuchsia.process.Launcher", - "fuchsia.vulkan.loader.Loader", - "fuchsia.logger.LogSink", - "fuchsia.sysmem.Allocator", - "fuchsia.ui.scenic.Scenic" - ] - } -} diff --git a/shell/platform/fuchsia/flutter/runner.h b/shell/platform/fuchsia/flutter/runner.h index ea3442b8ec295..2d5c71146f260 100644 --- a/shell/platform/fuchsia/flutter/runner.h +++ b/shell/platform/fuchsia/flutter/runner.h @@ -89,7 +89,7 @@ class Runner final // Called from SetupICU, for testing only. Returns false on error. static bool SetupTZDataInternal(); #if defined(FRIEND_TEST) - FRIEND_TEST(RunnerTest, TZData); + FRIEND_TEST(RunnerTZDataTest, LoadsWithTZDataPresent); FRIEND_TEST(RunnerTZDataTest, LoadsWithoutTZDataPresent); #endif // defined(FRIEND_TEST) diff --git a/shell/platform/fuchsia/flutter/runner_tzdata_missing_unittest.cc b/shell/platform/fuchsia/flutter/runner_tzdata_missing_unittest.cc new file mode 100644 index 0000000000000..c90239c9170af --- /dev/null +++ b/shell/platform/fuchsia/flutter/runner_tzdata_missing_unittest.cc @@ -0,0 +1,20 @@ +// 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 + +#include "runner.h" +#include "third_party/icu/source/i18n/unicode/timezone.h" + +namespace flutter_runner { + +// This test has not been configured with tzdata files. This test shows that +// even without the data files, the runner continues initialization. It will +// use whatever the base data exists in icudtl.dat. +TEST(RunnerTZDataTest, LoadsWithoutTZDataPresent) { + bool success = Runner::SetupICUInternal(); + ASSERT_TRUE(success) << "failed to load set up ICU data"; +} + +} // namespace flutter_runner diff --git a/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc b/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc index c90239c9170af..d5e3460bae178 100644 --- a/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc +++ b/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc @@ -4,17 +4,31 @@ #include +#include + #include "runner.h" #include "third_party/icu/source/i18n/unicode/timezone.h" namespace flutter_runner { -// This test has not been configured with tzdata files. This test shows that -// even without the data files, the runner continues initialization. It will -// use whatever the base data exists in icudtl.dat. -TEST(RunnerTZDataTest, LoadsWithoutTZDataPresent) { +TEST(RunnerTZDataTest, LoadsWithTZDataPresent) { + // TODO(fxbug.dev/69570): Move to cml file if env_vars gains supported for the + // gtest_runner. + setenv("ICU_TIMEZONE_FILES_DIR", "/pkg/data/tzdata", true); + + UErrorCode err = U_ZERO_ERROR; + const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err)); + ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err); + + // This loads the tzdata. In Fuchsia, we force the data from this package + // to be version 2019a, so that we can test the resource load. bool success = Runner::SetupICUInternal(); - ASSERT_TRUE(success) << "failed to load set up ICU data"; + ASSERT_TRUE(success) << "failed to load timezone data"; + + const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err)); + ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err); + + EXPECT_EQ("2019a", version_after); } } // namespace flutter_runner diff --git a/shell/platform/fuchsia/flutter/runner_unittest.cc b/shell/platform/fuchsia/flutter/runner_unittest.cc deleted file mode 100644 index d21675d524b9a..0000000000000 --- a/shell/platform/fuchsia/flutter/runner_unittest.cc +++ /dev/null @@ -1,33 +0,0 @@ -// 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 -#include - -#include "runner.h" -#include "third_party/icu/source/i18n/unicode/timezone.h" - -namespace flutter_runner { - -TEST(RunnerTest, TZData) { - // TODO(fxbug.dev/69570): Move to cml file if env_vars gains supported for the - // gtest_runner. - setenv("ICU_TIMEZONE_FILES_DIR", "/pkg/data/tzdata", true); - - UErrorCode err = U_ZERO_ERROR; - const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err)); - ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err); - - // This loads the tzdata. In Fuchsia, we force the data from this package - // to be version 2019a, so that we can test the resource load. - bool success = Runner::SetupICUInternal(); - ASSERT_TRUE(success) << "failed to load timezone data"; - - const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err)); - ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err); - - EXPECT_EQ("2019a", version_after); -} - -} // namespace flutter_runner diff --git a/shell/platform/fuchsia/flutter/tests/engine_unittests.cc b/shell/platform/fuchsia/flutter/tests/engine_unittests.cc index ef88ca17e9b6b..9ae5a2b297c4a 100644 --- a/shell/platform/fuchsia/flutter/tests/engine_unittests.cc +++ b/shell/platform/fuchsia/flutter/tests/engine_unittests.cc @@ -2,24 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include -#include -#include +#include "flutter/shell/platform/fuchsia/flutter/engine.h" -#include "flutter/assets/directory_asset_bundle.h" -#include "flutter/common/graphics/persistent_cache.h" -#include "flutter/fml/memory/ref_ptr.h" -#include "flutter/fml/message_loop_impl.h" -#include "flutter/fml/task_runner.h" -#include "flutter/shell/common/serialization_callbacks.h" #include "flutter/shell/common/thread_host.h" -#include "third_party/skia/include/core/SkPicture.h" -#include "third_party/skia/include/core/SkPictureRecorder.h" -#include "third_party/skia/include/core/SkSerialProcs.h" - -#include "flutter/shell/platform/fuchsia/flutter/logging.h" -#include "flutter/shell/platform/fuchsia/flutter/runner.h" -#include "flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.h" #include "gtest/gtest.h" @@ -35,67 +20,7 @@ std::string GetCurrentTestName() { } // namespace -class MockTaskRunner : public fml::BasicTaskRunner { - public: - MockTaskRunner() {} - virtual ~MockTaskRunner() {} - - void PostTask(const fml::closure& task) override { - outstanding_tasks_.push(task); - } - - int GetTaskCount() { return task_count_; } - - void Run() { - while (!outstanding_tasks_.empty()) { - outstanding_tasks_.front()(); - outstanding_tasks_.pop(); - task_count_++; - } - } - - private: - int task_count_ = 0; - std::queue outstanding_tasks_; -}; - -class EngineTest : public ::testing::Test { - public: - void WarmupSkps( - uint64_t width, - uint64_t height, - std::shared_ptr asset_manager, - std::optional> skp_names, - std::optional> completion_callback, - bool synchronous = true) { - // Have to create a message loop so default async dispatcher gets set, - // otherwise we segfault creating the VulkanSurfaceProducer - loop_ = fml::MessageLoopImpl::Create(); - - context_ = sys::ComponentContext::CreateAndServeOutgoingDirectory(); - scenic_ = context_->svc()->Connect(); - session_.emplace(scenic_.get()); - surface_producer_ = - std::make_shared(&session_.value()); - - Engine::WarmupSkps(&concurrent_task_runner_, &raster_task_runner_, - surface_producer_, SkISize::Make(width, height), - asset_manager, skp_names, completion_callback, - synchronous); - } - - protected: - fml::RefPtr loop_; - MockTaskRunner concurrent_task_runner_; - MockTaskRunner raster_task_runner_; - std::shared_ptr surface_producer_; - - std::unique_ptr context_; - fuchsia::ui::scenic::ScenicPtr scenic_; - std::optional session_; -}; - -TEST_F(EngineTest, ThreadNames) { +TEST(EngineTest, ThreadNames) { std::string prefix = GetCurrentTestName(); flutter::ThreadHost engine_thread_host = Engine::CreateThreadHost(prefix); @@ -130,97 +55,5 @@ TEST_F(EngineTest, ThreadNames) { engine_thread_host.io_thread->Join(); } -TEST_F(EngineTest, SkpWarmup) { - SkISize draw_size = SkISize::Make(100, 100); - SkPictureRecorder recorder; - auto canvas = recorder.beginRecording(draw_size.width(), draw_size.height()); - - // adapted from https://fiddle.skia.org/c/@Canvas_drawLine - SkPaint paint; - paint.setColor(0xFF9a67be); - paint.setStrokeWidth(20); - canvas->drawLine(0, 0, draw_size.width(), draw_size.height(), paint); - canvas->drawLine(0, draw_size.height(), draw_size.width(), 0, paint); - - sk_sp picture = recorder.finishRecordingAsPicture(); - SkSerialProcs procs = {0}; - procs.fImageProc = SerializeImageWithoutData; - procs.fTypefaceProc = SerializeTypefaceWithoutData; - sk_sp data = picture->serialize(&procs); - ASSERT_TRUE(data); - ASSERT_GT(data->size(), 0u); - - fml::NonOwnedMapping mapping(data->bytes(), data->size()); - - fml::ScopedTemporaryDirectory asset_dir; - fml::UniqueFD asset_dir_fd = fml::OpenDirectory( - asset_dir.path().c_str(), false, fml::FilePermission::kRead); - fml::UniqueFD subdir_fd = fml::OpenDirectory(asset_dir_fd, "shaders", true, - fml::FilePermission::kReadWrite); - - bool success = fml::WriteAtomically(subdir_fd, "test.skp", mapping); - ASSERT_TRUE(success); - - auto asset_manager = std::make_shared(); - asset_manager->PushBack( - std::make_unique(std::move(asset_dir_fd), false)); - - WarmupSkps(draw_size.width(), draw_size.height(), asset_manager, std::nullopt, - [](uint32_t count) { EXPECT_EQ(1u, count); }); - concurrent_task_runner_.Run(); - raster_task_runner_.Run(); - - EXPECT_EQ(concurrent_task_runner_.GetTaskCount(), 1); - EXPECT_EQ(raster_task_runner_.GetTaskCount(), 1); -} - -TEST_F(EngineTest, SkpWarmupAsync) { - SkISize draw_size = SkISize::Make(100, 100); - SkPictureRecorder recorder; - auto canvas = recorder.beginRecording(draw_size.width(), draw_size.height()); - - // adapted from https://fiddle.skia.org/c/@Canvas_drawLine - SkPaint paint; - paint.setColor(0xFF9a67be); - paint.setStrokeWidth(20); - canvas->drawLine(0, 0, draw_size.width(), draw_size.height(), paint); - canvas->drawLine(0, draw_size.height(), draw_size.width(), 0, paint); - - sk_sp picture = recorder.finishRecordingAsPicture(); - SkSerialProcs procs = {0}; - procs.fImageProc = SerializeImageWithoutData; - procs.fTypefaceProc = SerializeTypefaceWithoutData; - sk_sp data = picture->serialize(&procs); - ASSERT_TRUE(data); - ASSERT_GT(data->size(), 0u); - - fml::NonOwnedMapping mapping(data->bytes(), data->size()); - - fml::ScopedTemporaryDirectory asset_dir; - fml::UniqueFD asset_dir_fd = fml::OpenDirectory( - asset_dir.path().c_str(), false, fml::FilePermission::kRead); - std::string subdir_name = "shaders"; - fml::UniqueFD subdir_fd = fml::OpenDirectory( - asset_dir_fd, subdir_name.c_str(), true, fml::FilePermission::kReadWrite); - std::string skp_name = "test.skp"; - - bool success = fml::WriteAtomically(subdir_fd, skp_name.c_str(), mapping); - ASSERT_TRUE(success); - - auto asset_manager = std::make_shared(); - asset_manager->PushBack( - std::make_unique(std::move(asset_dir_fd), false)); - - std::vector skp_names = {subdir_name + "/" + skp_name}; - - WarmupSkps(draw_size.width(), draw_size.height(), asset_manager, skp_names, - [](uint32_t count) { EXPECT_EQ(1u, count); }); - concurrent_task_runner_.Run(); - raster_task_runner_.Run(); - - EXPECT_EQ(concurrent_task_runner_.GetTaskCount(), 1); - EXPECT_EQ(raster_task_runner_.GetTaskCount(), 1); -} - } // namespace testing } // namespace flutter_runner diff --git a/testing/fuchsia/meta/test_suite.cml b/testing/fuchsia/meta/test_suite.cml index 126f37a46d4aa..b1e5f3cf761b3 100644 --- a/testing/fuchsia/meta/test_suite.cml +++ b/testing/fuchsia/meta/test_suite.cml @@ -1,6 +1,7 @@ { facets: { - "fuchsia.test": { type: "system" }, + // shell_unittests and embedder_unittests require vulkan to function. + "fuchsia.test": { type: "vulkan" }, }, program: { // TODO(fxbug.dev/80338): Switch to gtest_runner after the filters in @@ -33,43 +34,9 @@ "fuchsia.vulkan.loader.Loader", ], }, - { - storage: "cache", - path: "/cache", - }, { storage: "tmp", path: "/tmp", }, - - // The following lines are equivalent to the "vulkan" sandbox feature in - // cfv1. - // TODO(fxbug.dev/79792): Remove after vulkan cml shard is available in - // the fuchsia sdk. - { - directory: "dev-gpu", - rights: [ "rw*" ], - path: "/dev/class/gpu", - }, - { - directory: "dev-goldfish-address-space", - rights: [ "rw*" ], - path: "/dev/class/goldfish-address-space", - }, - { - directory: "dev-goldfish-control", - rights: [ "rw*" ], - path: "/dev/class/goldfish-control", - }, - { - directory: "dev-goldfish-pipe", - rights: [ "rw*" ], - path: "/dev/class/goldfish-pipe", - }, - { - directory: "dev-goldfish-sync", - rights: [ "rw*" ], - path: "/dev/class/goldfish-sync", - }, ], } diff --git a/testing/fuchsia/test_suites.yaml b/testing/fuchsia/test_suites.yaml index 12b34cb2e9faa..8dcbc8a9e2e1c 100644 --- a/testing/fuchsia/test_suites.yaml +++ b/testing/fuchsia/test_suites.yaml @@ -2,8 +2,6 @@ # test command for femu_test.py. # Legacy Component Framework v1 components. -- test_command: run-test-component fuchsia-pkg://fuchsia.com/flutter_runner_tests#meta/flutter_runner_tests.cmx - package: flutter_runner_tests-0.far - test_command: run-test-component fuchsia-pkg://fuchsia.com/flutter-embedder-test2#meta/flutter-embedder-test2.cmx packages: - flutter-embedder-test2-0.far @@ -14,10 +12,18 @@ # v2 components. - test_command: run-test-suite fuchsia-pkg://fuchsia.com/dart_runner_tests#meta/dart_runner_tests.cm package: dart_runner_tests-0.far +- test_command: run-test-suite fuchsia-pkg://fuchsia.com/flutter_runner_tests#meta/flutter_runner_tests.cm + package: flutter_runner_tests-0.far - test_command: run-test-suite fuchsia-pkg://fuchsia.com/flutter_runner_tzdata_tests#meta/flutter_runner_tzdata_tests.cm package: flutter_runner_tzdata_tests-0.far -- test_command: run-test-suite fuchsia-pkg://fuchsia.com/fml_tests#meta/fml_tests.cm -- --gtest_filter=-MessageLoop.TimeSensitiveTest_*:FileTest.CanTruncateAndWrite:FileTest.CreateDirectoryStructure +- test_command: run-test-suite fuchsia-pkg://fuchsia.com/flutter_runner_tzdata_missing_tests#meta/flutter_runner_tzdata_missing_tests.cm + package: flutter_runner_tzdata_missing_tests-0.far +- test_command: run-test-suite fuchsia-pkg://fuchsia.com/fml_tests#meta/fml_tests.cm -- --gtest_filter=-MessageLoop.TimeSensitiveTest_* package: fml_tests-0.far +- test_command: run-test-suite fuchsia-pkg://fuchsia.com/display_list_tests#meta/display_list_tests.cm + package: display_list_tests-0.far +- test_command: run-test-suite fuchsia-pkg://fuchsia.com/display_list_render_tests#meta/display_list_render_tests.cm + package: display_list_render_tests-0.far - test_command: run-test-suite fuchsia-pkg://fuchsia.com/flow_tests#meta/flow_tests.cm package: flow_tests-0.far - test_command: run-test-suite fuchsia-pkg://fuchsia.com/runtime_tests#meta/runtime_tests.cm @@ -30,7 +36,7 @@ package: txt_tests-0.far - test_command: run-test-suite fuchsia-pkg://fuchsia.com/ui_tests#meta/ui_tests.cm package: ui_tests-0.far - # TODO(fxb/87493): re-enable when this doesn't crash. + # TODO(fxb/87493): re-enable A11yTreeIsConsistent when it doesn't crash. - test_command: run-test-suite fuchsia-pkg://fuchsia.com/embedder_tests#meta/embedder_tests.cm -- --gtest_filter=-EmbedderA11yTest.A11yTreeIsConsistent package: embedder_tests-0.far - test_command: run-test-suite fuchsia-pkg://fuchsia.com/dart_utils_tests#meta/dart_utils_tests.cm