Remove obsolete tests that were time sensitive. (flutter/engine#46686)

These were always filtered away. On Fuchsia, where the filters were not
in place, there was an ifdef guard.

Followup to
https://github.com/flutter/flutter/issues/80457#issuecomment-1753419263

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
This commit is contained in:
Chinmay Garde
2023-10-09 13:39:21 -07:00
committed by GitHub
parent b4579a5fb3
commit e53f10f782
5 changed files with 1 additions and 170 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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'),