Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions fml/platform/fuchsia/message_loop_fuchsia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@

#include <lib/async-loop/default.h>
#include <lib/async/cpp/task.h>
#include <lib/async/default.h>
#include <lib/zx/time.h>

namespace fml {

MessageLoopFuchsia::MessageLoopFuchsia()
: loop_(&kAsyncLoopConfigAttachToCurrentThread) {}
: loop_(&kAsyncLoopConfigNoAttachToCurrentThread) {
async_set_default_dispatcher(loop_.dispatcher());
}

MessageLoopFuchsia::~MessageLoopFuchsia() = default;
MessageLoopFuchsia::~MessageLoopFuchsia() {
// It is only safe to unset the current thread's default dispatcher if it is
// already pointing to this loop.
if (async_get_default_dispatcher() == loop_.dispatcher()) {
async_set_default_dispatcher(nullptr);
}
}

void MessageLoopFuchsia::Run() {
loop_.Run();
Expand Down
8 changes: 3 additions & 5 deletions shell/common/animator_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ TEST_F(ShellTest, VSyncTargetTime) {
};

// create a shell with a constant firing vsync waiter.
fml::AutoResetWaitableEvent shell_creation;

auto platform_task = std::async(std::launch::async, [&]() {
fml::MessageLoop::EnsureInitializedForCurrentThread();

shell = Shell::Create(
task_runners, settings,
[vsync_clock, &create_vsync_waiter](Shell& shell) {
Expand All @@ -67,10 +67,8 @@ TEST_F(ShellTest, VSyncTargetTime) {
configuration.SetEntrypoint("onBeginFrameMain");

RunEngine(shell.get(), std::move(configuration));
shell_creation.Signal();
});

shell_creation.Wait();
platform_task.wait();

// schedule a frame to trigger window.onBeginFrame
fml::TaskRunner::RunNowOrPostTask(shell->GetTaskRunners().GetUITaskRunner(),
Expand Down
1 change: 1 addition & 0 deletions testing/fuchsia/meta/fuchsia_test.cmx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"fuchsia.process.Launcher",
"fuchsia.deprecatedtimezone.Timezone",
"fuchsia.netstack.Netstack",
"fuchsia.sysmem.Allocator",
"fuchsia.vulkan.loader.Loader",
"fuchsia.logger.LogSink",
"fuchsia.tracing.provider.Registry"
Expand Down
44 changes: 21 additions & 23 deletions testing/fuchsia/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ echo "$(date) END:EXTRACT_PACKAGES -----------------------------------"


# TODO(gw280): Enable tests using JIT runner

echo "$(date) START:flutter_runner_tests ----------------------------"
./fuchsia_ctl -d $device_name test \
-f flutter_aot_runner-0.far \
Expand All @@ -93,14 +92,15 @@ echo "$(date) START:flutter_runner_tests ----------------------------"
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:flutter_runner_tests ----------------------------"

# TODO(https://github.com/flutter/flutter/issues/50032) Enable after the
# Fuchsia message loop migration is complete.
# TODO(https://github.com/flutter/flutter/issues/??): Re-enable
# FileTest's once they pass on Fuchsia.
echo "$(date) START:fml_tests ---------------------------------------"
./fuchsia_ctl -d $device_name test \
-f fml_tests-0.far \
-t fml_tests \
-a "--gtest_filter=-MessageLoop*:Message*:FileTest*" \
-a "--gtest_filter=-FileTest*" \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
Expand All @@ -117,26 +117,24 @@ echo "$(date) START:flow_tests --------------------------------------"
echo "$(date) DONE:flow_tests ---------------------------------------"


# TODO(kaushikiska): Runtime and shell tests are failing with
# async_dispatcher failures. Re-enable them once this gets fixed.

# echo "$(date) START:runtime_tests -----------------------------------"
# ./fuchsia_ctl -d $device_name test \
# -f runtime_tests-0.far \
# -t runtime_tests \
# --identity-file $pkey \
# --timeout-seconds $test_timeout_seconds \
# --packages-directory packages

echo "$(date) START:runtime_tests -----------------------------------"
./fuchsia_ctl -d $device_name test \
-f runtime_tests-0.far \
-t runtime_tests \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:runtime_tests -----------------------------------"

# TODO(https://github.com/flutter/flutter/issues/53399): Re-enable
# OnServiceProtocolGetSkSLsWorks, CanLoadSkSLsFromAsset, and
# CanRemoveOldPersistentCache once they pass on Fuchsia.
# echo "$(date) START:shell_tests -------------------------------------"
# ./fuchsia_ctl -d $device_name test \
# -f shell_tests-0.far \
# -t shell_tests \
# -a "--gtest_filter=-ShellTest.CacheSkSLWorks:ShellTest.SetResourceCacheSize*:ShellTest.OnServiceProtocolGetSkSLsWorks:ShellTest.CanLoadSkSLsFromAsset:ShellTest.CanRemoveOldPersistentCache" \
# --identity-file $pkey \
# --timeout-seconds $test_timeout_seconds \
# --packages-directory packages
echo "$(date) START:shell_tests -------------------------------------"
./fuchsia_ctl -d $device_name test \
-f shell_tests-0.far \
-t shell_tests \
-a "--gtest_filter=-ShellTest.CacheSkSLWorks:ShellTest.SetResourceCacheSize*:ShellTest.OnServiceProtocolGetSkSLsWorks:ShellTest.CanLoadSkSLsFromAsset:ShellTest.CanRemoveOldPersistentCache" \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:shell_tests -----------------------------------"