diff --git a/engine/src/flutter/ci/licenses_golden/excluded_files b/engine/src/flutter/ci/licenses_golden/excluded_files index bbe5923f36..13f417392e 100644 --- a/engine/src/flutter/ci/licenses_golden/excluded_files +++ b/engine/src/flutter/ci/licenses_golden/excluded_files @@ -97,7 +97,6 @@ ../../../flutter/fml/memory/ref_counted_unittest.cc ../../../flutter/fml/memory/task_runner_checker_unittest.cc ../../../flutter/fml/memory/weak_ptr_unittest.cc -../../../flutter/fml/message_loop_impl_unittests.cc ../../../flutter/fml/message_loop_task_queues_merge_unmerge_unittests.cc ../../../flutter/fml/message_loop_task_queues_unittests.cc ../../../flutter/fml/message_loop_unittests.cc diff --git a/engine/src/flutter/fml/BUILD.gn b/engine/src/flutter/fml/BUILD.gn index 887d7637b7..0b4338435c 100644 --- a/engine/src/flutter/fml/BUILD.gn +++ b/engine/src/flutter/fml/BUILD.gn @@ -337,7 +337,6 @@ if (enable_unittests) { "memory/ref_counted_unittest.cc", "memory/task_runner_checker_unittest.cc", "memory/weak_ptr_unittest.cc", - "message_loop_impl_unittests.cc", "message_loop_task_queues_merge_unmerge_unittests.cc", "message_loop_task_queues_unittests.cc", "message_loop_unittests.cc", diff --git a/engine/src/flutter/fml/message_loop_impl_unittests.cc b/engine/src/flutter/fml/message_loop_impl_unittests.cc deleted file mode 100644 index 1846f8c9d4..0000000000 --- a/engine/src/flutter/fml/message_loop_impl_unittests.cc +++ /dev/null @@ -1,43 +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. - -#define FML_USED_ON_EMBEDDER - -#include "flutter/fml/message_loop_impl.h" - -#include "flutter/fml/time/time_delta.h" -#include "flutter/fml/time/time_point.h" -#include "gtest/gtest.h" - -#define TIMESENSITIVE(x) TimeSensitiveTest_##x - -TEST(MessageLoopImpl, TIMESENSITIVE(WakeUpTimersAreSingletons)) { - auto loop_impl = fml::MessageLoopImpl::Create(); - - const auto t1 = fml::TimeDelta::FromMilliseconds(10); - const auto t2 = fml::TimeDelta::FromMilliseconds(30); - - const auto begin = fml::TimePoint::Now(); - - // Register a task scheduled in the future. This schedules a WakeUp call on - // the MessageLoopImpl with that fml::TimePoint. - loop_impl->PostTask( - [&]() { - auto delta = fml::TimePoint::Now() - begin; - auto ms = delta.ToMillisecondsF(); - ASSERT_GE(ms, 20); - ASSERT_LE(ms, 40); - - loop_impl->Terminate(); - }, - begin + t1); - - // Call WakeUp manually to change the WakeUp time further in the future. If - // the timer is correctly set up to be rearmed instead of a task being - // scheduled for each WakeUp, the above task will be executed at t2 instead of - // t1 now. - loop_impl->WakeUp(begin + t2); - - loop_impl->Run(); -} diff --git a/engine/src/flutter/fml/message_loop_unittests.cc b/engine/src/flutter/fml/message_loop_unittests.cc index 222810d406..5e64e407f8 100644 --- a/engine/src/flutter/fml/message_loop_unittests.cc +++ b/engine/src/flutter/fml/message_loop_unittests.cc @@ -17,7 +17,6 @@ #include "flutter/fml/time/chrono_timestamp_provider.h" #include "gtest/gtest.h" -#define TIMESENSITIVE(x) TimeSensitiveTest_##x #if FML_OS_WIN #define PLATFORM_SPECIFIC_CAPTURE(...) [ __VA_ARGS__, count ] #else @@ -155,128 +154,6 @@ TEST(MessageLoop, CheckRunsTaskOnCurrentThread) { thread.join(); } -TEST(MessageLoop, TIMESENSITIVE(SingleDelayedTaskByDelta)) { -#if defined(OS_FUCHSIA) - GTEST_SKIP() - << "This test does not work on Fuchsia. https://fxbug.dev/110020 "; -#else - - bool checked = false; - std::thread thread([&checked]() { - fml::MessageLoop::EnsureInitializedForCurrentThread(); - auto& loop = fml::MessageLoop::GetCurrent(); - auto begin = fml::ChronoTicksSinceEpoch(); - loop.GetTaskRunner()->PostDelayedTask( - [begin, &checked]() { - auto delta = fml::ChronoTicksSinceEpoch() - begin; - auto ms = delta.ToMillisecondsF(); - ASSERT_GE(ms, 3); - ASSERT_LE(ms, 7); - checked = true; - fml::MessageLoop::GetCurrent().Terminate(); - }, - fml::TimeDelta::FromMilliseconds(5)); - loop.Run(); - }); - thread.join(); - ASSERT_TRUE(checked); -#endif // OS_FUCHSIA -} - -TEST(MessageLoop, TIMESENSITIVE(SingleDelayedTaskForTime)) { -#if defined(OS_FUCHSIA) - GTEST_SKIP() - << "This test does not work on Fuchsia. https://fxbug.dev/110020 "; -#else - - bool checked = false; - std::thread thread([&checked]() { - fml::MessageLoop::EnsureInitializedForCurrentThread(); - auto& loop = fml::MessageLoop::GetCurrent(); - auto begin = fml::ChronoTicksSinceEpoch(); - loop.GetTaskRunner()->PostTaskForTime( - [begin, &checked]() { - auto delta = fml::ChronoTicksSinceEpoch() - begin; - auto ms = delta.ToMillisecondsF(); - ASSERT_GE(ms, 3); - ASSERT_LE(ms, 7); - checked = true; - fml::MessageLoop::GetCurrent().Terminate(); - }, - fml::ChronoTicksSinceEpoch() + fml::TimeDelta::FromMilliseconds(5)); - loop.Run(); - }); - thread.join(); - ASSERT_TRUE(checked); -#endif // OS_FUCHSIA -} - -TEST(MessageLoop, TIMESENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { -#if defined(OS_FUCHSIA) - GTEST_SKIP() - << "This test does not work on Fuchsia. https://fxbug.dev/110020 "; -#else - - const auto count = 10; - int checked = false; - std::thread thread(PLATFORM_SPECIFIC_CAPTURE(&checked)() { - fml::MessageLoop::EnsureInitializedForCurrentThread(); - auto& loop = fml::MessageLoop::GetCurrent(); - for (int target_ms = 0 + 2; target_ms < count + 2; target_ms++) { - auto begin = fml::ChronoTicksSinceEpoch(); - loop.GetTaskRunner()->PostDelayedTask( - PLATFORM_SPECIFIC_CAPTURE(begin, target_ms, &checked)() { - auto delta = fml::ChronoTicksSinceEpoch() - begin; - auto ms = delta.ToMillisecondsF(); - ASSERT_GE(ms, target_ms - 2); - ASSERT_LE(ms, target_ms + 2); - checked++; - if (checked == count) { - fml::MessageLoop::GetCurrent().Terminate(); - } - }, - fml::TimeDelta::FromMilliseconds(target_ms)); - } - loop.Run(); - }); - thread.join(); - ASSERT_EQ(checked, count); -#endif // OS_FUCHSIA -} - -TEST(MessageLoop, TIMESENSITIVE(MultipleDelayedTasksWithDecreasingDeltas)) { -#if defined(OS_FUCHSIA) - GTEST_SKIP() - << "This test does not work on Fuchsia. https://fxbug.dev/110020 "; -#else - - const auto count = 10; - int checked = false; - std::thread thread(PLATFORM_SPECIFIC_CAPTURE(&checked)() { - fml::MessageLoop::EnsureInitializedForCurrentThread(); - auto& loop = fml::MessageLoop::GetCurrent(); - for (int target_ms = count + 2; target_ms > 0 + 2; target_ms--) { - auto begin = fml::ChronoTicksSinceEpoch(); - loop.GetTaskRunner()->PostDelayedTask( - PLATFORM_SPECIFIC_CAPTURE(begin, target_ms, &checked)() { - auto delta = fml::ChronoTicksSinceEpoch() - begin; - auto ms = delta.ToMillisecondsF(); - ASSERT_GE(ms, target_ms - 2); - ASSERT_LE(ms, target_ms + 2); - checked++; - if (checked == count) { - fml::MessageLoop::GetCurrent().Terminate(); - } - }, - fml::TimeDelta::FromMilliseconds(target_ms)); - } - loop.Run(); - }); - thread.join(); - ASSERT_EQ(checked, count); -#endif // OS_FUCHSIA -} - TEST(MessageLoop, TaskObserverFire) { bool started = false; bool terminated = false; diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index 9a0e24f4f1..898201cecf 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -41,7 +41,6 @@ FONTS_DIR = os.path.join( ROBOTO_FONT_PATH = os.path.join(FONTS_DIR, 'Roboto-Regular.ttf') FONT_SUBSET_DIR = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'font-subset') -FML_UNITTESTS_FILTER = '--gtest_filter=-*TimeSensitiveTest*' ENCODING = 'UTF-8' logger = logging.getLogger(__name__) @@ -402,7 +401,7 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump): make_test('embedder_a11y_unittests'), make_test('embedder_proctable_unittests'), make_test('embedder_unittests'), - make_test('fml_unittests', flags=[FML_UNITTESTS_FILTER] + repeat_flags), + make_test('fml_unittests'), make_test('no_dart_plugin_registrant_unittests'), make_test('runtime_unittests'), make_test('testing_unittests'),