From b01f09fea6ed45adcd9d077cd602aacaf3b325f1 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 11 Jun 2019 10:09:16 -0700 Subject: [PATCH] =?UTF-8?q?Whitelist=20the=20=E2=80=94enable=5Fmirrors=20f?= =?UTF-8?q?lag=20to=20fix=20regression=20in=20existing=20embedder.=20(flut?= =?UTF-8?q?ter/engine#9266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/flutter/shell/common/shell_unittests.cc | 16 ++++++++++++++++ engine/src/flutter/shell/common/switches.cc | 1 + 2 files changed, 17 insertions(+) diff --git a/engine/src/flutter/shell/common/shell_unittests.cc b/engine/src/flutter/shell/common/shell_unittests.cc index 1d6ffb9a88..812abd7504 100644 --- a/engine/src/flutter/shell/common/shell_unittests.cc +++ b/engine/src/flutter/shell/common/shell_unittests.cc @@ -15,6 +15,7 @@ #include "flutter/fml/message_loop.h" #include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/waitable_event.h" +#include "flutter/runtime/dart_vm.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/shell_test.h" @@ -198,6 +199,21 @@ TEST_F(ShellTest, SecondaryIsolateBindingsAreSetupViaShellSettings) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } +TEST(ShellTestNoFixture, EnableMirrorsIsWhitelisted) { + if (DartVM::IsRunningPrecompiledCode()) { + // This covers profile and release modes which use AOT (where this flag does + // not make sense anyway). + GTEST_SKIP(); + return; + } + + const std::vector options = { + fml::CommandLine::Option("dart-flags", "--enable_mirrors")}; + fml::CommandLine command_line("", options, std::vector()); + flutter::Settings settings = flutter::SettingsFromCommandLine(command_line); + EXPECT_EQ(settings.dart_flags.size(), 1u); +} + TEST_F(ShellTest, BlacklistedDartVMFlag) { // Run this test in a thread-safe manner, otherwise gtest will complain. ::testing::FLAGS_gtest_death_test_style = "threadsafe"; diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index 83a0c19d1a..a048b62bc4 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -46,6 +46,7 @@ static const std::string gDartFlagsWhitelist[] = { "--max_profile_depth", "--profile_period", "--random_seed", + "--enable_mirrors", }; // clang-format on